diff options
author | Marc Zyngier <maz@kernel.org> | 2020-12-31 11:18:03 +0000 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2021-02-03 10:59:16 +0000 |
commit | cb95914685ca6514da9a1592b19255fe679557eb (patch) | |
tree | 53bca320de3e0003d64f01ca1e06968235c337bd /arch/arm64/kvm | |
parent | bea7e97fef888421ecc21d03c6e4f9ae1451a78d (diff) | |
download | linux-stable-cb95914685ca6514da9a1592b19255fe679557eb.tar.gz linux-stable-cb95914685ca6514da9a1592b19255fe679557eb.tar.bz2 linux-stable-cb95914685ca6514da9a1592b19255fe679557eb.zip |
KVM: arm64: Fix AArch32 PMUv3 capping
We shouldn't expose *any* PMU capability when no PMU has been
configured for this VM.
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'arch/arm64/kvm')
-rw-r--r-- | arch/arm64/kvm/sys_regs.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 0c0832472c4a..ce08d28ab15c 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -1048,8 +1048,8 @@ static u64 read_id_reg(const struct kvm_vcpu *vcpu, } else if (id == SYS_ID_DFR0_EL1) { /* Limit guests to PMUv3 for ARMv8.1 */ val = cpuid_feature_cap_perfmon_field(val, - ID_DFR0_PERFMON_SHIFT, - ID_DFR0_PERFMON_8_1); + ID_DFR0_PERFMON_SHIFT, + kvm_vcpu_has_pmu(vcpu) ? ID_DFR0_PERFMON_8_1 : 0); } return val; |