aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiaoyao Li <xiaoyao.li@intel.com>2024-12-19 06:01:25 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2025-01-10 23:34:45 +0100
commit99a637a86f55c8486b06c698656befdf012eec4d (patch)
tree21fdc963193bb442ce2ee15c812050c48387644f
parentc6bd2dd634208ca717b6dc010064fe34d1359080 (diff)
downloadqemu-99a637a86f55c8486b06c698656befdf012eec4d.zip
qemu-99a637a86f55c8486b06c698656befdf012eec4d.tar.gz
qemu-99a637a86f55c8486b06c698656befdf012eec4d.tar.bz2
i386/cpu: Set and track CPUID_EXT3_CMP_LEG in env->features[FEAT_8000_0001_ECX]
The correct usage is tracking and maintaining features in env->features[] instead of manually set it in cpu_x86_cpuid(). Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com> Link: https://lore.kernel.org/r/20241219110125.1266461-11-xiaoyao.li@intel.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--target/i386/cpu.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 3f0821c..1b9c110 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6953,17 +6953,6 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
*ecx = env->features[FEAT_8000_0001_ECX];
*edx = env->features[FEAT_8000_0001_EDX];
- /* The Linux kernel checks for the CMPLegacy bit and
- * discards multiple thread information if it is set.
- * So don't set it here for Intel to make Linux guests happy.
- */
- if (threads_per_pkg > 1) {
- if (env->cpuid_vendor1 != CPUID_VENDOR_INTEL_1 ||
- env->cpuid_vendor2 != CPUID_VENDOR_INTEL_2 ||
- env->cpuid_vendor3 != CPUID_VENDOR_INTEL_3) {
- *ecx |= 1 << 1; /* CmpLegacy bit */
- }
- }
if (tcg_enabled() && env->cpuid_vendor1 == CPUID_VENDOR_INTEL_1 &&
!(env->hflags & HF_LMA_MASK)) {
*edx &= ~CPUID_EXT2_SYSCALL;
@@ -7530,6 +7519,15 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
if (x86_threads_per_pkg(&env->topo_info) > 1) {
env->features[FEAT_1_EDX] |= CPUID_HT;
+
+ /*
+ * The Linux kernel checks for the CMPLegacy bit and
+ * discards multiple thread information if it is set.
+ * So don't set it here for Intel to make Linux guests happy.
+ */
+ if (!IS_INTEL_CPU(env)) {
+ env->features[FEAT_8000_0001_ECX] |= CPUID_EXT3_CMP_LEG;
+ }
}
for (i = 0; i < ARRAY_SIZE(feature_dependencies); i++) {