]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: x86: Mask off reserved bits in CPUID.8000001FH
authorJim Mattson <jmattson@google.com>
Thu, 29 Sep 2022 22:52:03 +0000 (15:52 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 27 Oct 2022 08:41:54 +0000 (04:41 -0400)
KVM_GET_SUPPORTED_CPUID should only enumerate features that KVM
actually supports. CPUID.8000001FH:EBX[31:16] are reserved bits and
should be masked off.

Fixes: 27bf221fac08 ("KVM: X86: Extend CPUID range to include new leaf")
Signed-off-by: Jim Mattson <jmattson@google.com>
Message-Id: <20220929225203.2234702-6-jmattson@google.com>
Cc: stable@vger.kernel.org
[Clear NumVMPL too. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/cpuid.c

index a0292ba650df3c0bd4b0a961ff14a5d197ec6fdd..0810e93cbedc0e9cbe5c032d9b2f0f39b0bb3d63 100644 (file)
@@ -1199,7 +1199,8 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
                        entry->eax = entry->ebx = entry->ecx = entry->edx = 0;
                } else {
                        cpuid_entry_override(entry, CPUID_8000_001F_EAX);
-
+                       /* Clear NumVMPL since KVM does not support VMPL.  */
+                       entry->ebx &= ~GENMASK(31, 12);
                        /*
                         * Enumerate '0' for "PA bits reduction", the adjusted
                         * MAXPHYADDR is enumerated directly (see 0x80000008).