]> 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:10:00 +0000 (11:10 +0300)
commit39d858fa23859536fe74d6326535fffa31b6b165
treeab6cecc1d74ab5e1567a5b8c2abeaf26b3b6d477
parent6e46caa91f84d9c8c73bf46a69e935fb7f541a68
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>
(Mjt: context fixup in hw/intc/riscv_aplic.c)
hw/intc/riscv_aplic.c