WSL2-Linux-Kernel/arch/arm64/kvm/vgic
Marc Zyngier 8694330db9 KVM: arm64: vgic: Read HW interrupt pending state from the HW
[ Upstream commit 5bfa685e62 ]

It appears that a read access to GIC[DR]_I[CS]PENDRn doesn't always
result in the pending interrupts being accurately reported if they are
mapped to a HW interrupt. This is particularily visible when acking
the timer interrupt and reading the GICR_ISPENDR1 register immediately
after, for example (the interrupt appears as not-pending while it really
is...).

This is because a HW interrupt has its 'active and pending state' kept
in the *physical* distributor, and not in the virtual one, as mandated
by the spec (this is what allows the direct deactivation). The virtual
distributor only caries the pending and active *states* (note the
plural, as these are two independent and non-overlapping states).

Fix it by reading the HW state back, either from the timer itself or
from the distributor if necessary.

Reported-by: Ricardo Koller <ricarkol@google.com>
Tested-by: Ricardo Koller <ricarkol@google.com>
Reviewed-by: Ricardo Koller <ricarkol@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220208123726.3604198-1-maz@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-03-08 19:12:30 +01:00
..
trace.h KVM: arm64: Move virt/kvm/arm to arch/arm64 2020-05-16 15:03:59 +01:00
vgic-debug.c KVM: arm64: vgic-debug: Convert to use DEFINE_SEQ_ATTRIBUTE macro 2020-09-18 16:17:27 +01:00
vgic-init.c KVM: arm64: vgic: Let an interrupt controller advertise lack of HW deactivation 2021-06-01 10:45:59 +01:00
vgic-irqfd.c KVM: arm64: Allow in-atomic injection of SPIs 2020-07-05 17:26:15 +01:00
vgic-its.c ARM: 2021-05-01 10:14:08 -07:00
vgic-kvm-device.c KVM: arm/arm64: Fix KVM_VGIC_V3_ADDR_TYPE_REDIST read 2021-04-13 15:04:50 +01:00
vgic-mmio-v2.c KVM: arm64: Fix comments related to GICv2 PMR reporting 2021-08-02 14:49:39 +01:00
vgic-mmio-v3.c ARM: 2021-05-01 10:14:08 -07:00
vgic-mmio.c KVM: arm64: vgic: Read HW interrupt pending state from the HW 2022-03-08 19:12:30 +01:00
vgic-mmio.h KVM: arm64: Move virt/kvm/arm to arch/arm64 2020-05-16 15:03:59 +01:00
vgic-v2.c KVM: arm64: vgic: Resample HW pending state on deactivation 2021-08-20 08:53:22 +01:00
vgic-v3.c KVM: arm64: vgic: Resample HW pending state on deactivation 2021-08-20 08:53:22 +01:00
vgic-v4.c KVM: arm64: GICv4.1: Restore VLPI pending state to physical side 2021-03-24 18:12:21 +00:00
vgic.c KVM: arm64: vgic: Resample HW pending state on deactivation 2021-08-20 08:53:22 +01:00
vgic.h KVM: arm64: vgic: Resample HW pending state on deactivation 2021-08-20 08:53:22 +01:00