All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/intc/arm_gicv3_cpuif: Don't count a virtual EOI in EOImode 1
@ 2026-11-19  9:19 Fuad Tabba
  0 siblings, 0 replies; only message in thread
From: Fuad Tabba @ 2026-11-19  9:19 UTC (permalink / raw)
  To: peter.maydell; +Cc: qemu-arm, qemu-devel, qemu-stable, tabba

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



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

only message in thread, other threads:[~2026-11-19  9:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19  9:19 [PATCH] hw/intc/arm_gicv3_cpuif: Don't count a virtual EOI in EOImode 1 Fuad Tabba

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.