[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 35/38] i386/cpu: Hoist check of CPUID_EXT3_TOPOEXT against threads
From: |
Paolo Bonzini |
Subject: |
[PULL 35/38] i386/cpu: Hoist check of CPUID_EXT3_TOPOEXT against threads_per_core |
Date: |
Fri, 10 Jan 2025 19:46:16 +0100 |
From: Xiaoyao Li <xiaoyao.li@intel.com>
Now it changes to use env->topo_info.threads_per_core and doesn't depend
on qemu_init_vcpu() anymore. Put it together with other feature checks
before qemu_init_vcpu()
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://lore.kernel.org/r/20241219110125.1266461-8-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/cpu.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 1797bd8c071..3f9475b4856 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -7883,6 +7883,21 @@ static void x86_cpu_realizefn(DeviceState *dev, Error
**errp)
*/
cpu->mwait.ecx |= CPUID_MWAIT_EMX | CPUID_MWAIT_IBE;
+ /*
+ * Most Intel and certain AMD CPUs support hyperthreading. Even though QEMU
+ * fixes this issue by adjusting CPUID_0000_0001_EBX and
CPUID_8000_0008_ECX
+ * based on inputs (sockets,cores,threads), it is still better to give
+ * users a warning.
+ */
+ if (IS_AMD_CPU(env) &&
+ !(env->features[FEAT_8000_0001_ECX] & CPUID_EXT3_TOPOEXT) &&
+ env->topo_info.threads_per_core > 1) {
+ warn_report_once("This family of AMD CPU doesn't support "
+ "hyperthreading(%d). Please configure -smp "
+ "options properly or try enabling topoext "
+ "feature.", env->topo_info.threads_per_core);
+ }
+
/* For 64bit systems think about the number of physical bits to present.
* ideally this should be the same as the host; anything other than
matching
* the host can cause incorrect guest behaviour.
@@ -7987,21 +8002,6 @@ static void x86_cpu_realizefn(DeviceState *dev, Error
**errp)
x86_cpu_gdb_init(cs);
qemu_init_vcpu(cs);
- /*
- * Most Intel and certain AMD CPUs support hyperthreading. Even though QEMU
- * fixes this issue by adjusting CPUID_0000_0001_EBX and
CPUID_8000_0008_ECX
- * based on inputs (sockets,cores,threads), it is still better to give
- * users a warning.
- */
- if (IS_AMD_CPU(env) &&
- !(env->features[FEAT_8000_0001_ECX] & CPUID_EXT3_TOPOEXT) &&
- env->topo_info.threads_per_core > 1) {
- warn_report_once("This family of AMD CPU doesn't support "
- "hyperthreading(%d). Please configure -smp "
- "options properly or try enabling topoext "
- "feature.", env->topo_info.threads_per_core);
- }
-
#ifndef CONFIG_USER_ONLY
x86_cpu_apic_realize(cpu, &local_err);
if (local_err != NULL) {
--
2.47.1
- [PULL 22/38] target/i386/kvm: Only save/load kvmclock MSRs when kvmclock enabled, (continued)
- [PULL 22/38] target/i386/kvm: Only save/load kvmclock MSRs when kvmclock enabled, Paolo Bonzini, 2025/01/10
- [PULL 23/38] target/i386/kvm: Drop workaround for KVM_X86_DISABLE_EXITS_HTL typo, Paolo Bonzini, 2025/01/10
- [PULL 25/38] target/i386/kvm: Clean up return values of MSR filter related functions, Paolo Bonzini, 2025/01/10
- [PULL 26/38] target/i386/kvm: Return -1 when kvm_msr_energy_thread_init() fails, Paolo Bonzini, 2025/01/10
- [PULL 27/38] target/i386/kvm: Clean up error handling in kvm_arch_init(), Paolo Bonzini, 2025/01/10
- [PULL 32/38] i386/topology: Update the comment of x86_apicid_from_topo_ids(), Paolo Bonzini, 2025/01/10
- [PULL 20/38] target/i386/kvm: Add feature bit definitions for KVM CPUID, Paolo Bonzini, 2025/01/10
- [PULL 37/38] i386/cpu: Set up CPUID_HT in x86_cpu_expand_features() instead of cpu_x86_cpuid(), Paolo Bonzini, 2025/01/10
- [PULL 12/38] rust: qemu-api-macros: add automatic TryFrom/TryInto derivation, Paolo Bonzini, 2025/01/10
- [PULL 31/38] i386/cpu: Drop cores_per_pkg in cpu_x86_cpuid(), Paolo Bonzini, 2025/01/10
- [PULL 35/38] i386/cpu: Hoist check of CPUID_EXT3_TOPOEXT against threads_per_core,
Paolo Bonzini <=
- [PULL 38/38] i386/cpu: Set and track CPUID_EXT3_CMP_LEG in env->features[FEAT_8000_0001_ECX], Paolo Bonzini, 2025/01/10
- [PULL 36/38] cpu: Remove nr_cores from struct CPUState, Paolo Bonzini, 2025/01/10