Commit a87f2d3a authored by Like Xu's avatar Like Xu Committed by Paolo Bonzini

KVM: x86: Add Intel CPUID.1F cpuid emulation support

Add support to expose Intel V2 Extended Topology Enumeration Leaf for
some new systems with multiple software-visible die within each package.

Because unimplemented and unexposed leaves should be explicitly reported
as zero, there is no need to limit cpuid.0.eax to the maximum value of
feature configuration but limit it to the highest leaf implemented in
the current code. A single clamping seems sufficient and cheaper.
Co-developed-by: default avatarXiaoyao Li <xiaoyao.li@linux.intel.com>
Signed-off-by: default avatarXiaoyao Li <xiaoyao.li@linux.intel.com>
Signed-off-by: default avatarLike Xu <like.xu@linux.intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 1fc5d194
...@@ -436,7 +436,8 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, ...@@ -436,7 +436,8 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
switch (function) { switch (function) {
case 0: case 0:
entry->eax = min(entry->eax, (u32)(f_intel_pt ? 0x14 : 0xd)); /* Limited to the highest leaf implemented in KVM. */
entry->eax = min(entry->eax, 0x1fU);
break; break;
case 1: case 1:
entry->edx &= kvm_cpuid_1_edx_x86_features; entry->edx &= kvm_cpuid_1_edx_x86_features;
...@@ -556,7 +557,11 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, ...@@ -556,7 +557,11 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
entry->edx = edx.full; entry->edx = edx.full;
break; break;
} }
/* function 0xb has additional index. */ /*
* Per Intel's SDM, the 0x1f is a superset of 0xb,
* thus they can be handled by common code.
*/
case 0x1f:
case 0xb: { case 0xb: {
int i, level_type; int i, level_type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment