]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: LoongArch: selftests: Add basic PMU event counting test
authorSong Gao <gaosong@loongson.cn>
Thu, 9 Apr 2026 10:56:37 +0000 (18:56 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Thu, 9 Apr 2026 10:56:37 +0000 (18:56 +0800)
commit11c840192768a5a63b6aed75273c5e8e416230ee
treec2ab9832598c32a6bccfcfe2da38deaa693374a5
parentfa19ea9a7bdb97575e05d72305a4c40a3a631357
KVM: LoongArch: selftests: Add basic PMU event counting test

Introduce a basic PMU test that verifies hardware event counting for
four performance counters. The test enables the events for CPU cycles,
instructions retired, branch instructions, and branch misses, runs a
fixed number of loops, and checks that the counter values fall within
expected ranges. It also validates that the host supports PMU and that
the VM feature is enabled.

Signed-off-by: Song Gao <gaosong@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
tools/testing/selftests/kvm/Makefile.kvm
tools/testing/selftests/kvm/include/loongarch/pmu.h [new file with mode: 0644]
tools/testing/selftests/kvm/include/loongarch/processor.h
tools/testing/selftests/kvm/lib/loongarch/processor.c
tools/testing/selftests/kvm/loongarch/pmu_test.c [new file with mode: 0644]