Commit 3c39f253 authored by Atish Patra's avatar Atish Patra Committed by Greg Kroah-Hartman
Browse files

RISC-V: KVM: Allow legacy PMU access from guest



[ Upstream commit 7d1ffc8b ]

Currently, KVM traps & emulates PMU counter access only if SBI PMU
is available as the guest can only configure/read PMU counters via
SBI only. However, if SBI PMU is not enabled in the host, the
guest will fallback to the legacy PMU which will try to access
cycle/instret and result in an illegal instruction trap which
is not desired.

KVM can allow dummy emulation of cycle/instret only for the guest
if SBI PMU is not enabled in the host. The dummy emulation will
still return zero as we don't to expose the host counter values
from a guest using legacy PMU.

Fixes: a9ac6c37 ("RISC-V: KVM: Implement trap & emulate for hpmcounters")
Signed-off-by: default avatarAtish Patra <atishp@rivosinc.com>
Link: https://lore.kernel.org/r/20240816-kvm_pmu_fixes-v1-1-cdfce386dd93@rivosinc.com


Signed-off-by: default avatarAnup Patel <anup@brainfault.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent a72a99da
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment