KVM: arm64: selftests: Deal with spurious timer interrupts
authorMarc Zyngier <maz@kernel.org>
Thu, 30 Mar 2023 17:47:59 +0000 (18:47 +0100)
committerMarc Zyngier <maz@kernel.org>
Thu, 30 Mar 2023 18:01:10 +0000 (19:01 +0100)
commit056c15669a01677ba3e44456580bf4a351f71ff7
tree6f785a091d35b95bbf6e9944906348b0fa0545c6
parent0630fb8e0a4873e436f0c1c1b27fa60a37eb960c
KVM: arm64: selftests: Deal with spurious timer interrupts

Make sure the timer test can properly handle a spurious timer
interrupt, something that is far from being unlikely.

This involves checking for the GIC IAR return value (don't bother
handling the interrupt if it was spurious) as well as the timer
control register (don't do anything if the interrupt is masked
or the timer disabled). Take this opportunity to rewrite the
timer handler in a more readable way.

This solves a bunch of failures that creep up on systems that
are slow to retire the interrupt, something that the GIC architecture
makes no guarantee about.

Reviewed-by: Colton Lewis <coltonlewis@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20230330174800.2677007-20-maz@kernel.org
tools/testing/selftests/kvm/aarch64/arch_timer.c