]> www.infradead.org Git - users/dwmw2/qemu.git/commit
hw/intc/riscv_aplic: Fix setipnum_le write emulation for APLIC MSI-mode
authorAnup Patel <apatel@ventanamicro.com>
Wed, 6 Mar 2024 09:57:21 +0000 (15:27 +0530)
committerAlistair Francis <alistair.francis@wdc.com>
Fri, 8 Mar 2024 10:48:03 +0000 (20:48 +1000)
commitbf31cf06eb5e709a1a7b082dc7956baadc4b70fa
treeb8ac06e1713f8c488248be60c950718b9449fc24
parent938dd05ea1f3a9e3c713b1d73dc2992d62efb830
hw/intc/riscv_aplic: Fix setipnum_le write emulation for APLIC MSI-mode

The writes to setipnum_le register in APLIC MSI-mode have special
consideration for level-triggered interrupts as-per section "4.9.2
Special consideration for level-sensitive interrupt sources" of the
RISC-V AIA specification.

Particularly, the below text from the RISC-V specification defines
the behaviour of writes to setipnum_le for level-triggered interrupts:

"A second option is for the interrupt service routine to write the
APLIC’s source identity number for the interrupt to the domain’s
setipnum register just before exiting. This will cause the interrupt’s
pending bit to be set to one again if the source is still asserting
an interrupt, but not if the source is not asserting an interrupt."

Fix setipnum_le write emulation for APLIC MSI-mode by implementing
the above behaviour in riscv_aplic_set_pending() function.

Fixes: e8f79343cfc8 ("hw/intc: Add RISC-V AIA APLIC device emulation")
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Message-ID: <20240306095722.463296-2-apatel@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
hw/intc/riscv_aplic.c