summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLike Xu <likexu@tencent.com>2022-05-09 18:22:02 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-08-17 14:24:25 +0200
commit1eedac05b2f379b7e7b4c04f4e7042d7d5fb543a (patch)
treeabc41145516c1fd9821b66ba13fbec349a9a3d82
parent9f1a17222a8ba0352e9b67c6a521cad73ca3b777 (diff)
downloadlinux-1eedac05b2f379b7e7b4c04f4e7042d7d5fb543a.tar.gz
linux-1eedac05b2f379b7e7b4c04f4e7042d7d5fb543a.tar.bz2
linux-1eedac05b2f379b7e7b4c04f4e7042d7d5fb543a.zip
KVM: x86/pmu: Ignore pmu->global_ctrl check if vPMU doesn't support global_ctrl
[ Upstream commit 98defd2e17803263f49548fea930cfc974d505aa ] MSR_CORE_PERF_GLOBAL_CTRL is introduced as part of Architecture PMU V2, as indicated by Intel SDM 19.2.2 and the intel_is_valid_msr() function. So in the absence of global_ctrl support, all PMCs are enabled as AMD does. Signed-off-by: Like Xu <likexu@tencent.com> Message-Id: <20220509102204.62389-1-likexu@tencent.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--arch/x86/kvm/vmx/pmu_intel.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c
index c66edf93e4a8..f9054e7ec89e 100644
--- a/arch/x86/kvm/vmx/pmu_intel.c
+++ b/arch/x86/kvm/vmx/pmu_intel.c
@@ -104,6 +104,9 @@ static bool intel_pmc_is_enabled(struct kvm_pmc *pmc)
{
struct kvm_pmu *pmu = pmc_to_pmu(pmc);
+ if (pmu->version < 2)
+ return true;
+
return test_bit(pmc->idx, (unsigned long *)&pmu->global_ctrl);
}