]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: x86: Mask off reserved bits in CPUID.80000006H
authorJim Mattson <jmattson@google.com>
Thu, 29 Sep 2022 22:51:59 +0000 (15:51 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 22 Oct 2022 11:54:35 +0000 (07:54 -0400)
KVM_GET_SUPPORTED_CPUID should only enumerate features that KVM
actually supports. CPUID.80000006H:EDX[17:16] are reserved bits and
should be masked off.

Fixes: e6c808719ec8 ("KVM: pass through CPUID(0x80000006)")
Signed-off-by: Jim Mattson <jmattson@google.com>
Message-Id: <20220929225203.2234702-2-jmattson@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/cpuid.c

index 834feeb0a828dda1c4d5ac87698f51eb3b79778f..8325a01cb1f17fa09624c68025c8ff5522062aba 100644 (file)
@@ -1138,7 +1138,8 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
                cpuid_entry_override(entry, CPUID_8000_0001_ECX);
                break;
        case 0x80000006:
-               /* L2 cache and TLB: pass through host info. */
+               /* Drop reserved bits, pass host L2 cache and TLB info. */
+               entry->edx &= ~GENMASK(17, 16);
                break;
        case 0x80000007: /* Advanced power management */
                /* invariant TSC is CPUID.80000007H:EDX[8] */