[PATCH v3 0/6] KVM: LoongArch: selftests: Add timer test case
From: Bibo Mao
Date: Thu Nov 20 2025 - 01:58:06 EST
This patchset adds timer test case for LoongArch system, it is based
on common arch_timer test case. And it includes one-shot and period mode
timer interrupt test, software emulated timer function and time counter
test.
---
v2 ... v3:
1. Adjust order about patch 2 and patch 3
2. Add test case with alphabetical order
3. Merge one-shot and period timer interrupt test case into one
4. Only add LoongArch specific modification with common file
Makefile.kvm
v1 ... v2:
1. Restore PC and PRMD after exception handler
2. Split patch 4 into two small patches with period timer test and
time counter test
3. With time counter test, set time count with 0 when create VM. And
verify time count starts from 0 in guest code
---
Bibo Mao (6):
KVM: LoongArch: selftests: Add system registers save and restore on
exception
KVM: LoongArch: selftests: Add basic interfaces
KVM: LoongArch: selftests: Add exception handler register interface
KVM: LoongArch: selftests: Add timer interrupt test case
KVM: LoongArch: selftests: Add SW emulated timer test
KVM: LoongArch: selftests: Add time counter test
tools/testing/selftests/kvm/Makefile.kvm | 1 +
.../kvm/include/loongarch/arch_timer.h | 84 ++++++++
.../kvm/include/loongarch/processor.h | 81 +++++++-
.../selftests/kvm/lib/loongarch/exception.S | 6 +
.../selftests/kvm/lib/loongarch/processor.c | 47 ++++-
.../selftests/kvm/loongarch/arch_timer.c | 194 ++++++++++++++++++
6 files changed, 410 insertions(+), 3 deletions(-)
create mode 100644 tools/testing/selftests/kvm/include/loongarch/arch_timer.h
create mode 100644 tools/testing/selftests/kvm/loongarch/arch_timer.c
base-commit: 23cb64fb76257309e396ea4cec8396d4a1dbae68
--
2.39.3