From: Fuad Tabba <fuad.tabba@linux.dev>
To: peter.maydell@linaro.org
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org,
qemu-stable@nongnu.org, tabba@google.com
Subject: [PATCH] hw/intc/arm_gicv3_cpuif: Don't count a virtual EOI in EOImode 1
Date: Thu, 19 Nov 2026 09:19:22 +0000 [thread overview]
Message-ID: <20261119091922.1380805-1-fuad.tabba@linux.dev> (raw)
icv_eoir_write() increments ICH_HCR_EL2.EOIcount for a virtual EOI with
no matching list register, in either EOImode. The VirtualWriteEOIR0()
and VirtualWriteEOIR1() pseudocode in the GICv3 architecture
specification only does so in EOImode 0 (ICH_VMCR_EL2.VEOIM clear),
since in EOImode 1 the DIR write increments EOIcount instead.
In EOImode 1 an interrupt with no list register is therefore counted
twice, and KVM running under TCG deactivates an interrupt that its guest
has yet to deactivate.
Increment EOIcount on EOIR only when EOImode is 0.
Fixes: b3b48f529fe8 ("hw/intc/arm_gicv3: Implement ICV_ registers EOIR and IAR")
Cc: qemu-stable@nongnu.org
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
---
Notes:
Tested with a local reproducer that runs a KVM guest in EOImode 1
under TCG, with more interrupts pending than list registers. Without
this patch the guest sees an interrupt deactivated before its DIR,
and with it the reproducer passes.
hw/intc/arm_gicv3_cpuif.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c
index 67a0bba4b0..02e1e7c254 100644
--- a/hw/intc/arm_gicv3_cpuif.c
+++ b/hw/intc/arm_gicv3_cpuif.c
@@ -1617,9 +1617,10 @@ static void icv_eoir_write(CPUARMState *env, const ARMCPRegInfo *ri,
if (idx < 0) {
/*
* No valid list register corresponding to EOI ID; if this is a vLPI
- * not in the list regs then do nothing; otherwise increment EOI count
+ * not in the list regs then do nothing; otherwise increment EOI count,
+ * unless drop and deactivate are split, when the DIR write does so.
*/
- if (irq < GICV3_LPI_INTID_START) {
+ if (irq < GICV3_LPI_INTID_START && !icv_eoi_split(env, cs)) {
icv_increment_eoicount(cs);
}
} else {
--
2.47.3
reply other threads:[~2026-11-19 9:19 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=20261119091922.1380805-1-fuad.tabba@linux.dev \
--to=fuad.tabba@linux.dev \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=tabba@google.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.