qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	qemu-arm@nongnu.org, "Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH 01/11] cpus: Cache CPUClass early in instance_init() handler
Date: Tue, 21 Jan 2025 12:40:46 +0100	[thread overview]
Message-ID: <20250121114056.53949-2-philmd@linaro.org> (raw)
In-Reply-To: <20250121114056.53949-1-philmd@linaro.org>

Cache CPUClass as early as possible, when the instance
is initialized.

Signed-off-by: Philippe Mathieu-Daudé <philmd@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



  reply	other threads:[~2025-01-21 11:43 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-21 11:40 [PATCH 00/11] cpus: Prefer cached CpuClass over CPU_GET_CLASS() macro Philippe Mathieu-Daudé
2025-01-21 11:40 ` Philippe Mathieu-Daudé [this message]
2025-01-21 15:54   ` [PATCH 01/11] cpus: Cache CPUClass early in instance_init() handler Richard Henderson
2025-01-21 11:40 ` [PATCH 02/11] cpus: Prefer cached CpuClass over CPU_GET_CLASS() macro Philippe Mathieu-Daudé
2025-01-21 15:55   ` Richard Henderson
2025-01-21 11:40 ` [PATCH 03/11] accel: " Philippe Mathieu-Daudé
2025-01-21 15:56   ` Richard Henderson
2025-01-21 11:40 ` [PATCH 04/11] user: " Philippe Mathieu-Daudé
2025-01-21 15:57   ` Richard Henderson
2025-01-21 11:40 ` [PATCH 05/11] disas: " Philippe Mathieu-Daudé
2025-01-21 15:57   ` Richard Henderson
2025-01-21 11:40 ` [PATCH 06/11] gdbstub: " Philippe Mathieu-Daudé
2025-01-21 12:43   ` Alex Bennée
2025-01-21 15:58   ` Richard Henderson
2025-01-21 11:40 ` [PATCH 07/11] hw/acpi: " Philippe Mathieu-Daudé
2025-01-21 15:58   ` Richard Henderson
2025-01-21 11:40 ` [PATCH 08/11] hw/core/generic-loader: Prefer cached CpuClass over CPU_GET_CLASS macro Philippe Mathieu-Daudé
2025-01-21 18:53   ` Philippe Mathieu-Daudé
2025-01-21 11:40 ` [PATCH 09/11] target/arm: Prefer cached CpuClass over CPU_GET_CLASS() macro Philippe Mathieu-Daudé
2025-01-21 12:43   ` Alex Bennée
2025-01-21 11:40 ` [PATCH 10/11] target/microblaze: " Philippe Mathieu-Daudé
2025-01-21 18:54   ` Philippe Mathieu-Daudé
2025-01-21 11:40 ` [PATCH 11/11] target/openrisc: " Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250121114056.53949-2-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).