diff options
author | Like Xu <likexu@tencent.com> | 2023-06-03 03:10:52 +0200 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2023-06-07 02:31:44 +0200 |
commit | 6593039d33c119968b9e2d85eaca853b391e8a55 (patch) | |
tree | 13515aefc36c0d0fbadf97784055f96b1b1783c9 /arch/x86/kvm/cpuid.c | |
parent | KVM: x86/pmu: Provide Intel PMU's pmc_is_enabled() as generic x86 code (diff) | |
download | linux-6593039d33c119968b9e2d85eaca853b391e8a55.tar.xz linux-6593039d33c119968b9e2d85eaca853b391e8a55.zip |
KVM: x86: Explicitly zero cpuid "0xa" leaf when PMU is disabled
Add an explicit !enable_pmu check as relying on kvm_pmu_cap to be
zeroed isn't obvious. Although when !enable_pmu, KVM will have
zero-padded kvm_pmu_cap to do subsequent CPUID leaf assignments.
Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Like Xu <likexu@tencent.com>
Link: https://lore.kernel.org/r/20230603011058.1038821-7-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'arch/x86/kvm/cpuid.c')
-rw-r--r-- | arch/x86/kvm/cpuid.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 0c9660a07b23..61bc71882f07 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -948,7 +948,7 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function) union cpuid10_eax eax; union cpuid10_edx edx; - if (!static_cpu_has(X86_FEATURE_ARCH_PERFMON)) { + if (!enable_pmu || !static_cpu_has(X86_FEATURE_ARCH_PERFMON)) { entry->eax = entry->ebx = entry->ecx = entry->edx = 0; break; } |