migration: Reduce uses of target-specific macros
Subsystems (2)
cover migration: Reduce uses of target-specific macros
For the single binary (read heterogeneous emulation) project we are trying to remove the uses of the 'target_ulong' type in common code (or code that should be common code but is compiled a target-specific one).
This series aims to reduce the use of migration target-specific macros. Since there is still a lot of work to be done, we introduce the TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API definition to protect the targets which are already not using these legacy migration macros.
Except for the SPARC targets, there should be no functional change.
Philippe Mathieu-Daudé (10):
target/avr: Avoid target-specific migration headers in machine.c target/loongarch: Avoid target-specific migration headers in machine.c
migration: Revert "Add VMSTATE_UINTTL_2DARRAY()"
migration: Remove unused target-specific macros target/sparc: Inline qemu_get/put_betl()
target/mips: Inline qemu_get/put_betls()
target/i386: Expand VMSTATE_UINTTL_SUB_ARRAY for APX registers target/i386: Inline VMSTATE_UINTTL_SUB_ARRAY() macro target/sparc: Replace VMSTATE_VARRAY_MULTIPLY -> VMSTATE_UINTTL_ARRAY
migration: Restrict legacy VMSTATE_UINTTL() macros to few targets
configs/targets/i386-softmmu.mak | 1 + configs/targets/mips-softmmu.mak | 1 + configs/targets/mips64-softmmu.mak | 1 + configs/targets/mips64el-softmmu.mak | 1 + configs/targets/mipsel-softmmu.mak | 1 + configs/targets/ppc-softmmu.mak | 1 + configs/targets/ppc64-softmmu.mak | 1 + configs/targets/riscv32-softmmu.mak | 1 + configs/targets/riscv64-softmmu.mak | 1 + configs/targets/sparc-softmmu.mak | 1 + configs/targets/sparc64-softmmu.mak | 1 + configs/targets/x86_64-softmmu.mak | 1 + include/migration/cpu.h | 59 ++++++---------------------- include/migration/vmstate.h | 22 ++--------- migration/vmstate.c | 4 -- target/avr/machine.c | 3 +- target/i386/machine.c | 8 +++- target/loongarch/machine.c | 2 +- target/mips/system/machine.c | 14 ++++++- target/ppc/machine.c | 1 + target/sparc/machine.c | 24 +++++++---- scripts/make-config-poison.sh | 1 + target/avr/meson.build | 3 +- target/loongarch/meson.build | 2 +- 24 files changed, 67 insertions(+), 88 deletions(-)
Signature · 1 line
2.53.0
PATCH 1/10 target/avr: Avoid target-specific migration headers in machine.c
machine.c doesn't use any target-specific macro defined by the "migration/cpu.h" header. Use the minimum headers required:
"migration/qemu-file-types.h" and "migration/vmstate.h", which are not target-specific. This allows to build this file as common object.
--- target/avr/machine.c | 3 ++- target/avr/meson.build | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-)
target/avr/machine.c +2 -1
@@ -20,7 +20,8 @@#include "qemu/osdep.h" #include "cpu.h" -#include "migration/cpu.h" +#include "migration/qemu-file-types.h" +#include "migration/vmstate.h" static int get_sreg (QEMUFile *f,void *opaque,size_t size,const VMStateField *field)
target/avr/meson.build +1 -2
@@ -15,8 +15,7 @@ avr_ss.add(files( avr_common_system_ss = ss.source_set() avr_common_system_ss.add(files('gdbstub.c')) - -avr_system_ss.add(files('machine.c')) +avr_common_system_ss.add(files('machine.c')) target_arch += {'avr': avr_ss} target_system_arch += {'avr': avr_system_ss}
Signature · 1 line
2.53.0
Re: [PATCH-for-11.1 01/10] target/avr: Avoid target-specific migration headers in machine.c
Quoted 6 lines · Philippe Mathieu-Daudé
machine.cdoesn't use any target-specific macro defined by the "migration/cpu.h" header. Use the minimum headers required:
"migration/qemu-file-types.h" and "migration/vmstate.h", which are not target-specific. This allows to build this file as common object.
Quoted 6 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/avr/machine.c | 3 ++- target/avr/meson.build | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-)
PATCH 2/10 target/loongarch: Avoid target-specific migration headers in machine.c
In reply to Philippe Mathieu-Daudémachine.c doesn't use any target-specific macro defined by the "migration/cpu.h" header. Use the minimum header required:
"migration/qemu-file-types.h" which is not target-specific. This allows to build this file as common object.
--- target/loongarch/machine.c | 2 +- target/loongarch/meson.build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
target/loongarch/machine.c +1 -1
@@ -7,7 +7,7 @@#include "qemu/osdep.h" #include "cpu.h" -#include "migration/cpu.h" +#include "migration/vmstate.h" #include "system/tcg.h" #include "vec.h"
target/loongarch/meson.build +1 -1
@@ -10,6 +10,7 @@ loongarch_user_ss.add(files('gdbstub.c')) loongarch_common_system_ss = ss.source_set() loongarch_common_system_ss.add(files('gdbstub.c')) +loongarch_common_system_ss.add(files('machine.c')) loongarch_system_ss = ss.source_set() loongarch_system_ss.add(files(
@@ -17,7 +18,6 @@ loongarch_system_ss.add(files( 'cpu_helper.c', 'csr.c', 'loongarch-qmp-cmds.c', - 'machine.c', )) common_ss.add(when: 'CONFIG_LOONGARCH_DIS', if_true: [files('disas.c'), gen])
Signature · 1 line
2.53.0
Re: [PATCH-for-11.1 02/10] target/loongarch: Avoid target-specific migration headers in machine.c
Quoted 11 lines · Philippe Mathieu-Daudé
machine.cdoesn't use any target-specific macro defined by the "migration/cpu.h" header. Use the minimum header required:
"migration/qemu-file-types.h" which is not target-specific. This allows to build this file as common object.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/loongarch/machine.c | 2 +- target/loongarch/meson.build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
PATCH 3/10 migration: Revert "Add VMSTATE_UINTTL_2DARRAY()"
In reply to Philippe Mathieu-DaudéThe VMSTATE_UINTTL_2DARRAY() macro was never used, remove it.
This reverts commit 4597992f624c015ceb51fedb4628b3fdb1e5bbaa.
--- include/migration/cpu.h | 6 ------ 1 file changed, 6 deletions(-)
include/migration/cpu.h +0 -6
@@ -23,8 +23,6 @@ VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v)#define VMSTATE_UINTTL_SUB_ARRAY (_f, _s, _start, _num) \ VMSTATE_UINT64_SUB_ARRAY(_f, _s, _start, _num) -#define VMSTATE_UINTTL_2DARRAY_V (_f, _s, _n1, _n2, _v) \ - VMSTATE_UINT64_2DARRAY_V(_f, _s, _n1, _n2, _v)#define VMSTATE_UINTTL_TEST (_f, _s, _t) \ VMSTATE_UINT64_TEST(_f, _s, _t)#define vmstate_info_uinttl vmstate_info_uint64
@@ -44,8 +42,6 @@ VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v)#define VMSTATE_UINTTL_SUB_ARRAY (_f, _s, _start, _num) \ VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num) -#define VMSTATE_UINTTL_2DARRAY_V (_f, _s, _n1, _n2, _v) \ - VMSTATE_UINT32_2DARRAY_V(_f, _s, _n1, _n2, _v)#define VMSTATE_UINTTL_TEST (_f, _s, _t) \ VMSTATE_UINT32_TEST(_f, _s, _t)#define vmstate_info_uinttl vmstate_info_uint32
@@ -55,8 +51,6 @@ VMSTATE_UINTTL_V(_f, _s, 0)#define VMSTATE_UINTTL_ARRAY (_f, _s, _n) \ VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, 0) -#define VMSTATE_UINTTL_2DARRAY (_f, _s, _n1, _n2) \ - VMSTATE_UINTTL_2DARRAY_V(_f, _s, _n1, _n2, 0)#endif
Signature · 1 line
2.53.0
Re: [PATCH-for-11.1 03/10] migration: Revert "Add VMSTATE_UINTTL_2DARRAY()"
Quoted 9 lines · Philippe Mathieu-Daudé
The
VMSTATE_UINTTL_2DARRAY()macro was never used, remove it.This reverts commit
4597992f624c015ceb51fedb4628b3fdb1e5bbaa.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/migration/cpu.h | 6 ------ 1 file changed, 6 deletions(-)
Re: [PATCH-for-11.1 03/10] migration: Revert "Add VMSTATE_UINTTL_2DARRAY()"
In reply to Philippe Mathieu-DaudéQuoted 5 lines · Philippe Mathieu-Daudé
The
VMSTATE_UINTTL_2DARRAY()macro was never used, remove it.This reverts commit
4597992f624c015ceb51fedb4628b3fdb1e5bbaa.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Signature · 1 line
Peter Xu
PATCH 4/10 migration: Remove unused target-specific macros
In reply to Philippe Mathieu-DaudéLast use of VMSTATE_UINTTL_TEST() was removed in commit 445d3facffe ("ppc/spapr: remove deprecated machine pseries-2.7").
The following definitions were added in commit b6c4f71f508 ("Resurrect the safe part of r5274") but never used:
- qemu_put_sbetl qemu_put_sbe64
- qemu_get_sbetl qemu_get_sbe64
- qemu_put_sbetls qemu_put_sbe64s
- qemu_get_sbetls qemu_get_sbe64s
Remove all as unused.
--- include/migration/cpu.h | 13 ------------- 1 file changed, 13 deletions(-)
include/migration/cpu.h +0 -13
@@ -12,10 +12,6 @@#define qemu_get_betl qemu_get_be64#define qemu_put_betls qemu_put_be64s#define qemu_get_betls qemu_get_be64s -#define qemu_put_sbetl qemu_put_sbe64 -#define qemu_get_sbetl qemu_get_sbe64 -#define qemu_put_sbetls qemu_put_sbe64s -#define qemu_get_sbetls qemu_get_sbe64s#define VMSTATE_UINTTL_V (_f, _s, _v) \ VMSTATE_UINT64_V(_f, _s, _v)
@@ -23,18 +19,12 @@ VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v)#define VMSTATE_UINTTL_SUB_ARRAY (_f, _s, _start, _num) \ VMSTATE_UINT64_SUB_ARRAY(_f, _s, _start, _num) -#define VMSTATE_UINTTL_TEST (_f, _s, _t) \ - VMSTATE_UINT64_TEST(_f, _s, _t)#define vmstate_info_uinttl vmstate_info_uint64#else #define qemu_put_betl qemu_put_be32#define qemu_get_betl qemu_get_be32#define qemu_put_betls qemu_put_be32s#define qemu_get_betls qemu_get_be32s -#define qemu_put_sbetl qemu_put_sbe32 -#define qemu_get_sbetl qemu_get_sbe32 -#define qemu_put_sbetls qemu_put_sbe32s -#define qemu_get_sbetls qemu_get_sbe32s#define VMSTATE_UINTTL_V (_f, _s, _v) \ VMSTATE_UINT32_V(_f, _s, _v)
@@ -42,8 +32,6 @@ VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v)#define VMSTATE_UINTTL_SUB_ARRAY (_f, _s, _start, _num) \ VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num) -#define VMSTATE_UINTTL_TEST (_f, _s, _t) \ - VMSTATE_UINT32_TEST(_f, _s, _t)#define vmstate_info_uinttl vmstate_info_uint32#endif
@@ -52,5 +40,4 @@#define VMSTATE_UINTTL_ARRAY (_f, _s, _n) \ VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, 0) -#endif
Signature · 1 line
2.53.0
Re: [PATCH-for-11.1 04/10] migration: Remove unused target-specific macros
Quoted 11 lines · Philippe Mathieu-Daudé
Last use of
VMSTATE_UINTTL_TEST()was removed in commit445d3facffe("ppc/spapr: remove deprecated machine pseries-2.7").The following definitions were added in commit
b6c4f71f508("Resurrect the safe part of r5274") but never used:-
qemu_put_sbetlqemu_put_sbe64
-qemu_get_sbetlqemu_get_sbe64
-qemu_put_sbetlsqemu_put_sbe64s
-qemu_get_sbetlsqemu_get_sbe64s
Quoted 7 lines
Remove all as unused.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/migration/cpu.h | 13 ------------- 1 file changed, 13 deletions(-)
Re: [PATCH-for-11.1 04/10] migration: Remove unused target-specific macros
In reply to Philippe Mathieu-DaudéQuoted 6 lines · Philippe Mathieu-Daudé
Last use of
VMSTATE_UINTTL_TEST()was removed in commit445d3facffe("ppc/spapr: remove deprecated machine pseries-2.7").The following definitions were added in commit
b6c4f71f508("Resurrect the safe part of r5274") but never used:
Quoted 8 lines
-
qemu_put_sbetlqemu_put_sbe64
-qemu_get_sbetlqemu_get_sbe64
-qemu_put_sbetlsqemu_put_sbe64s
-qemu_get_sbetlsqemu_get_sbe64sRemove all as unused.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Signature · 1 line
Peter Xu
PATCH 5/10 target/sparc: Inline qemu_get/put_betl()
In reply to Philippe Mathieu-DaudéUse TargetInfo target_long_bits() helper at runtime to migrate the FSR register as 32 or 64-bits.
--- include/migration/cpu.h | 4 ---- target/sparc/machine.c | 17 +++++++++++++---- 2 files changed, 13 insertions(+), 8 deletions(-)
include/migration/cpu.h +0 -4
@@ -8,8 +8,6 @@#include "migration/vmstate.h" #if TARGET_LONG_BITS ==64 -#define qemu_put_betl qemu_put_be64 -#define qemu_get_betl qemu_get_be64#define qemu_put_betls qemu_put_be64s#define qemu_get_betls qemu_get_be64s
@@ -21,8 +19,6 @@ VMSTATE_UINT64_SUB_ARRAY(_f, _s, _start, _num)#define vmstate_info_uinttl vmstate_info_uint64#else -#define qemu_put_betl qemu_put_be32 -#define qemu_get_betl qemu_get_be32#define qemu_put_betls qemu_put_be32s#define qemu_get_betls qemu_get_be32s
target/sparc/machine.c +13 -4
@@ -1,8 +1,10 @@#include "qemu/osdep.h" #include "cpu.h" +#include "qemu/target-info.h" #include "qemu/timer.h" #include "migration/cpu.h" +#include "migration/qemu-file-types.h" #ifdef TARGET_SPARC64 static const VMStateDescription vmstate_cpu_timer = {
@@ -86,9 +88,13 @@ static int get_fsr(QEMUFile *f, void *opaque, size_t size, const VMStateField *field) {SPARCCPU *cpu = opaque; -target_ulong val =qemu_get_betl (f); -cpu_put_fsr (&cpu->env, val); +if (target_long_bits () ==64 ) { +cpu_put_fsr (&cpu->env,qemu_get_be64 (f)); + }else { +cpu_put_fsr (&cpu->env,qemu_get_be32 (f)); + } +return 0 ; }
@@ -96,9 +102,12 @@ static int put_fsr(QEMUFile *f, void *opaque, size_t size, const VMStateField *field, JSONWriter *vmdesc) { SPARCCPU *cpu = opaque; -target_ulong val =cpu_get_fsr (&cpu->env); -qemu_put_betl (f, val); +if (target_long_bits () ==64 ) { +qemu_put_be64 (f,cpu_get_fsr (&cpu->env)); + }else { +qemu_put_be32 (f,cpu_get_fsr (&cpu->env)); + }return 0 ; }
Signature · 1 line
2.53.0
Re: [PATCH-for-11.1 05/10] target/sparc: Inline qemu_get/put_betl()
Quoted 9 lines · Philippe Mathieu-Daudé
Use TargetInfo
target_long_bits()helper at runtime to migrate the FSR register as 32 or 64-bits.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/migration/cpu.h | 4 ---- target/sparc/machine.c | 17 +++++++++++++---- 2 files changed, 13 insertions(+), 8 deletions(-)
PATCH 6/10 target/mips: Inline qemu_get/put_betls()
In reply to Philippe Mathieu-DaudéUse TargetInfo target_long_bits() helper at runtime to migrate the VPN register as 32 or 64-bits.
--- include/migration/cpu.h | 6 ------ target/mips/system/machine.c | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 8 deletions(-)
include/migration/cpu.h +0 -6
@@ -8,9 +8,6 @@#include "migration/vmstate.h" #if TARGET_LONG_BITS ==64 -#define qemu_put_betls qemu_put_be64s -#define qemu_get_betls qemu_get_be64s -#define VMSTATE_UINTTL_V (_f, _s, _v) \ VMSTATE_UINT64_V(_f, _s, _v)#define VMSTATE_UINTTL_ARRAY_V (_f, _s, _n, _v) \
@@ -19,9 +16,6 @@ VMSTATE_UINT64_SUB_ARRAY(_f, _s, _start, _num)#define vmstate_info_uinttl vmstate_info_uint64#else -#define qemu_put_betls qemu_put_be32s -#define qemu_get_betls qemu_get_be32s -#define VMSTATE_UINTTL_V (_f, _s, _v) \ VMSTATE_UINT32_V(_f, _s, _v)#define VMSTATE_UINTTL_ARRAY_V (_f, _s, _n, _v) \
target/mips/system/machine.c +12 -2
@@ -1,7 +1,9 @@#include "qemu/osdep.h" +#include "qemu/target-info.h" #include "cpu.h" #include "internal.h" #include "migration/cpu.h" +#include "migration/qemu-file-types.h" #include "fpu_helper.h" static int cpu_post_load (void *opaque,int version_id)
@@ -139,7 +141,11 @@ static int get_tlb(QEMUFile *f, void *pv, size_t size,r4k_tlb_t *v = pv;uint16_t flags; -qemu_get_betls (f, &v->VPN); +if (target_long_bits () ==64 ) { + v->VPN =qemu_get_be64 (f); + }else { + v->VPN =qemu_get_be32 (f); + }qemu_get_be32s (f, &v->PageMask);qemu_get_be16s (f, &v->ASID);qemu_get_be32s (f, &v->MMID);
@@ -182,7 +188,11 @@ static int put_tlb(QEMUFile *f, void *pv, size_t size, (v->D0 <<1 ) | (v->D1 << 0)); -qemu_put_betls (f, &v->VPN); +if (target_long_bits () ==64 ) { +qemu_put_be64 (f, v->VPN); + }else { +qemu_put_be32 (f, v->VPN); + }qemu_put_be32s (f, &v->PageMask);qemu_put_be16s (f, &asid);qemu_put_be32s (f, &mmid);
Signature · 1 line
2.53.0
Re: [PATCH-for-11.1 06/10] target/mips: Inline qemu_get/put_betls()
Quoted 9 lines · Philippe Mathieu-Daudé
Use TargetInfo
target_long_bits()helper at runtime to migrate the VPN register as 32 or 64-bits.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/migration/cpu.h | 6 ------ target/mips/system/machine.c | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 8 deletions(-)
PATCH 7/10 target/i386: Expand VMSTATE_UINTTL_SUB_ARRAY for APX registers
In reply to Philippe Mathieu-DaudéAPX registers are only migrated for 64-bit binaries, so VMSTATE_UINTTL_SUB_ARRAY() expands to VMSTATE_UINT64_SUB_ARRAY().
--- target/i386/machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/machine.c +1 -1
@@ -1756,7 +1756,7 @@ static const VMStateDescription vmstate_apx = { .minimum_version_id = 1, .needed = apx_needed, .fields = (VMStateField[]) { -VMSTATE_UINTTL_SUB_ARRAY (env.regs,X86CPU ,CPU_NB_REGS , +VMSTATE_UINT64_SUB_ARRAY (env.regs,X86CPU ,CPU_NB_REGS ,CPU_NB_EREGS -CPU_NB_REGS ),VMSTATE_END_OF_LIST () }
Signature · 1 line
2.53.0
Re: [PATCH-for-11.1 07/10] target/i386: Expand VMSTATE_UINTTL_SUB_ARRAY for APX registers
Quoted 8 lines · Philippe Mathieu-Daudé
APX registers are only migrated for 64-bit binaries, so
VMSTATE_UINTTL_SUB_ARRAY()expands toVMSTATE_UINT64_SUB_ARRAY().Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH 8/10 target/i386: Inline VMSTATE_UINTTL_SUB_ARRAY() macro
In reply to Philippe Mathieu-DaudéThe x86 target is the single one using the VMSTATE_UINTTL_SUB_ARRAY macro. Inline it to avoid further uses of this legacy macro on other targets.
--- include/migration/cpu.h | 4 ---- target/i386/machine.c | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-)
include/migration/cpu.h +0 -4
@@ -12,16 +12,12 @@ VMSTATE_UINT64_V(_f, _s, _v)#define VMSTATE_UINTTL_ARRAY_V (_f, _s, _n, _v) \ VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v) -#define VMSTATE_UINTTL_SUB_ARRAY (_f, _s, _start, _num) \ - VMSTATE_UINT64_SUB_ARRAY(_f, _s, _start, _num)#define vmstate_info_uinttl vmstate_info_uint64#else #define VMSTATE_UINTTL_V (_f, _s, _v) \ VMSTATE_UINT32_V(_f, _s, _v)#define VMSTATE_UINTTL_ARRAY_V (_f, _s, _n, _v) \ VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v) -#define VMSTATE_UINTTL_SUB_ARRAY (_f, _s, _start, _num) \ - VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num)#define vmstate_info_uinttl vmstate_info_uint32#endif
target/i386/machine.c +5 -1
@@ -1770,7 +1770,11 @@ const VMStateDescription vmstate_x86_cpu = { .pre_save = cpu_pre_save, .post_load = cpu_post_load, .fields = (const VMStateField[]) { -VMSTATE_UINTTL_SUB_ARRAY (env.regs,X86CPU ,0 ,CPU_NB_REGS ), +#if TARGET_LONG_BITS == 64 + VMSTATE_UINT64_SUB_ARRAY(env.regs, X86CPU, 0, CPU_NB_REGS), +#else + VMSTATE_UINT32_SUB_ARRAY(env.regs, X86CPU, 0, CPU_NB_REGS), +#endif VMSTATE_UINTTL(env.eip, X86CPU), VMSTATE_UINTTL(env.eflags, X86CPU), VMSTATE_UINT32(env.hflags, X86CPU),
Signature · 1 line
2.53.0
Re: [PATCH-for-11.1 08/10] target/i386: Inline VMSTATE_UINTTL_SUB_ARRAY() macro
Quoted 38 lines · Philippe Mathieu-Daudé
The x86 target is the single one using the
VMSTATE_UINTTL_SUB_ARRAYmacro. Inline it to avoid further uses of this legacy macro on other targets.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/migration/cpu.h | 4 ---- target/i386/machine.c | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-)include/migration/cpu.h +0
-4@@ -12,16 +12,12 @@ VMSTATE_UINT64_V(_f, _s, _v)#define VMSTATE_UINTTL_ARRAY_V (_f, _s, _n, _v) \ VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v) -#define VMSTATE_UINTTL_SUB_ARRAY (_f, _s, _start, _num) \ - VMSTATE_UINT64_SUB_ARRAY(_f, _s, _start, _num)#define vmstate_info_uinttl vmstate_info_uint64#else #define VMSTATE_UINTTL_V (_f, _s, _v) \ VMSTATE_UINT32_V(_f, _s, _v)#define VMSTATE_UINTTL_ARRAY_V (_f, _s, _n, _v) \ VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v) -#define VMSTATE_UINTTL_SUB_ARRAY (_f, _s, _start, _num) \ - VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num)#define vmstate_info_uinttl vmstate_info_uint32#endif target/i386/machine.c +0
-0@@ -1770,7 +1770,11 @@ const VMStateDescription vmstate_x86_cpu = { .pre_save = cpu_pre_save, .post_load = cpu_post_load,
target/i386/machine.c const VMStateDescription vmstate_x86_cpu = { · line 1780
Quoted 10 lines
target/i386/machine.c +5
-1.fields = (const VMStateField[]) { -VMSTATE_UINTTL_SUB_ARRAY (env.regs,X86CPU ,0 ,CPU_NB_REGS ), +#if TARGET_LONG_BITS == 64 + VMSTATE_UINT64_SUB_ARRAY(env.regs, X86CPU, 0, CPU_NB_REGS), +#else + VMSTATE_UINT32_SUB_ARRAY(env.regs, X86CPU, 0, CPU_NB_REGS), +#endif VMSTATE_UINTTL(env.eip, X86CPU), VMSTATE_UINTTL(env.eflags, X86CPU), VMSTATE_UINT32(env.hflags, X86CPU),
I think it would be better to exclude this patch, and treat VMSTATE_UINTTL_SUB_ARRAY with a generic approach, similar to what we talked about VMSTATE_UINTTL*.
In short, to add a field to VMStateField, with .target_long = true, that indicates to migration code that size should be read from .size / target_long_bits().
Regards,
Pierrick
PATCH 9/10 target/sparc: Replace VMSTATE_VARRAY_MULTIPLY -> VMSTATE_UINTTL_ARRAY
In reply to Philippe Mathieu-DaudéVMSTATE_VARRAY_MULTIPLY() seems to be an "optimized" version of VMSTATE_UINTTL_ARRAY(), and is only used once. Prefer the generic macro, removing the need for the VMS_MULTIPLY_ELEMENTS field.
Bump the SPARC CPU migration stream version.
--- include/migration/cpu.h | 2 -- include/migration/vmstate.h | 22 +++------------------- migration/vmstate.c | 4 ---- target/sparc/machine.c | 7 +++---- 4 files changed, 6 insertions(+), 29 deletions(-)
include/migration/cpu.h +0 -2
@@ -12,13 +12,11 @@ VMSTATE_UINT64_V(_f, _s, _v)#define VMSTATE_UINTTL_ARRAY_V (_f, _s, _n, _v) \ VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v) -#define vmstate_info_uinttl vmstate_info_uint64#else #define VMSTATE_UINTTL_V (_f, _s, _v) \ VMSTATE_UINT32_V(_f, _s, _v)#define VMSTATE_UINTTL_ARRAY_V (_f, _s, _n, _v) \ VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v) -#define vmstate_info_uinttl vmstate_info_uint32#endif #define VMSTATE_UINTTL (_f, _s) \
include/migration/vmstate.h +3 -19
@@ -94,7 +94,7 @@ enum VMStateFlags { VMS_ARRAY_OF_POINTER = 0x040,/* The field is an array of variable size. The uint16_t at opaque -* + VMStateField.num_offset (subject to VMS_MULTIPLY_ELEMENTS) +* + VMStateField.num_offset * contains the number of entries in the array. See the VMS_ARRAY * description regarding array handling in general. May not be * combined with VMS_ARRAY or any other VMS_VARRAY*. */
@@ -115,14 +115,14 @@ enum VMStateFlags {VMS_MULTIPLY =0x200 ,/* The field is an array of variable size. The uint8_t at opaque + -* VMStateField.num_offset (subject to VMS_MULTIPLY_ELEMENTS) +* VMStateField.num_offset * contains the number of entries in the array. See the VMS_ARRAY * description regarding array handling in general. May not be * combined with VMS_ARRAY or any other VMS_VARRAY*. */ VMS_VARRAY_UINT8 =0x400 ,/* The field is an array of variable size. The uint32_t at opaque -* + VMStateField.num_offset (subject to VMS_MULTIPLY_ELEMENTS) +* + VMStateField.num_offset * contains the number of entries in the array. See the VMS_ARRAY * description regarding array handling in general. May not be * combined with VMS_ARRAY or any other VMS_VARRAY*. */
@@ -139,12 +139,6 @@ enum VMStateFlags {* cause the individual entries to be allocated. */ VMS_ALLOC = 0x2000, -/* Multiply the number of entries given by the integer at opaque + -* VMStateField.num_offset (see VMS_VARRAY*) with VMStateField.num -* to determine the number of entries in the array. Only valid in -* combination with one of VMS_VARRAY*. */ - VMS_MULTIPLY_ELEMENTS = 0x4000, -/* A structure field that is like VMS_STRUCT, but uses * VMStateField.struct_version_id to tell which version of the * structure we are referencing to use. */
@@ -398,16 +392,6 @@ extern const VMStateInfo vmstate_info_qlist; .offset = vmstate_offset_2darray(_state, _field, _type, _n1, _n2), \ } -#define VMSTATE_VARRAY_MULTIPLY (_field, _state, _field_num, _multiply, _info, _type) { \ - .name = (stringify(_field)), \ - .num_offset = vmstate_offset_value(_state, _field_num, uint32_t),\ - .num = (_multiply), \ - .info = &(_info), \ - .size = sizeof(_type), \ - .flags = VMS_VARRAY_UINT32|VMS_MULTIPLY_ELEMENTS, \ - .offset = vmstate_offset_varray(_state, _field, _type), \ -} -#define VMSTATE_SUB_ARRAY (_field, _state, _start, _num, _version, _info, _type) { \ .name = (stringify(_field)), \ .version_id = (_version), \
migration/vmstate.c +0 -4
@@ -97,10 +97,6 @@ static int vmstate_n_elems(void *opaque, const VMStateField *field) n_elems = *(uint8_t *)(opaque + field->num_offset); } -if (field->flags &VMS_MULTIPLY_ELEMENTS ) { - n_elems *= field->num; - } -trace_vmstate_n_elems (field->name, n_elems);return n_elems; }
target/sparc/machine.c +3 -4
@@ -189,9 +189,9 @@ static int cpu_pre_save(void *opaque)* versions are different. */ #ifndef TARGET_SPARC64 -#define SPARC_VMSTATE_VER 7 +#define SPARC_VMSTATE_VER 8#else -#define SPARC_VMSTATE_VER 9 +#define SPARC_VMSTATE_VER 10#endif const VMStateDescription vmstate_sparc_cpu = {
@@ -202,8 +202,7 @@ const VMStateDescription vmstate_sparc_cpu = { .fields = (const VMStateField[]) {VMSTATE_UINTTL_ARRAY (env.gregs,SPARCCPU ,8 ),VMSTATE_UINT32 (env.nwindows,SPARCCPU ), -VMSTATE_VARRAY_MULTIPLY (env.regbase,SPARCCPU , env.nwindows,16 , - vmstate_info_uinttl, target_ulong), +VMSTATE_UINTTL_ARRAY (env.regbase,SPARCCPU ,MAX_NWINDOWS *16 +8 ),VMSTATE_CPUDOUBLE_ARRAY (env.fpr,SPARCCPU ,TARGET_DPREGS ),VMSTATE_UINTTL (env.pc,SPARCCPU ),VMSTATE_UINTTL (env.npc,SPARCCPU ),
Signature · 1 line
2.53.0
Re: [PATCH-for-11.1 09/10] target/sparc: Replace VMSTATE_VARRAY_MULTIPLY -> VMSTATE_UINTTL_ARRAY
Quoted 7 lines · Philippe Mathieu-Daudé
VMSTATE_VARRAY_MULTIPLY()seems to be an "optimized" version ofVMSTATE_UINTTL_ARRAY(), and is only used once. Prefer the generic macro, removing the need for theVMS_MULTIPLY_ELEMENTSfield.Bump the SPARC CPU migration stream version.
Quoted 8 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/migration/cpu.h | 2 -- include/migration/vmstate.h | 22 +++------------------- migration/vmstate.c | 4 ---- target/sparc/machine.c | 7 +++---- 4 files changed, 6 insertions(+), 29 deletions(-)
PATCH 10/10 migration: Restrict legacy VMSTATE_UINTTL() macros to few targets
In reply to Philippe Mathieu-DaudéOnly 5 base targets use VMSTATE_UINTTL (MIPS, PPC, X86, SPARC and RISCV). In order to build a single binary (preliminary step toward heterogeneous emulation) we need to remove it, but it will take some time. Add a temporary TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API definition to keep targets not using these macros clean while we keep cleaning the last few targets one by one, preventing legacy uses to creep back in.
--- configs/targets/i386-softmmu.mak | 1 + configs/targets/mips-softmmu.mak | 1 + configs/targets/mips64-softmmu.mak | 1 + configs/targets/mips64el-softmmu.mak | 1 + configs/targets/mipsel-softmmu.mak | 1 + configs/targets/ppc-softmmu.mak | 1 + configs/targets/ppc64-softmmu.mak | 1 + configs/targets/riscv32-softmmu.mak | 1 + configs/targets/riscv64-softmmu.mak | 1 + configs/targets/sparc-softmmu.mak | 1 + configs/targets/sparc64-softmmu.mak | 1 + configs/targets/x86_64-softmmu.mak | 1 + include/migration/cpu.h | 24 +++++++++++------------- target/ppc/machine.c | 1 + scripts/make-config-poison.sh | 1 + 15 files changed, 25 insertions(+), 13 deletions(-)
configs/targets/i386-softmmu.mak +1 -0
@@ -4,3 +4,4 @@ TARGET_KVM_HAVE_RESET_PARKED_VCPU=y TARGET_XML_FILES= i386-32bit.xml TARGET_LONG_BITS=32 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=y
configs/targets/mips-softmmu.mak +1 -0
@@ -2,3 +2,4 @@ TARGET_ARCH=mips TARGET_BIG_ENDIAN=y TARGET_LONG_BITS=32 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=y
configs/targets/mips64-softmmu.mak +1 -0
@@ -3,3 +3,4 @@ TARGET_BASE_ARCH=mips TARGET_BIG_ENDIAN=y TARGET_LONG_BITS=64 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=y
configs/targets/mips64el-softmmu.mak +1 -0
@@ -2,3 +2,4 @@ TARGET_ARCH=mips64 TARGET_BASE_ARCH=mips TARGET_LONG_BITS=64 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=y
configs/targets/mipsel-softmmu.mak +1 -0
@@ -1,3 +1,4 @@ TARGET_ARCH=mips TARGET_LONG_BITS=32 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=y
configs/targets/ppc-softmmu.mak +1 -0
@@ -3,3 +3,4 @@ TARGET_BIG_ENDIAN=y TARGET_KVM_HAVE_GUEST_DEBUG=y TARGET_XML_FILES= power-core.xml power-fpu.xml power-altivec.xml power-spe.xml TARGET_LONG_BITS=32 +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=y
configs/targets/ppc64-softmmu.mak +1 -0
@@ -6,3 +6,4 @@ TARGET_XML_FILES= power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml # all boards require libfdt TARGET_NEED_FDT=y TARGET_LONG_BITS=64 +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=y
configs/targets/riscv32-softmmu.mak +1 -0
@@ -5,3 +5,4 @@ TARGET_XML_FILES= riscv-32bit-cpu.xml riscv-32bit-fpu.xml riscv-64bit-fpu.xml ri TARGET_NEED_FDT=y TARGET_LONG_BITS=32 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=y
configs/targets/riscv64-softmmu.mak +1 -0
@@ -6,3 +6,4 @@ TARGET_XML_FILES= riscv-64bit-cpu.xml riscv-32bit-fpu.xml riscv-64bit-fpu.xml ri TARGET_NEED_FDT=y TARGET_LONG_BITS=64 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=y
configs/targets/sparc-softmmu.mak +1 -0
@@ -4,3 +4,4 @@ TARGET_XML_FILES=sparc32-cpu.xml sparc32-fpu.xml sparc32-cp0.xml TARGET_LONG_BITS=32 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=y +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=y
configs/targets/sparc64-softmmu.mak +1 -0
@@ -5,3 +5,4 @@ TARGET_XML_FILES=sparc64-cpu.xml sparc64-fpu.xml sparc64-cp0.xml TARGET_LONG_BITS=64 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=y +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=y
configs/targets/x86_64-softmmu.mak +1 -0
@@ -5,3 +5,4 @@ TARGET_KVM_HAVE_RESET_PARKED_VCPU=y TARGET_XML_FILES= i386-64bit.xml i386-64bit-apx.xml TARGET_LONG_BITS=64 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=y
include/migration/cpu.h +11 -13
@@ -3,25 +3,23 @@#ifndef MIGRATION_CPU_H #define MIGRATION_CPU_H +#ifdef TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API +#include "exec/cpu-defs.h" -#include "migration/qemu-file-types.h" #include "migration/vmstate.h" #if TARGET_LONG_BITS ==64 -#define VMSTATE_UINTTL_V (_f, _s, _v) \ - VMSTATE_UINT64_V(_f, _s, _v) -#define VMSTATE_UINTTL_ARRAY_V (_f, _s, _n, _v) \ - VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v) +#define VMSTATE_UINTTL (_f, _s) \ + VMSTATE_UINT64_V(_f, _s, 0) +#define VMSTATE_UINTTL_ARRAY (_f, _s, _n) \ + VMSTATE_UINT64_ARRAY_V(_f, _s, _n, 0)#else -#define VMSTATE_UINTTL_V (_f, _s, _v) \ - VMSTATE_UINT32_V(_f, _s, _v) -#define VMSTATE_UINTTL_ARRAY_V (_f, _s, _n, _v) \ - VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v) +#define VMSTATE_UINTTL (_f, _s) \ + VMSTATE_UINT32_V(_f, _s, 0) +#define VMSTATE_UINTTL_ARRAY (_f, _s, _n) \ + VMSTATE_UINT32_ARRAY_V(_f, _s, _n, 0)#endif -#define VMSTATE_UINTTL (_f, _s) \ - VMSTATE_UINTTL_V(_f, _s, 0) -#define VMSTATE_UINTTL_ARRAY (_f, _s, _n) \ - VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, 0) +#endif /* TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API */ #endif
target/ppc/machine.c +1 -0
@@ -5,6 +5,7 @@#include "helper_regs.h" #include "mmu-hash64.h" #include "migration/cpu.h" +#include "migration/qemu-file-types.h" #include "qapi/error.h" #include "kvm_ppc.h" #include "power8-pmu.h"
scripts/make-config-poison.sh +1 -0
@@ -12,6 +12,7 @@ exec sed -n \ -e '/CONFIG_SOFTMMU/d' \ -e '/TARGET_NOT_USING_LEGACY_LDST_PHYS_API/d' \ -e '/TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API/d' \ + -e '/TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API/d' \ -e '/^#define / {' \ -e 's///' \ -e 's/ .*//' \
Signature · 1 line
2.53.0
Re: [PATCH-for-11.1 10/10] migration: Restrict legacy VMSTATE_UINTTL() macros to few targets
Quoted 32 lines · Philippe Mathieu-Daudé
Only 5 base targets use
VMSTATE_UINTTL(MIPS, PPC, X86, SPARC and RISCV). In order to build a single binary (preliminary step toward heterogeneous emulation) we need to remove it, but it will take some time. Add a temporaryTARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_APIdefinition to keep targets not using these macros clean while we keep cleaning the last few targets one by one, preventing legacy uses to creep back in.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/migration/cpu.h | 24 +++++++++++------------- target/ppc/machine.c | 1 +include/migration/cpu.h +0
-1@@ -3,25 +3,23 @@#ifndef MIGRATION_CPU_H #define MIGRATION_CPU_H #include "exec/cpu-defs.h" -#include "migration/qemu-file-types.h" #include "migration/vmstate.h" target/ppc/machine.c +0
-0
target/ppc/machine.c line 11
Quoted 7 lines
target/ppc/machine.c +1
-0@@ -5,6 +5,7 @@#include "helper_regs.h" #include "mmu-hash64.h" #include "migration/cpu.h" +#include "migration/qemu-file-types.h" #include "qapi/error.h" #include "kvm_ppc.h" #include "power8-pmu.h"
Oops, this change is part of patch #6 "Inline qemu_get/put_betls()".
Re: [PATCH-for-11.1 10/10] migration: Restrict legacy VMSTATE_UINTTL() macros to few targets
In reply to Philippe Mathieu-DaudéQuoted 193 lines · Philippe Mathieu-Daudé
Only 5 base targets use
VMSTATE_UINTTL(MIPS, PPC, X86, SPARC and RISCV). In order to build a single binary (preliminary step toward heterogeneous emulation) we need to remove it, but it will take some time. Add a temporaryTARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_APIdefinition to keep targets not using these macros clean while we keep cleaning the last few targets one by one, preventing legacy uses to creep back in.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- configs/targets/i386-softmmu.mak | 1 + configs/targets/mips-softmmu.mak | 1 + configs/targets/mips64-softmmu.mak | 1 + configs/targets/mips64el-softmmu.mak | 1 + configs/targets/mipsel-softmmu.mak | 1 + configs/targets/ppc-softmmu.mak | 1 + configs/targets/ppc64-softmmu.mak | 1 + configs/targets/riscv32-softmmu.mak | 1 + configs/targets/riscv64-softmmu.mak | 1 + configs/targets/sparc-softmmu.mak | 1 + configs/targets/sparc64-softmmu.mak | 1 + configs/targets/x86_64-softmmu.mak | 1 + include/migration/cpu.h | 24 +++++++++++------------- target/ppc/machine.c | 1 + scripts/make-config-poison.sh | 1 + 15 files changed, 25 insertions(+), 13 deletions(-)configs/targets/i386-softmmu.mak +1
-0@@ -4,3 +4,4 @@ TARGET_KVM_HAVE_RESET_PARKED_VCPU=y TARGET_XML_FILES= i386-32bit.xml TARGET_LONG_BITS=32 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=yconfigs/targets/mips-softmmu.mak +1
-0@@ -2,3 +2,4 @@ TARGET_ARCH=mips TARGET_BIG_ENDIAN=y TARGET_LONG_BITS=32 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=yconfigs/targets/mips64-softmmu.mak +1
-0@@ -3,3 +3,4 @@ TARGET_BASE_ARCH=mips TARGET_BIG_ENDIAN=y TARGET_LONG_BITS=64 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=yconfigs/targets/mips64el-softmmu.mak +1
-0@@ -2,3 +2,4 @@ TARGET_ARCH=mips64 TARGET_BASE_ARCH=mips TARGET_LONG_BITS=64 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=yconfigs/targets/mipsel-softmmu.mak +1
-0@@ -1,3 +1,4 @@ TARGET_ARCH=mips TARGET_LONG_BITS=32 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=yconfigs/targets/ppc-softmmu.mak +1
-0@@ -3,3 +3,4 @@ TARGET_BIG_ENDIAN=y TARGET_KVM_HAVE_GUEST_DEBUG=y TARGET_XML_FILES= power-core.xml power-fpu.xml power-altivec.xml power-spe.xml TARGET_LONG_BITS=32 +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=yconfigs/targets/ppc64-softmmu.mak +1
-0@@ -6,3 +6,4 @@ TARGET_XML_FILES= power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml # all boards require libfdt TARGET_NEED_FDT=y TARGET_LONG_BITS=64 +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=yconfigs/targets/riscv32-softmmu.mak +1
-0@@ -5,3 +5,4 @@ TARGET_XML_FILES= riscv-32bit-cpu.xml riscv-32bit-fpu.xml riscv-64bit-fpu.xml ri TARGET_NEED_FDT=y TARGET_LONG_BITS=32 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=yconfigs/targets/riscv64-softmmu.mak +1
-0@@ -6,3 +6,4 @@ TARGET_XML_FILES= riscv-64bit-cpu.xml riscv-32bit-fpu.xml riscv-64bit-fpu.xml ri TARGET_NEED_FDT=y TARGET_LONG_BITS=64 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=yconfigs/targets/sparc-softmmu.mak +1
-0@@ -4,3 +4,4 @@ TARGET_XML_FILES=sparc32-cpu.xml sparc32-fpu.xml sparc32-cp0.xml TARGET_LONG_BITS=32 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=y +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=yconfigs/targets/sparc64-softmmu.mak +1
-0@@ -5,3 +5,4 @@ TARGET_XML_FILES=sparc64-cpu.xml sparc64-fpu.xml sparc64-cp0.xml TARGET_LONG_BITS=64 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=y +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=yconfigs/targets/x86_64-softmmu.mak +1
-0@@ -5,3 +5,4 @@ TARGET_KVM_HAVE_RESET_PARKED_VCPU=y TARGET_XML_FILES= i386-64bit.xml i386-64bit-apx.xml TARGET_LONG_BITS=64 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y +TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API=yinclude/migration/cpu.h +11
-13@@ -3,25 +3,23 @@#ifndef MIGRATION_CPU_H #define MIGRATION_CPU_H +#ifdef TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API +#include "exec/cpu-defs.h" -#include "migration/qemu-file-types.h" #include "migration/vmstate.h" #if TARGET_LONG_BITS ==64 -#define VMSTATE_UINTTL_V (_f, _s, _v) \ - VMSTATE_UINT64_V(_f, _s, _v) -#define VMSTATE_UINTTL_ARRAY_V (_f, _s, _n, _v) \ - VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v) +#define VMSTATE_UINTTL (_f, _s) \ + VMSTATE_UINT64_V(_f, _s, 0) +#define VMSTATE_UINTTL_ARRAY (_f, _s, _n) \ + VMSTATE_UINT64_ARRAY_V(_f, _s, _n, 0)#else -#define VMSTATE_UINTTL_V (_f, _s, _v) \ - VMSTATE_UINT32_V(_f, _s, _v) -#define VMSTATE_UINTTL_ARRAY_V (_f, _s, _n, _v) \ - VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v) +#define VMSTATE_UINTTL (_f, _s) \ + VMSTATE_UINT32_V(_f, _s, 0) +#define VMSTATE_UINTTL_ARRAY (_f, _s, _n) \ + VMSTATE_UINT32_ARRAY_V(_f, _s, _n, 0)#endif -#define VMSTATE_UINTTL (_f, _s) \ - VMSTATE_UINTTL_V(_f, _s, 0) -#define VMSTATE_UINTTL_ARRAY (_f, _s, _n) \ - VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, 0) +#endif /* TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API */ #endif target/ppc/machine.c +1
-0@@ -5,6 +5,7 @@#include "helper_regs.h" #include "mmu-hash64.h" #include "migration/cpu.h" +#include "migration/qemu-file-types.h" #include "qapi/error.h" #include "kvm_ppc.h" #include "power8-pmu.h" scripts/make-config-poison.sh +0
-0
scripts/make-config-poison.sh exec sed -n \ · line 18
Quoted 7 lines
scripts/make-config-poison.sh +1
-0@@ -12,6 +12,7 @@ exec sed -n \ -e '/CONFIG_SOFTMMU/d' \ -e '/TARGET_NOT_USING_LEGACY_LDST_PHYS_API/d' \ -e '/TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API/d' \ + -e '/TARGET_USING_LEGACY_MIGRATION_VMSTATE_UINTTL_API/d' \ -e '/^#define / {' \ -e 's///' \ -e 's/ .*//' \
I'm not sure it's needed to have this flag.
Indeed, it's not possible to eradicate VMSTATE_UINTTL because of retrocompatibility, so it will never be completely removed. Thus, you can leave it as it is and implement the hint mentioned on Patch 8, which is retrocompatible by design.
With this, no change will be needed in target code, and only migration and include/migration/cpu.h will need a change.
Regards,
Pierrick
Quoted 9 lines · Philippe Mathieu-Daudé
Philippe Mathieu-Daudé (10):
target/avr: Avoid target-specific migration headers inmachine.ctarget/loongarch: Avoid target-specific migration headers inmachine.c
migration: Revert "AddVMSTATE_UINTTL_2DARRAY()"
migration: Remove unused target-specific macros target/sparc: Inline qemu_get/put_betl()
target/mips: Inline qemu_get/put_betls()
target/i386: ExpandVMSTATE_UINTTL_SUB_ARRAYfor APX registers target/sparc: ReplaceVMSTATE_VARRAY_MULTIPLY->VMSTATE_UINTTL_ARRAY
Patches 1-7 & 9 queued, thanks.