OrangePi_CM5/arch/arm64/kvm/vgic
Marc Zyngier 6d4985b8a0 KVM: arm64: vgic: Read HW interrupt pending state from the HW
[ Upstream commit 5bfa685e62e9ba93c303a9a8db646c7228b9b570 ]

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:09:29 +01:00
..
trace.h
…
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
…
vgic-irqfd.c KVM: arm64: Allow in-atomic injection of SPIs 2020-07-05 17:26:15 +01:00
vgic-its.c treewide: Change list_sort to use const pointers 2021-09-30 10:11:04 +02:00
vgic-kvm-device.c KVM: arm64: Fix KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION read 2021-05-14 09:50:05 +02:00
vgic-mmio-v2.c
…
vgic-mmio-v3.c KVM: arm64: vgic-v3: Drop the reporting of GICR_TYPER.Last for userspace 2020-11-17 18:51:09 +00:00
vgic-mmio.c KVM: arm64: vgic: Read HW interrupt pending state from the HW 2022-03-08 19:09:29 +01:00
vgic-mmio.h
…
vgic-v2.c
…
vgic-v3.c KVM: arm64: nVHE: Fix pointers during SMCCC convertion 2020-09-15 18:39:04 +01:00
vgic-v4.c
…
vgic.c treewide: Change list_sort to use const pointers 2021-09-30 10:11:04 +02:00
vgic.h
…