mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
KVM: arm64: Check ID_AA64DFR0_EL1.PMUVer in pmu_visibility()
pmu_visibility() currently checks kvm_vcpu_has_pmu(), which only tests whether the vCPU was initialized with KVM_ARM_VCPU_PMU_V3. If userspace initializes a vCPU with KVM_ARM_VCPU_PMU_V3 and subsequently hides FEAT_PMUv3 via ID_AA64DFR0_EL1.PMUVer, KVM continues to expose the PMU system registers instead of emulating guest accesses as UNDEF. Check ID_AA64DFR0_EL1.PMUVer directly via kvm_has_feat() in pmu_visibility() so that PMU system registers are marked REG_HIDDEN whenever FEAT_PMUv3 is not advertised in the ID registers. Suggested-by: Oliver Upton <oupton@kernel.org> Assisted-by: LLM Signed-off-by: Colton Lewis <coltonlewis@google.com> Link: https://patch.msgid.link/20260930211834.2773546-3-coltonlewis@google.com Signed-off-by: Marc Zyngier <maz@kernel.org>
This commit is contained in:
parent
aa41a7c3be
commit
517cdec3d4
|
|
@ -1028,7 +1028,7 @@ static unsigned int hidden_visibility(const struct kvm_vcpu *vcpu,
|
|||
static unsigned int pmu_visibility(const struct kvm_vcpu *vcpu,
|
||||
const struct sys_reg_desc *r)
|
||||
{
|
||||
if (kvm_vcpu_has_pmu(vcpu))
|
||||
if (kvm_has_feat(vcpu->kvm, ID_AA64DFR0_EL1, PMUVer, IMP))
|
||||
return 0;
|
||||
|
||||
return REG_HIDDEN;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user