qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC 36/52] i386: Use init_apicid_topo_info() to initialize APIC ID topo


From: Zhao Liu
Subject: [RFC 36/52] i386: Use init_apicid_topo_info() to initialize APIC ID topology for system emulator
Date: Mon, 13 Feb 2023 17:50:19 +0800

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 --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) {
-- 
2.34.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]