* [PATCH] target/migration: Inline VMSTATE_CPU()
@ 2025-04-29 8:51 Philippe Mathieu-Daudé
2025-04-29 14:24 ` Peter Xu
2025-04-29 18:31 ` Richard Henderson
0 siblings, 2 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-29 8:51 UTC (permalink / raw)
To: qemu-devel
Cc: Marcel Apfelbaum, Richard Henderson, Zhao Liu, Pierrick Bouvier,
Stafford Horne, Edgar E. Iglesias, Helge Deller, Yanan Wang,
Fabiano Rosas, Peter Xu, Philippe Mathieu-Daudé
VMSTATE_CPU() is only used in 4 places and doesn't provide
much, directly inline it using VMSTATE_STRUCT().
This removes the last COMPILING_PER_TARGET in "hw/core/cpu.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/core/cpu.h | 12 ------------
target/alpha/machine.c | 2 +-
target/hppa/machine.c | 2 +-
target/microblaze/machine.c | 2 +-
target/openrisc/machine.c | 2 +-
5 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 12b2ff1f7d2..1e87f7d393e 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -1121,20 +1121,8 @@ bool cpu_exec_realizefn(CPUState *cpu, Error **errp);
void cpu_exec_unrealizefn(CPUState *cpu);
void cpu_exec_reset_hold(CPUState *cpu);
-#ifdef COMPILING_PER_TARGET
-
extern const VMStateDescription vmstate_cpu_common;
-#define VMSTATE_CPU() { \
- .name = "parent_obj", \
- .size = sizeof(CPUState), \
- .vmsd = &vmstate_cpu_common, \
- .flags = VMS_STRUCT, \
- .offset = 0, \
-}
-
-#endif /* COMPILING_PER_TARGET */
-
#define UNASSIGNED_CPU_INDEX -1
#define UNASSIGNED_CLUSTER_INDEX -1
diff --git a/target/alpha/machine.c b/target/alpha/machine.c
index f09834f635d..5f302b166da 100644
--- a/target/alpha/machine.c
+++ b/target/alpha/machine.c
@@ -74,7 +74,7 @@ static const VMStateDescription vmstate_env = {
};
static const VMStateField vmstate_cpu_fields[] = {
- VMSTATE_CPU(),
+ VMSTATE_STRUCT(parent_obj, AlphaCPU, 0, vmstate_cpu_common, CPUState),
VMSTATE_STRUCT(env, AlphaCPU, 1, vmstate_env, CPUAlphaState),
VMSTATE_END_OF_LIST()
};
diff --git a/target/hppa/machine.c b/target/hppa/machine.c
index bb47a2e689f..13e555151a6 100644
--- a/target/hppa/machine.c
+++ b/target/hppa/machine.c
@@ -216,7 +216,7 @@ static const VMStateDescription vmstate_env = {
};
static const VMStateField vmstate_cpu_fields[] = {
- VMSTATE_CPU(),
+ VMSTATE_STRUCT(parent_obj, HPPACPU, 0, vmstate_cpu_common, CPUState),
VMSTATE_STRUCT(env, HPPACPU, 1, vmstate_env, CPUHPPAState),
VMSTATE_END_OF_LIST()
};
diff --git a/target/microblaze/machine.c b/target/microblaze/machine.c
index 51705e4f5c9..a4cf38dc891 100644
--- a/target/microblaze/machine.c
+++ b/target/microblaze/machine.c
@@ -93,7 +93,7 @@ static const VMStateDescription vmstate_env = {
};
static const VMStateField vmstate_cpu_fields[] = {
- VMSTATE_CPU(),
+ VMSTATE_STRUCT(parent_obj, MicroBlazeCPU, 0, vmstate_cpu_common, CPUState),
VMSTATE_STRUCT(env, MicroBlazeCPU, 1, vmstate_env, CPUMBState),
VMSTATE_END_OF_LIST()
};
diff --git a/target/openrisc/machine.c b/target/openrisc/machine.c
index 3574e571cb2..081c706d02c 100644
--- a/target/openrisc/machine.c
+++ b/target/openrisc/machine.c
@@ -136,7 +136,7 @@ const VMStateDescription vmstate_openrisc_cpu = {
.minimum_version_id = 1,
.post_load = cpu_post_load,
.fields = (const VMStateField[]) {
- VMSTATE_CPU(),
+ VMSTATE_STRUCT(parent_obj, OpenRISCCPU, 0, vmstate_cpu_common, CPUState),
VMSTATE_STRUCT(env, OpenRISCCPU, 1, vmstate_env, CPUOpenRISCState),
VMSTATE_END_OF_LIST()
}
--
2.47.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] target/migration: Inline VMSTATE_CPU()
2025-04-29 8:51 [PATCH] target/migration: Inline VMSTATE_CPU() Philippe Mathieu-Daudé
@ 2025-04-29 14:24 ` Peter Xu
2025-04-29 18:31 ` Richard Henderson
1 sibling, 0 replies; 3+ messages in thread
From: Peter Xu @ 2025-04-29 14:24 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Marcel Apfelbaum, Richard Henderson, Zhao Liu,
Pierrick Bouvier, Stafford Horne, Edgar E. Iglesias, Helge Deller,
Yanan Wang, Fabiano Rosas
On Tue, Apr 29, 2025 at 10:51:48AM +0200, Philippe Mathieu-Daudé wrote:
> VMSTATE_CPU() is only used in 4 places and doesn't provide
> much, directly inline it using VMSTATE_STRUCT().
>
> This removes the last COMPILING_PER_TARGET in "hw/core/cpu.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/hw/core/cpu.h | 12 ------------
> target/alpha/machine.c | 2 +-
> target/hppa/machine.c | 2 +-
> target/microblaze/machine.c | 2 +-
> target/openrisc/machine.c | 2 +-
> 5 files changed, 4 insertions(+), 16 deletions(-)
>
> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
> index 12b2ff1f7d2..1e87f7d393e 100644
> --- a/include/hw/core/cpu.h
> +++ b/include/hw/core/cpu.h
> @@ -1121,20 +1121,8 @@ bool cpu_exec_realizefn(CPUState *cpu, Error **errp);
> void cpu_exec_unrealizefn(CPUState *cpu);
> void cpu_exec_reset_hold(CPUState *cpu);
>
> -#ifdef COMPILING_PER_TARGET
> -
> extern const VMStateDescription vmstate_cpu_common;
>
> -#define VMSTATE_CPU() { \
> - .name = "parent_obj", \
> - .size = sizeof(CPUState), \
> - .vmsd = &vmstate_cpu_common, \
> - .flags = VMS_STRUCT, \
> - .offset = 0, \
> -}
Before looking at this I didn't notice there're a bunch of vmsds that are
with version_id=0.. but looks like it's working all fine..
Acked-by: Peter Xu <peterx@redhat.com>
--
Peter Xu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] target/migration: Inline VMSTATE_CPU()
2025-04-29 8:51 [PATCH] target/migration: Inline VMSTATE_CPU() Philippe Mathieu-Daudé
2025-04-29 14:24 ` Peter Xu
@ 2025-04-29 18:31 ` Richard Henderson
1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2025-04-29 18:31 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Marcel Apfelbaum, Zhao Liu, Pierrick Bouvier, Stafford Horne,
Edgar E. Iglesias, Helge Deller, Yanan Wang, Fabiano Rosas,
Peter Xu
On 4/29/25 01:51, Philippe Mathieu-Daudé wrote:
> VMSTATE_CPU() is only used in 4 places and doesn't provide
> much, directly inline it using VMSTATE_STRUCT().
>
> This removes the last COMPILING_PER_TARGET in "hw/core/cpu.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/hw/core/cpu.h | 12 ------------
> target/alpha/machine.c | 2 +-
> target/hppa/machine.c | 2 +-
> target/microblaze/machine.c | 2 +-
> target/openrisc/machine.c | 2 +-
> 5 files changed, 4 insertions(+), 16 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-29 18:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-29 8:51 [PATCH] target/migration: Inline VMSTATE_CPU() Philippe Mathieu-Daudé
2025-04-29 14:24 ` Peter Xu
2025-04-29 18:31 ` Richard Henderson
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).