target/migration: Inline VMSTATE_CPU()
PATCH 1/1 target/migration: Inline VMSTATE_CPU()
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".
--- 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(-)
include/hw/core/cpu.h +0 -12
@@ -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
target/alpha/machine.c +1 -1
@@ -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 () };
target/hppa/machine.c +1 -1
@@ -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 () };
target/microblaze/machine.c +1 -1
@@ -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 () };
target/openrisc/machine.c +1 -1
@@ -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 () }
Signature · 1 line
2.47.1
Quoted 23 lines · Philippe Mathieu-Daudé
VMSTATE_CPU()is only used in 4 places and doesn't provide much, directly inline it usingVMSTATE_STRUCT().This removes the last
COMPILING_PER_TARGETin "hw/core/cpu.h".Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- 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(-)include/hw/core/cpu.h +0
-1@@ -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
include/hw/core/cpu.h bool cpu_exec_realizefn(CPUState *cpu, Error **errp); · line 1134
Quoted 10 lines
include/hw/core/cpu.h +0
-8-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..
Signature · 1 line
Peter Xu
Quoted 5 lines · Philippe Mathieu-Daudé
VMSTATE_CPU()is only used in 4 places and doesn't provide much, directly inline it usingVMSTATE_STRUCT().This removes the last
COMPILING_PER_TARGETin "hw/core/cpu.h".
Quoted 8 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- 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(-)
r~