diff mbox series

[RFC,36/52] i386: Use init_apicid_topo_info() to initialize APIC ID topology for system emulator

Message ID 20230213095035.158240-37-zhao1.liu@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series Introduce hybrid CPU topology | expand

Commit Message

Zhao Liu Feb. 13, 2023, 9:50 a.m. UTC
From: Zhao Liu <zhao1.liu@intel.com>

Since APIC ID for hybrid CPU topology needs to consider maximum possible
structures for each topology levels, the APIC IDs for hybrid CPU topology
and smp CPU topology may be different.

User emulator doesn't support hybrid CPU topology so use
init_apicid_topo_info() for system emulator.

Co-Developed-by: Zhuocheng Ding <zhuocheng.ding@intel.com>
Signed-off-by: Zhuocheng Ding <zhuocheng.ding@intel.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 target/i386/cpu.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 844b6df63a4a..7d6722ab3292 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -39,6 +39,7 @@ 
 #include "exec/address-spaces.h"
 #include "hw/boards.h"
 #include "hw/i386/sgx-epc.h"
+#include "hw/i386/x86.h"
 #endif
 
 #include "disas/capstone.h"
@@ -5260,10 +5261,15 @@  void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
     uint32_t signature[3];
     X86ApicidTopoInfo apicid_topo;
 
+#ifndef CONFIG_USER_ONLY
+    X86MachineState *x86ms = X86_MACHINE(qdev_get_machine());
+    init_apicid_topo_info(&apicid_topo, x86ms);
+#else
     apicid_topo.max_dies = cs->topo.dies_per_socket;
     apicid_topo.max_modules = cs->topo.clusters_per_die;
     apicid_topo.max_cores = cs->topo.cores_per_cluster;
     apicid_topo.max_threads = cs->topo.threads_per_core;
+#endif
 
     /* Calculate & apply limits for different index ranges */
     if (index >= 0xC0000000) {