KVM: x86: Refactor CPUID 0x4 and 0x8000001d handling

Refactoring the sub-leaf handling for CPUID 0x4/0x8000001d to eliminate
a one-off variable and its associated brackets.

No functional change intended.

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>
This commit is contained in:
Sean Christopherson 2020-03-02 15:56:18 -08:00 committed by Paolo Bonzini
parent 74fa0bc7f0
commit c862903963

View File

@ -545,20 +545,16 @@ static inline int __do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 function,
break; break;
/* functions 4 and 0x8000001d have additional index. */ /* functions 4 and 0x8000001d have additional index. */
case 4: case 4:
case 0x8000001d: { case 0x8000001d:
int cache_type; /*
* Read entries until the cache type in the previous entry is
/* read more entries until cache_type is zero */ * zero, i.e. indicates an invalid entry.
for (i = 1; ; ++i) { */
cache_type = entry[i - 1].eax & 0x1f; for (i = 1; entry[i - 1].eax & 0x1f; ++i) {
if (!cache_type)
break;
if (!do_host_cpuid(&entry[i], nent, maxnent, function, i)) if (!do_host_cpuid(&entry[i], nent, maxnent, function, i))
goto out; goto out;
} }
break; break;
}
case 6: /* Thermal management */ case 6: /* Thermal management */
entry->eax = 0x4; /* allow ARAT */ entry->eax = 0x4; /* allow ARAT */
entry->ebx = 0; entry->ebx = 0;