aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/kvm/lib
diff options
context:
space:
mode:
authorGravatar Atish Patra <atishp@rivosinc.com> 2024-04-20 08:17:38 -0700
committerGravatar Anup Patel <anup@brainfault.org> 2024-04-26 13:14:10 +0530
commit13cb706e28d9d4d3259954eb08c57b990e4429ea (patch)
tree305c6abff236d36f96ba23586fc47d6958c99879 /tools/testing/selftests/kvm/lib
parentKVM: riscv: selftests: Add SBI PMU selftest (diff)
downloadlinux-13cb706e28d9d4d3259954eb08c57b990e4429ea.tar.gz
linux-13cb706e28d9d4d3259954eb08c57b990e4429ea.tar.bz2
linux-13cb706e28d9d4d3259954eb08c57b990e4429ea.zip
KVM: riscv: selftests: Add a test for PMU snapshot functionality
Verify PMU snapshot functionality by setting up the shared memory correctly and reading the counter values from the shared memory instead of the CSR. Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org> Signed-off-by: Atish Patra <atishp@rivosinc.com> Link: https://lore.kernel.org/r/20240420151741.962500-23-atishp@rivosinc.com Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'tools/testing/selftests/kvm/lib')
-rw-r--r--tools/testing/selftests/kvm/lib/riscv/processor.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/lib/riscv/processor.c b/tools/testing/selftests/kvm/lib/riscv/processor.c
index e8211f5d6863..ccb35573749c 100644
--- a/tools/testing/selftests/kvm/lib/riscv/processor.c
+++ b/tools/testing/selftests/kvm/lib/riscv/processor.c
@@ -502,3 +502,15 @@ bool guest_sbi_probe_extension(int extid, long *out_val)
return true;
}
+
+unsigned long get_host_sbi_spec_version(void)
+{
+ struct sbiret ret;
+
+ ret = sbi_ecall(SBI_EXT_BASE, SBI_EXT_BASE_GET_SPEC_VERSION, 0,
+ 0, 0, 0, 0, 0);
+
+ GUEST_ASSERT(!ret.error);
+
+ return ret.value;
+}