KVM: selftests: aarch64: Introduce vpmu_counter_access test
authorReiji Watanabe <reijiw@google.com>
Fri, 20 Oct 2023 21:40:49 +0000 (21:40 +0000)
committerOliver Upton <oliver.upton@linux.dev>
Tue, 24 Oct 2023 22:59:31 +0000 (22:59 +0000)
commit8d0aebe1ca2bd6f86ee2b4de30c8a4aafcf2908b
treef3be041d1fa6a367b5d1141841227e41fcabb270
parent9f4b3273dfbe0ecb628b65fe9a80aae17caba20f
KVM: selftests: aarch64: Introduce vpmu_counter_access test

Introduce vpmu_counter_access test for arm64 platforms.
The test configures PMUv3 for a vCPU, sets PMCR_EL0.N for the vCPU,
and check if the guest can consistently see the same number of the
PMU event counters (PMCR_EL0.N) that userspace sets.
This test case is done with each of the PMCR_EL0.N values from
0 to 31 (With the PMCR_EL0.N values greater than the host value,
the test expects KVM_SET_ONE_REG for the PMCR_EL0 to fail).

Signed-off-by: Reiji Watanabe <reijiw@google.com>
Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20231020214053.2144305-10-rananta@google.com
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
tools/testing/selftests/kvm/Makefile
tools/testing/selftests/kvm/aarch64/vpmu_counter_access.c [new file with mode: 0644]