Skip to content

Commit 9dbc22f

Browse files
author
Charles Mirabile
committed
irqchip/gic-v3: Force propagation of the active state with a read-back
JIRA: https://issues.redhat.com/browse/RHEL-62922 commit 464cb98 Author: Marc Zyngier <maz@kernel.org> Date: Wed, 6 Nov 2024 08:44:18 +0000 Christoffer reports that on some implementations, writing to GICR_ISACTIVER0 (and similar GICD registers) can race badly with a guest issuing a deactivation of that interrupt via the system register interface. There are multiple reasons to this: - this uses an early write-acknoledgement memory type (nGnRE), meaning that the write may only have made it as far as some interconnect by the time the store is considered "done" - the GIC itself is allowed to buffer the write until it decides to take it into account (as long as it is in finite time) The effects are that the activation may not have taken effect by the time the kernel enters the guest, forcing an immediate exit, or that a guest deactivation occurs before the interrupt is active, doing nothing. In order to guarantee that the write to the ISACTIVER register has taken effect, read back from it, forcing the interconnect to propagate the write, and the GIC to process the write before returning the read. Reported-by: Christoffer Dall <christoffer.dall@arm.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Christoffer Dall <christoffer.dall@arm.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/all/20241106084418.3794612-1-maz@kernel.org Signed-off-by: Charles Mirabile <cmirabil@redhat.com>
1 parent 324597b commit 9dbc22f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/irqchip/irq-gic-v3.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,13 @@ static int gic_irq_set_irqchip_state(struct irq_data *d,
539539
}
540540

541541
gic_poke_irq(d, reg);
542+
543+
/*
544+
* Force read-back to guarantee that the active state has taken
545+
* effect, and won't race with a guest-driven deactivation.
546+
*/
547+
if (reg == GICD_ISACTIVER)
548+
gic_peek_irq(d, reg);
542549
return 0;
543550
}
544551

0 commit comments

Comments
 (0)