Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: arm/arm64: vgic-v2: Always resample level interrupts

When reading back from the list registers, we need to perform
two actions for level interrupts:
1) clear the soft-pending bit if the interrupt is not pending
anymore *in the list register*
2) resample the line level and propagate it to the pending state

But these two actions shouldn't be linked, and we should *always*
resample the line level, no matter what state is in the list
register. Otherwise, we may end-up injecting spurious interrupts
that have been already retired.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>

authored by

Marc Zyngier and committed by
Christoffer Dall
df7942d1 fa89c77e

+9 -5
+9 -5
virt/kvm/arm/vgic/vgic-v2.c
··· 112 112 } 113 113 } 114 114 115 - /* Clear soft pending state when level IRQs have been acked */ 116 - if (irq->config == VGIC_CONFIG_LEVEL && 117 - !(val & GICH_LR_PENDING_BIT)) { 118 - irq->soft_pending = false; 119 - irq->pending = irq->line_level; 115 + /* 116 + * Clear soft pending state when level irqs have been acked. 117 + * Always regenerate the pending state. 118 + */ 119 + if (irq->config == VGIC_CONFIG_LEVEL) { 120 + if (!(val & GICH_LR_PENDING_BIT)) 121 + irq->soft_pending = false; 122 + 123 + irq->pending = irq->line_level || irq->soft_pending; 120 124 } 121 125 122 126 spin_unlock(&irq->irq_lock);