summary refs log tree commit diff stats
path: root/hw/core/cpu-common.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2025-01-21 12:38:45 +0100
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2025-03-06 15:46:17 +0100
commit0e86d7a71e8b5af201f2066a56071d3e23f4693c (patch)
treec6942b0796e3759653f67ff31523038e4d8a3a60 /hw/core/cpu-common.c
parent270dbee10cd31b86f0a3a8a2691026bdb0b9a071 (diff)
downloadfocaccia-qemu-0e86d7a71e8b5af201f2066a56071d3e23f4693c.tar.gz
focaccia-qemu-0e86d7a71e8b5af201f2066a56071d3e23f4693c.zip
cpus: Cache CPUClass early in instance_init() handler
Cache CPUClass as early as possible, when the instance
is initialized.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250123234415.59850-5-philmd@linaro.org>
Diffstat (limited to 'hw/core/cpu-common.c')
-rw-r--r--hw/core/cpu-common.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
index cb79566cc5..ff605059c1 100644
--- a/hw/core/cpu-common.c
+++ b/hw/core/cpu-common.c
@@ -238,6 +238,9 @@ static void cpu_common_initfn(Object *obj)
 {
     CPUState *cpu = CPU(obj);
 
+    /* cache the cpu class for the hotpath */
+    cpu->cc = CPU_GET_CLASS(cpu);
+
     gdb_init_cpu(cpu);
     cpu->cpu_index = UNASSIGNED_CPU_INDEX;
     cpu->cluster_index = UNASSIGNED_CLUSTER_INDEX;