public inbox for qemu-devel@nongnu.org
 help / color / mirror / Atom feed
* [PATCH qemu] hw/intc: Call sifive_plic_update() after writing interrupt enable
@ 2026-03-25  6:31 ~liuxu
  0 siblings, 0 replies; only message in thread
From: ~liuxu @ 2026-03-25  6:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson

From: lxx <1733205434@qq.com>

When a guest writes to the interrupt enable register, the PLIC state
is updated but sifive_plic_update() is not called to re-evaluate the
interrupt line to the hart. This causes a lost interrupt when the
pending bit is set before the enable bit is written.

This is a level-triggered condition that must be re-evaluated whenever
any of the three factors change: pending bits, enable bits, or
threshold/priority. All other register writes that affect interrupt
delivery (priority, pending, threshold) already call
sifive_plic_update() after the write. Fix the enable register write
handler to do the same.

Signed-off-by: LIU Xu <liuxu@nucleisys.com>
---
 hw/intc/sifive_plic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/intc/sifive_plic.c b/hw/intc/sifive_plic.c
index 9c84ff06a9f..f893384e4df 100644
--- a/hw/intc/sifive_plic.c
+++ b/hw/intc/sifive_plic.c
@@ -219,6 +219,7 @@ static void sifive_plic_write(void *opaque, hwaddr addr, uint64_t value,
 
         if (wordid < plic->bitfield_words) {
             plic->enable[addrid * plic->bitfield_words + wordid] = value;
+            sifive_plic_update(plic);
         } else {
             qemu_log_mask(LOG_GUEST_ERROR,
                           "%s: Invalid enable write 0x%" HWADDR_PRIx "\n",
-- 
2.49.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-03-25  7:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25  6:31 [PATCH qemu] hw/intc: Call sifive_plic_update() after writing interrupt enable ~liuxu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox