]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/intc/riscv_aplic: Check and update pending when write sourcecfg
authorYong-Xuan Wang <yongxuan.wang@sifive.com>
Fri, 4 Oct 2024 10:46:47 +0000 (18:46 +0800)
committerMichael Tokarev <mjt@tls.msk.ru>
Tue, 5 Nov 2024 07:28:23 +0000 (10:28 +0300)
commit2a5c4a91ca5fbd46f5a58eb9bf274af56dc7252c
treeb94ecd8cc4e1c1f8b736a9824e9e2b4fe36e5c91
parent08c6ed47e6fee0c4c536e1202c643a0ce36f48be
hw/intc/riscv_aplic: Check and update pending when write sourcecfg

The section 4.5.2 of the RISC-V AIA specification says that any write
to a sourcecfg register of an APLIC might (or might not) cause the
corresponding interrupt-pending bit to be set to one if the rectified
input value is high (= 1) under the new source mode.

If an interrupt is asserted before the driver configs its interrupt
type to APLIC, it's pending bit will not be set except a relevant
write to a setip or setipnum register. When we write the interrupt
type to sourcecfg register, if the APLIC device doesn't check
rectified input value and update the pending bit, this interrupt
might never becomes pending.

For APLIC.m, we can manully set pending by setip or setipnum
registers in driver. But for APLIC.w, the pending status totally
depends on the rectified input value, we can't control the pending
status via mmio registers. In this case, hw should check and update
pending status for us when writing sourcecfg registers.

Update QEMU emulation to handle "pre-existing" interrupts.

Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20241004104649.13129-1-yongxuan.wang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
(cherry picked from commit 2ae6cca1d3389801ee72fc5e58c52573218f3514)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/intc/riscv_aplic.c