i386/cpu: Reorder CPUID leaves in cpu_x86_cpuid()
Sort the CPUID leaves strictly by index to facilitate checking and changing. Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Reviewed-by: Tao Su <tao1.su@linux.intel.com> Link: https://lore.kernel.org/r/20250627035129.2755537-5-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
c8958b7eb4
commit
075e91a4a4
1 changed files with 30 additions and 30 deletions
|
|
@ -8052,21 +8052,6 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
|
|||
assert(!(*eax & ~0x1f));
|
||||
*ebx &= 0xffff; /* The count doesn't need to be reliable. */
|
||||
break;
|
||||
case 0x1C:
|
||||
if (cpu->enable_pmu && (env->features[FEAT_7_0_EDX] & CPUID_7_0_EDX_ARCH_LBR)) {
|
||||
x86_cpu_get_supported_cpuid(0x1C, 0, eax, ebx, ecx, edx);
|
||||
*edx = 0;
|
||||
}
|
||||
break;
|
||||
case 0x1F:
|
||||
/* V2 Extended Topology Enumeration Leaf */
|
||||
if (!x86_has_cpuid_0x1f(cpu)) {
|
||||
*eax = *ebx = *ecx = *edx = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
encode_topo_cpuid1f(env, count, topo_info, eax, ebx, ecx, edx);
|
||||
break;
|
||||
case 0xD: {
|
||||
/* Processor Extended State */
|
||||
*eax = 0;
|
||||
|
|
@ -8207,6 +8192,12 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 0x1C:
|
||||
if (cpu->enable_pmu && (env->features[FEAT_7_0_EDX] & CPUID_7_0_EDX_ARCH_LBR)) {
|
||||
x86_cpu_get_supported_cpuid(0x1C, 0, eax, ebx, ecx, edx);
|
||||
*edx = 0;
|
||||
}
|
||||
break;
|
||||
case 0x1D: {
|
||||
/* AMX TILE, for now hardcoded for Sapphire Rapids*/
|
||||
*eax = 0;
|
||||
|
|
@ -8244,6 +8235,15 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 0x1F:
|
||||
/* V2 Extended Topology Enumeration Leaf */
|
||||
if (!x86_has_cpuid_0x1f(cpu)) {
|
||||
*eax = *ebx = *ecx = *edx = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
encode_topo_cpuid1f(env, count, topo_info, eax, ebx, ecx, edx);
|
||||
break;
|
||||
case 0x24: {
|
||||
*eax = 0;
|
||||
*ebx = 0;
|
||||
|
|
@ -8472,6 +8472,21 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
|
|||
*edx = 0;
|
||||
}
|
||||
break;
|
||||
case 0x8000001F:
|
||||
*eax = *ebx = *ecx = *edx = 0;
|
||||
if (sev_enabled()) {
|
||||
*eax = 0x2;
|
||||
*eax |= sev_es_enabled() ? 0x8 : 0;
|
||||
*eax |= sev_snp_enabled() ? 0x10 : 0;
|
||||
*ebx = sev_get_cbit_position() & 0x3f; /* EBX[5:0] */
|
||||
*ebx |= (sev_get_reduced_phys_bits() & 0x3f) << 6; /* EBX[11:6] */
|
||||
}
|
||||
break;
|
||||
case 0x80000021:
|
||||
*eax = *ebx = *ecx = *edx = 0;
|
||||
*eax = env->features[FEAT_8000_0021_EAX];
|
||||
*ebx = env->features[FEAT_8000_0021_EBX];
|
||||
break;
|
||||
case 0x80000022:
|
||||
*eax = *ebx = *ecx = *edx = 0;
|
||||
/* AMD Extended Performance Monitoring and Debug */
|
||||
|
|
@ -8504,21 +8519,6 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
|
|||
*ecx = 0;
|
||||
*edx = 0;
|
||||
break;
|
||||
case 0x8000001F:
|
||||
*eax = *ebx = *ecx = *edx = 0;
|
||||
if (sev_enabled()) {
|
||||
*eax = 0x2;
|
||||
*eax |= sev_es_enabled() ? 0x8 : 0;
|
||||
*eax |= sev_snp_enabled() ? 0x10 : 0;
|
||||
*ebx = sev_get_cbit_position() & 0x3f; /* EBX[5:0] */
|
||||
*ebx |= (sev_get_reduced_phys_bits() & 0x3f) << 6; /* EBX[11:6] */
|
||||
}
|
||||
break;
|
||||
case 0x80000021:
|
||||
*eax = *ebx = *ecx = *edx = 0;
|
||||
*eax = env->features[FEAT_8000_0021_EAX];
|
||||
*ebx = env->features[FEAT_8000_0021_EBX];
|
||||
break;
|
||||
default:
|
||||
/* reserved values: zero */
|
||||
*eax = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue