qemu-devel
[Top][All Lists]
Advanced

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

[RFC 17/52] softmmu/cpus: Use generic topology helper in vcpus initializ


From: Zhao Liu
Subject: [RFC 17/52] softmmu/cpus: Use generic topology helper in vcpus initialization
Date: Mon, 13 Feb 2023 17:50:00 +0800

From: Zhao Liu <zhao1.liu@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.liu@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

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