diff options
author | Sean Christopherson <sean.j.christopherson@intel.com> | 2020-03-02 15:56:49 -0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-03-16 17:58:29 +0100 |
commit | bcf600ca8d21e49af21fec5d2cf3927d6f62d048 (patch) | |
tree | fd01db91191ac84341386e23ca05076245466446 /arch/x86/kvm/cpuid.c | |
parent | 09f628a0b49cf489faada00254569813a2143894 (diff) | |
download | linux-bcf600ca8d21e49af21fec5d2cf3927d6f62d048.tar.gz linux-bcf600ca8d21e49af21fec5d2cf3927d6f62d048.tar.bz2 linux-bcf600ca8d21e49af21fec5d2cf3927d6f62d048.zip |
KVM: x86: Remove the unnecessary loop on CPUID 0x7 sub-leafs
Explicitly handle CPUID 0x7 sub-leaf 1. The kernel is currently aware
of exactly one feature in CPUID 0x7.1, which means there is room for
another 127 features before CPUID 0x7.2 will see the light of day, i.e.
the looping is likely to be dead code for years to come.
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/cpuid.c')
-rw-r--r-- | arch/x86/kvm/cpuid.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index f6d3121656cc..cce78723376c 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -536,11 +536,9 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function) if (boot_cpu_has(X86_FEATURE_AMD_SSBD)) cpuid_entry_set(entry, X86_FEATURE_SPEC_CTRL_SSBD); - for (i = 1, max_idx = entry->eax; i <= max_idx; i++) { - if (WARN_ON_ONCE(i > 1)) - break; - - entry = do_host_cpuid(array, function, i); + /* KVM only supports 0x7.0 and 0x7.1, capped above via min(). */ + if (entry->eax == 1) { + entry = do_host_cpuid(array, function, 1); if (!entry) goto out; |