]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
KVM: x86/pmu: Ignore pmu->global_ctrl check if vPMU doesn't support global_ctrl
authorLike Xu <likexu@tencent.com>
Mon, 9 May 2022 10:22:02 +0000 (18:22 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Aug 2022 13:16:22 +0000 (15:16 +0200)
[ 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>
arch/x86/kvm/vmx/pmu_intel.c

index e73378b6f10c1d31929afebc0015ef63778ccb59..f938fc997766c110b42bde95edeae5d59d2aa614 100644 (file)
@@ -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);
 }