[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
- Re: [RFC 12/52] hw/acpi: Replace MachineState.smp access with topology helpers, (continued)
- [RFC 14/52] hw/smbios: Use generic topology name and helper, Zhao Liu, 2023/02/13
- [RFC 13/52] cpu/core: Use generic topology helper for "help" to set nr_threads, Zhao Liu, 2023/02/13
- [RFC 15/52] migration/postcopy-ram: Use generic topology name and helper, Zhao Liu, 2023/02/13
- [RFC 16/52] plugins: Use generic topology name and helper, Zhao Liu, 2023/02/13
- [RFC 17/52] softmmu/cpus: Use generic topology helper in vcpus initialization,
Zhao Liu <=
- [RFC 18/52] general: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13
- [RFC 19/52] i386: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13
- [RFC 20/52] s390x: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13
- [RFC 21/52] ppc: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13
- [RFC 22/52] riscv: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13
- [RFC 23/52] arm: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13