qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] cpu: Initialize nr_cores and nr_threads in cpu_common_initfn


From: Richard Henderson
Subject: Re: [PATCH] cpu: Initialize nr_cores and nr_threads in cpu_common_initfn()
Date: Fri, 22 Nov 2024 13:17:16 -0600
User-agent: Mozilla Thunderbird

On 11/22/24 11:26, Philippe Mathieu-Daudé wrote:
On 22/11/24 17:03, Xiaoyao Li wrote:
Currently cpu->nr_cores and cpu->nr_threads are initialized in
qemu_init_vcpu(), which is called a bit late in *cpu_realizefn() for
each ARCHes.

x86 arch would like to use nr_cores and nr_threads earlier in its
realizefn(). To serve this purpose, initialize nr_cores and nr_threads
in cpu_common_initfn(), which is earlier than *cpu_realizefn().

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
  hw/core/cpu-common.c | 10 +++++++++-
  system/cpus.c        |  4 ----
  2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
index 09c79035949b..6de92ed854bc 100644
--- a/hw/core/cpu-common.c
+++ b/hw/core/cpu-common.c
@@ -237,14 +237,22 @@ static void cpu_common_unrealizefn(DeviceState *dev)
  static void cpu_common_initfn(Object *obj)
  {
      CPUState *cpu = CPU(obj);
+    Object *machine = qdev_get_machine();
+    MachineState *ms;
      gdb_init_cpu(cpu);
      cpu->cpu_index = UNASSIGNED_CPU_INDEX;
      cpu->cluster_index = UNASSIGNED_CLUSTER_INDEX;
      /* user-mode doesn't have configurable SMP topology */
-    /* the default value is changed by qemu_init_vcpu() for system-mode */
      cpu->nr_cores = 1;
      cpu->nr_threads = 1;
+#ifndef CONFIG_USER_ONLY

Is CONFIG_USER_ONLY available in an common_ss[] object? I don't recall.

No.


r~




reply via email to

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