From: ~liuxu <liuxu@git.sr.ht>
To: qemu-devel@nongnu.org
Cc: Richard Henderson <richard.henderson@linaro.org>
Subject: [PATCH qemu] hw/intc: Call sifive_plic_update() after writing interrupt enable
Date: Wed, 25 Mar 2026 14:31:56 +0800 [thread overview]
Message-ID: <177442359063.1954.8266696018975379698-0@git.sr.ht> (raw)
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
reply other threads:[~2026-03-25 7:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=177442359063.1954.8266696018975379698-0@git.sr.ht \
--to=liuxu@git.sr.ht \
--cc=liuxu@nucleisys.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox