[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 04/20] cpus: Cache CPUClass early in instance_init() handler
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 04/20] cpus: Cache CPUClass early in instance_init() handler |
Date: |
Fri, 24 Jan 2025 00:43:58 +0100 |
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>
---
cpu-target.c | 3 ---
hw/core/cpu-common.c | 3 +++
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/cpu-target.c b/cpu-target.c
index 667688332c9..89874496a41 100644
--- a/cpu-target.c
+++ b/cpu-target.c
@@ -134,9 +134,6 @@ const VMStateDescription vmstate_cpu_common = {
bool cpu_exec_realizefn(CPUState *cpu, Error **errp)
{
- /* cache the cpu class for the hotpath */
- cpu->cc = CPU_GET_CLASS(cpu);
-
if (!accel_cpu_common_realize(cpu, errp)) {
return false;
}
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
index cb79566cc51..ff605059c15 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;
--
2.47.1
- [PATCH 00/20] accel: Simplify cpu-target.c (omnibus), Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 01/20] qemu/compiler: Absorb 'clang-tsa.h', Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 02/20] user: Extract common MMAP API to 'user/mmap.h', Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 03/20] gdbstub: Check for TCG before calling tb_flush(), Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 04/20] cpus: Cache CPUClass early in instance_init() handler,
Philippe Mathieu-Daudé <=
- [PATCH 05/20] cpus: Keep default fields initialization in cpu_common_initfn(), Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 06/20] accel/kvm: Remove unused 'system/cpus.h' header in kvm-cpus.h, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 07/20] accel/tcg: Build tcg_flags helpers as common code, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 08/20] accel/tcg: Restrict tlb_init() / destroy() to TCG, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 09/20] accel/tcg: Restrict 'icount_align_option' global to TCG, Philippe Mathieu-Daudé, 2025/01/23