RISC-V: KVM: Implement SBI PMU Snapshot feature
authorAtish Patra <atishp@rivosinc.com>
Sat, 20 Apr 2024 15:17:29 +0000 (08:17 -0700)
committerAnup Patel <anup@brainfault.org>
Fri, 26 Apr 2024 07:43:48 +0000 (13:13 +0530)
commitc2f41ddbcdd75689d9f512638a40263e3127be93
treede23f598da3845b185cfefaac05fb2dd5b59ad32
parent2196c066f13861919a83b3b3ffda08a79cf87bdd
RISC-V: KVM: Implement SBI PMU Snapshot feature

PMU Snapshot function allows to minimize the number of traps when the
guest access configures/access the hpmcounters. If the snapshot feature
is enabled, the hypervisor updates the shared memory with counter
data and state of overflown counters. The guest can just read the
shared memory instead of trap & emulate done by the hypervisor.

This patch doesn't implement the counter overflow yet.

Reviewed-by: Anup Patel <anup@brainfault.org>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Atish Patra <atishp@rivosinc.com>
Link: https://lore.kernel.org/r/20240420151741.962500-14-atishp@rivosinc.com
Signed-off-by: Anup Patel <anup@brainfault.org>
arch/riscv/include/asm/kvm_vcpu_pmu.h
arch/riscv/kvm/vcpu_pmu.c
arch/riscv/kvm/vcpu_sbi_pmu.c