[PATCH] The processor id in SMBIOS should be same as edx:eax that CPUID instruction returned.

windy posted 1 patch 2 years, 2 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1645440725-3865-1-git-send-email-tai7sy@gmail.com
Maintainers: Richard Henderson <richard.henderson@linaro.org>, "Michael S. Tsirkin" <mst@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
hw/i386/fw_cfg.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
[PATCH] The processor id in SMBIOS should be same as edx:eax that CPUID instruction returned.
Posted by windy 2 years, 2 months ago
Signed-off-by: windy <tai7sy@gmail.com>
---
 hw/i386/fw_cfg.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c
index a283785..44f27ae 100644
--- a/hw/i386/fw_cfg.c
+++ b/hw/i386/fw_cfg.c
@@ -56,9 +56,14 @@ void fw_cfg_build_smbios(MachineState *ms, FWCfgState *fw_cfg)
     struct smbios_phys_mem_area *mem_array;
     unsigned i, array_count;
     X86CPU *cpu = X86_CPU(ms->possible_cpus->cpus[0].cpu);
+    CPUState *cs = CPU(cpu);
 
     /* tell smbios about cpuid version and features */
-    smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]);
+    uint32_t edx = cpu->env.features[FEAT_1_EDX];
+    if (cs->nr_cores * cs->nr_threads > 1) {
+        edx |= CPUID_HT;
+    }
+    smbios_set_cpuid(cpu->env.cpuid_version, edx);
 
     smbios_tables = smbios_get_table_legacy(ms, &smbios_tables_len);
     if (smbios_tables) {
-- 
1.8.3.1