Add arch_timer_edge_cases selftest to test various corner cases of the ARM timers such as: * timers above the max TVAL value * timers in the past * moving counters ahead and behind pending timers * reprogramming timers * timers fired multiple times * masking/unmasking using the timer control mask These are intentionally unusual scenarios to stress compliance with the arm architecture. v6: * Remove unused headers * Declare const variables as static * Clarify by using INT32_{MIN,MAX} * Remove silly enum magic value * Instead of commenting a function should be called with IRQs disabled, just disable them in function * Remove unnecessary loop in test_reprogram_timers() * Lift some invariant assignments out of loops * Add some comments around better explaining wm() (irq_wait_method) functions * Fix typos v5: https://lore.kernel.org/all/20240809183802.3572177-1-coltonlewis@xxxxxxxxxx/ v4: https://lore.kernel.org/kvmarm/20240307183907.1184775-1-coltonlewis@xxxxxxxxxx/ v3: https://lore.kernel.org/kvmarm/20231103192915.2209393-1-coltonlewis@xxxxxxxxxx/ v2: https://lore.kernel.org/kvmarm/20230928210201.1310536-1-coltonlewis@xxxxxxxxxx/ v1: https://lore.kernel.org/kvm/20230516213731.387132-1-coltonlewis@xxxxxxxxxx/ Colton Lewis (2): KVM: selftests: Ensure pending interrupts are handled in arch_timer test KVM: arm64: selftests: Add arch_timer_edge_cases selftest tools/testing/selftests/kvm/Makefile | 1 + .../kvm/aarch64/arch_timer_edge_cases.c | 1062 +++++++++++++++++ .../testing/selftests/kvm/aarch64/vgic_irq.c | 11 +- .../kvm/include/aarch64/arch_timer.h | 18 +- .../selftests/kvm/include/aarch64/processor.h | 3 + .../selftests/kvm/lib/aarch64/processor.c | 6 + 6 files changed, 1094 insertions(+), 7 deletions(-) create mode 100644 tools/testing/selftests/kvm/aarch64/arch_timer_edge_cases.c -- 2.46.0.295.g3b9ea8a38a-goog