linux/arch/arm64/kvm
Marc Zyngier 5bfa685e62 KVM: arm64: vgic: Read HW interrupt pending state from the HW
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
2022-02-11 11:01:12 +00:00
..
hyp KVM: arm64: Workaround Cortex-A510's single-step and PAC trap errata 2022-02-03 09:22:30 +00:00
vgic KVM: arm64: vgic: Read HW interrupt pending state from the HW 2022-02-11 11:01:12 +00:00
.gitignore KVM: arm64: Generate hyp_constants.h for the host 2021-12-06 08:37:03 +00:00
arch_timer.c KVM: Add helpers to wake/query blocking vCPU 2021-12-08 04:24:54 -05:00
arm.c RISCV: 2022-01-16 16:15:14 +02:00
debug.c KVM: arm64: MDCR_EL2 is a 64-bit register 2021-08-20 11:12:17 +01:00
fpsimd.c KVM: arm64: pkvm: Unshare guest structs during teardown 2021-12-16 12:58:57 +00:00
guest.c KVM: arm64: Change the return type of kvm_vcpu_preferred_target() 2021-11-08 10:48:47 +00:00
handle_exit.c KVM: arm64: Stop handle_exit() from handling HVC twice when an SError occurs 2022-02-03 09:20:05 +00:00
hypercalls.c KVM: arm64: Add support for the KVM PTP service 2021-04-07 16:33:20 +01:00
inject_fault.c KVM: arm64: Move AArch32 exceptions over to AArch64 sysregs 2020-11-10 11:22:51 +00:00
irq.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 422 2019-06-05 17:37:15 +02:00
Kconfig RISCV: 2022-01-16 16:15:14 +02:00
Makefile RISCV: 2022-01-16 16:15:14 +02:00
mmio.c KVM: arm64: Make kvm_skip_instr() and co private to HYP 2020-11-10 08:34:24 +00:00
mmu.c KVM/arm64 updates for Linux 5.16 2022-01-07 10:42:19 -05:00
pkvm.c KVM: arm64: Move host EL1 code out of hyp/ directory 2021-12-06 08:37:03 +00:00
pmu-emul.c RISCV: 2022-01-16 16:15:14 +02:00
pmu.c KVM: arm64: Disable PMU support in protected mode 2021-03-19 12:02:19 +00:00
psci.c KVM/arm64 updates for Linux 5.16 2022-01-07 10:42:19 -05:00
pvtime.c KVM: arm64: Use kvm_write_guest_lock when init stolen time 2020-12-03 19:02:18 +00:00
reset.c RISCV: 2022-01-16 16:15:14 +02:00
sys_regs.c arm64: add ID_AA64ISAR2_EL1 sys register 2021-12-13 18:53:00 +00:00
sys_regs.h KVM: arm64: Refactor sys_regs.h,c for nVHE reuse 2021-08-20 11:12:17 +01:00
trace_arm.h KVM: Move arm64's MMU notifier trace events to generic code 2021-04-17 08:30:56 -04:00
trace_handle_exit.h KVM: arm64: Upgrade trace_kvm_arm_set_dreg32() to 64bit 2021-08-20 11:12:18 +01:00
trace.h KVM: arm64: Move virt/kvm/arm to arch/arm64 2020-05-16 15:03:59 +01:00
trng.c KVM: arm64: Implement the TRNG hypervisor call 2021-01-25 22:19:31 +00:00
va_layout.c KVM: arm64: Generate final CTR_EL0 value when running in Protected mode 2021-03-25 11:00:33 +00:00
vgic-sys-reg-v3.c KVM: arm64: Drop is_aarch32 trap attribute 2020-11-10 11:22:52 +00:00