mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-04 13:48:25 +00:00
kvm: x86: Fix a spurious -E2BIG in __do_cpuid_func
Don't return -E2BIG from __do_cpuid_func when processing function 0BH
or 1FH and the last interesting subleaf occupies the last allocated
entry in the result array.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Fixes: 831bf664e9
("KVM: Refactor and simplify kvm_dev_ioctl_get_supported_cpuid")
Signed-off-by: Jim Mattson <jmattson@google.com>
Reviewed-by: Peter Shier <pshier@google.com>
Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
a0f0037e90
commit
a1a640b8c0
1 changed files with 10 additions and 6 deletions
|
@ -618,16 +618,20 @@ static inline int __do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 function,
|
||||||
*/
|
*/
|
||||||
case 0x1f:
|
case 0x1f:
|
||||||
case 0xb: {
|
case 0xb: {
|
||||||
int i, level_type;
|
int i;
|
||||||
|
|
||||||
/* read more entries until level_type is zero */
|
/*
|
||||||
for (i = 1; ; ++i) {
|
* We filled in entry[0] for CPUID(EAX=<function>,
|
||||||
|
* ECX=00H) above. If its level type (ECX[15:8]) is
|
||||||
|
* zero, then the leaf is unimplemented, and we're
|
||||||
|
* done. Otherwise, continue to populate entries
|
||||||
|
* until the level type (ECX[15:8]) of the previously
|
||||||
|
* added entry is zero.
|
||||||
|
*/
|
||||||
|
for (i = 1; entry[i - 1].ecx & 0xff00; ++i) {
|
||||||
if (*nent >= maxnent)
|
if (*nent >= maxnent)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
level_type = entry[i - 1].ecx & 0xff00;
|
|
||||||
if (!level_type)
|
|
||||||
break;
|
|
||||||
do_host_cpuid(&entry[i], function, i);
|
do_host_cpuid(&entry[i], function, i);
|
||||||
++*nent;
|
++*nent;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue