]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
KVM: arm64: vgic: Read HW interrupt pending state from the HW
authorMarc Zyngier <maz@kernel.org>
Thu, 3 Feb 2022 09:24:45 +0000 (09:24 +0000)
committerPaolo Pisati <paolo.pisati@canonical.com>
Wed, 9 Mar 2022 14:16:01 +0000 (15:16 +0100)
commit63f6a78b5b1db245e76d15ab46bc48b048c58fcb
tree8afb59a8dbd101ca8ac68019e9ca24ac624772ea
parent3f546721430cfa2bad5f86dc7f1aad1372080229
KVM: arm64: vgic: Read HW interrupt pending state from the HW

BugLink: https://bugs.launchpad.net/bugs/1964361
[ 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>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
arch/arm64/kvm/vgic/vgic-mmio.c