From: Zhao Liu <zhao1....@intel.com>

As for the generic vcpu initialization, qemu_init_vcpu() should respect
the different topologies: smp or hybrid.

Use generic topology helpers to get topology information.

Signed-off-by: Zhao Liu <zhao1....@intel.com>
---
 softmmu/cpus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/softmmu/cpus.c b/softmmu/cpus.c
index 9996e6a3b295..7892da9c82b5 100644
--- a/softmmu/cpus.c
+++ b/softmmu/cpus.c
@@ -630,8 +630,8 @@ void qemu_init_vcpu(CPUState *cpu)
 {
     MachineState *ms = MACHINE(qdev_get_machine());
 
-    cpu->nr_cores = ms->smp.dies * ms->smp.clusters * ms->smp.cores;
-    cpu->nr_threads =  ms->smp.threads;
+    cpu->nr_cores = machine_topo_get_cores_per_socket(ms);
+    cpu->nr_threads = machine_topo_get_threads_by_idx(ms, cpu->cpu_index);
     cpu->stopped = true;
     cpu->random_seed = qemu_guest_random_seed_thread_part1();
 
-- 
2.34.1


Reply via email to