]> git.baikalelectronics.ru Git - kernel.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)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Jun 2022 08:48:35 +0000 (04:48 -0400)
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>
arch/x86/kvm/vmx/pmu_intel.c

index 1c6f2ca2beac5a48d384f2c1f8be2b950ceaabac..2fc90080dcce0d706b2b6b610252a3591b6dc931 100644 (file)
@@ -98,6 +98,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);
 }