RISC-V: KVM: Support firmware events
authorAtish Patra <atishp@rivosinc.com>
Tue, 7 Feb 2023 09:55:28 +0000 (01:55 -0800)
committerAnup Patel <anup@brainfault.org>
Tue, 7 Feb 2023 15:06:06 +0000 (20:36 +0530)
commitbadc386869e2cb255df6183ec05488a05bd07658
treeac95011d119948d95eb9483015050766fa2fab3a
parent0cb74b65d2e5e6ec3ed60c8890014b1bcd0c81c9
RISC-V: KVM: Support firmware events

SBI PMU extension defines a set of firmware events which can provide
useful information to guests about the number of SBI calls. As
hypervisor implements the SBI PMU extension, these firmware events
correspond to ecall invocations between VS->HS mode. All other firmware
events will always report zero if monitored as KVM doesn't implement them.

This patch adds all the infrastructure required to support firmware
events.

Reviewed-by: Anup Patel <anup@brainfault.org>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Atish Patra <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