Add a new selftests that validates some edge cases related to the virtual arch-timer, for example: - timers above the max TVAL value. - timers across counter roll-overs. - moving counters ahead and behind pending timers. - having the same timer condition firing multiple times. The tests run while checking the state of the IRQs (e.g., pending when they are supposed to be) and stressing things a bit by waiting for interrupts while: re-scheduling the vcpu (with sched_yield()), by migrating the vcpu between cores, or by sleeping in userspace (with usleep()). The first commit adds a timer utility function. The second commit adds some sanity checks and basic tests for the timer. The third commit adds the actual edge case tests (like forcing rollovers). Ricardo Koller (3): KVM: arm64: selftests: add timer_get_tval() lib function KVM: arm64: selftests: add arch_timer_edge_cases KVM: arm64: selftests: add edge cases tests into arch_timer_edge_cases tools/testing/selftests/kvm/.gitignore | 1 + tools/testing/selftests/kvm/Makefile | 1 + .../kvm/aarch64/arch_timer_edge_cases.c | 1179 +++++++++++++++++ .../kvm/include/aarch64/arch_timer.h | 18 +- 4 files changed, 1198 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/kvm/aarch64/arch_timer_edge_cases.c -- 2.35.1.574.g5d30c73bfb-goog