summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2025-01-16 18:45:41 +0100
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2025-03-06 15:46:17 +0100
commit6042c47cddae04d0c1f0c750968f66a553611f40 (patch)
treed3d3273c01b11ac2778cd3a4f204ba38a84b7f10
parent0e86d7a71e8b5af201f2066a56071d3e23f4693c (diff)
downloadfocaccia-qemu-6042c47cddae04d0c1f0c750968f66a553611f40.tar.gz
focaccia-qemu-6042c47cddae04d0c1f0c750968f66a553611f40.zip
cpus: Keep default fields initialization in cpu_common_initfn()
cpu_common_initfn() is our target agnostic initializer,
while cpu_exec_initfn() is the target specific one.

The %as and %num_ases fields are not target specific,
so initialize them in the common helper.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250123234415.59850-6-philmd@linaro.org>
-rw-r--r--cpu-target.c3
-rw-r--r--hw/core/cpu-common.c2
2 files changed, 2 insertions, 3 deletions
diff --git a/cpu-target.c b/cpu-target.c
index 89874496a4..75501a909d 100644
--- a/cpu-target.c
+++ b/cpu-target.c
@@ -234,9 +234,6 @@ void cpu_class_init_props(DeviceClass *dc)
 
 void cpu_exec_initfn(CPUState *cpu)
 {
-    cpu->as = NULL;
-    cpu->num_ases = 0;
-
 #ifndef CONFIG_USER_ONLY
     cpu->memory = get_system_memory();
     object_ref(OBJECT(cpu->memory));
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
index ff605059c1..71425cb742 100644
--- a/hw/core/cpu-common.c
+++ b/hw/core/cpu-common.c
@@ -244,6 +244,8 @@ static void cpu_common_initfn(Object *obj)
     gdb_init_cpu(cpu);
     cpu->cpu_index = UNASSIGNED_CPU_INDEX;
     cpu->cluster_index = UNASSIGNED_CLUSTER_INDEX;
+    cpu->as = NULL;
+    cpu->num_ases = 0;
     /* user-mode doesn't have configurable SMP topology */
     /* the default value is changed by qemu_init_vcpu() for system-mode */
     cpu->nr_threads = 1;