Skip to content

Commit

Permalink
kvm: x86: Include multiple indices with CPUID leaf 0x8000001d
Browse files Browse the repository at this point in the history
Per the APM, "CPUID Fn8000_001D_E[D,C,B,A]X reports cache topology
information for the cache enumerated by the value passed to the
instruction in ECX, referred to as Cache n in the following
description. To gather information for all cache levels, software must
repeatedly execute CPUID with 8000_001Dh in EAX and ECX set to
increasing values beginning with 0 until a value of 00h is returned in
the field CacheType (EAX[4:0]) indicating no more cache descriptions
are available for this processor."

The termination condition is the same as leaf 4, so we can reuse that
code block for leaf 0x8000001d.

Fixes: 8765d75 ("KVM: X86: Extend CPUID range to include new leaf")
Cc: Brijesh Singh <[email protected]>
Cc: Borislav Petkov <[email protected]>
Signed-off-by: Jim Mattson <[email protected]>
Reviewed-by: Marc Orr <[email protected]>
Reviewed-by: Borislav Petkov <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
jsmattsonjr authored and bonzini committed May 24, 2019
1 parent 319f6f9 commit 32a243d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions arch/x86/kvm/cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,9 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
}
break;
}
/* function 4 has additional index. */
case 4: {
/* functions 4 and 0x8000001d have additional index. */
case 4:
case 0x8000001d: {
int i, cache_type;

entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
Expand Down Expand Up @@ -702,8 +703,6 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
break;
case 0x8000001a:
break;
case 0x8000001d:
break;
/*Add support for Centaur's CPUID instruction*/
case 0xC0000000:
/*Just support up to 0xC0000004 now*/
Expand Down

0 comments on commit 32a243d

Please sign in to comment.