]> 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>
Sun, 10 Nov 2024 08:09:26 +0000 (11:09 +0300)
commit51bb79af8fd7c5bb7b64ec1b82750d234e7cfec1
treeb347bf1a192a6d4404f2b3a49aef7635801666ff
parentd827e1a8d51640929650bc89c23906e9c467687b
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