From: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
To: qemu-devel@nongnu.org
Cc: Richard Henderson <richard.henderson@linaro.org>,
qemu-ppc@nongnu.org,
Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>,
qemu-arm@nongnu.org, qemu-s390x@nongnu.org, kvm@vger.kernel.org,
qemu-riscv@nongnu.org
Subject: [PATCH 3/8] hw/cpu: Move internal declarations to new 'cpu-internal.h' header
Date: Tue, 11 Aug 2026 20:34:05 +0200 [thread overview]
Message-ID: <20260811183410.22428-4-philmd@oss.qualcomm.com> (raw)
In-Reply-To: <20260811183410.22428-1-philmd@oss.qualcomm.com>
Some declarations are only used within hw/core/, in particular
by the 3 cpu-{common,user,system}.c. Restrict the declarations
scope by moving them to a new "cpu-internal.h" local header.
Rename cpu_exec_initfn() -> cpu_exec_init() because we usually
have the 'fn' suffix for handler, not API entry point methods.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
hw/core/cpu-internal.h | 22 ++++++++++++++++++++++
include/hw/core/cpu.h | 6 ------
hw/core/cpu-common.c | 3 ++-
hw/core/cpu-system.c | 3 ++-
hw/core/cpu-user.c | 3 ++-
5 files changed, 28 insertions(+), 9 deletions(-)
create mode 100644 hw/core/cpu-internal.h
diff --git a/hw/core/cpu-internal.h b/hw/core/cpu-internal.h
new file mode 100644
index 00000000000..ae6a31bca2d
--- /dev/null
+++ b/hw/core/cpu-internal.h
@@ -0,0 +1,22 @@
+/*
+ * QEMU private CPU interface between user / system modes)
+ *
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef HW_CORE_CPU_INTERNAL_H
+#define HW_CORE_CPU_INTERNAL_H
+
+#include "hw/core/qdev.h"
+#include "hw/core/cpu.h"
+
+void cpu_class_init_props(DeviceClass *dc);
+void cpu_exec_class_post_init(CPUClass *cc);
+
+void cpu_exec_init(CPUState *cpu);
+
+void cpu_vmstate_register(CPUState *cpu);
+void cpu_vmstate_unregister(CPUState *cpu);
+
+#endif
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index c5064a5449b..6490fb070f2 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -1178,12 +1178,6 @@ G_NORETURN void cpu_abort(CPUState *cpu, const char *fmt, ...)
*/
void qemu_process_cpu_events(CPUState *cpu);
-/* $(top_srcdir)/cpu.c */
-void cpu_class_init_props(DeviceClass *dc);
-void cpu_exec_class_post_init(CPUClass *cc);
-void cpu_exec_initfn(CPUState *cpu);
-void cpu_vmstate_register(CPUState *cpu);
-void cpu_vmstate_unregister(CPUState *cpu);
bool cpu_exec_realizefn(CPUState *cpu, Error **errp);
void cpu_exec_unrealizefn(CPUState *cpu);
void cpu_exec_reset_hold(CPUState *cpu);
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
index 8c9ff25e04a..17d76580930 100644
--- a/hw/core/cpu-common.c
+++ b/hw/core/cpu-common.c
@@ -39,6 +39,7 @@
#ifdef CONFIG_PLUGIN
#include "qemu/plugin.h"
#endif
+#include "cpu-internal.h"
CPUState *cpu_by_arch_id(int64_t id)
{
@@ -326,7 +327,7 @@ static void cpu_common_initfn(Object *obj)
QTAILQ_INIT(&cpu->breakpoints);
QTAILQ_INIT(&cpu->watchpoints);
- cpu_exec_initfn(cpu);
+ cpu_exec_init(cpu);
/*
* Plugin initialization must wait until the cpu start executing
diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c
index 14eb4ed87f8..8a9f2fcea84 100644
--- a/hw/core/cpu-system.c
+++ b/hw/core/cpu-system.c
@@ -30,6 +30,7 @@
#include "hw/core/sysemu-cpu-ops.h"
#include "migration/vmstate.h"
#include "system/tcg.h"
+#include "cpu-internal.h"
bool cpu_has_work(CPUState *cpu)
{
@@ -188,7 +189,7 @@ void cpu_exec_class_post_init(CPUClass *cc)
g_assert(cc->sysemu_ops->has_work);
}
-void cpu_exec_initfn(CPUState *cpu)
+void cpu_exec_init(CPUState *cpu)
{
cpu->memory = get_system_memory();
object_ref(OBJECT(cpu->memory));
diff --git a/hw/core/cpu-user.c b/hw/core/cpu-user.c
index 25aa25ad240..c2cb00a85d3 100644
--- a/hw/core/cpu-user.c
+++ b/hw/core/cpu-user.c
@@ -11,6 +11,7 @@
#include "hw/core/qdev-properties.h"
#include "hw/core/cpu.h"
#include "migration/vmstate.h"
+#include "cpu-internal.h"
static const Property cpu_user_props[] = {
/*
@@ -32,7 +33,7 @@ void cpu_exec_class_post_init(CPUClass *cc)
/* nothing to do */
}
-void cpu_exec_initfn(CPUState *cpu)
+void cpu_exec_init(CPUState *cpu)
{
/* nothing to do */
}
--
2.53.0
next prev parent reply other threads:[~2026-08-11 18:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 18:34 [PATCH 0/8] hw/cpu: Slightly sanitize CPU API Philippe Mathieu-Daudé
2026-08-11 18:34 ` [PATCH 1/8] hw/cpu: Correct CPU_GET_CLASS() comment Philippe Mathieu-Daudé
2026-08-11 18:34 ` [PATCH 2/8] hw/cpu: Include missing 'qemu/accel.h' header Philippe Mathieu-Daudé
2026-08-11 18:34 ` Philippe Mathieu-Daudé [this message]
2026-08-11 18:34 ` [PATCH 4/8] hw/cpu: Rename cpu_common_realizefn() -> cpu_exec_realize() Philippe Mathieu-Daudé
2026-08-11 18:34 ` [PATCH 5/8] hw/cpu: Rename cpu_exec_realizefn() -> cpu_common_realize() Philippe Mathieu-Daudé
2026-08-11 18:34 ` [PATCH 6/8] hw/cpu: Rename cpu_exec_unrealizefn() -> cpu_common_unrealize() Philippe Mathieu-Daudé
2026-08-11 18:34 ` [PATCH 7/8] hw/cpu: Extract cpu_exec_realize() out of cpu_common_realizefn() Philippe Mathieu-Daudé
2026-08-11 18:34 ` [PATCH 8/8] hw/cpu: Move system-specific cpu_exec_realize() to cpu-system.c Philippe Mathieu-Daudé
2026-08-11 23:33 ` [PATCH 0/8] hw/cpu: Slightly sanitize CPU API Richard Henderson
2026-08-15 13:52 ` 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=20260811183410.22428-4-philmd@oss.qualcomm.com \
--to=philmd@oss.qualcomm.com \
--cc=kvm@vger.kernel.org \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=qemu-s390x@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.