VMState port of all cpus
cover VMState port of all cpus
Hi
This series port all cpus to use vmstate.
- 1st patch is a fix of vmstate.
- I discussed the arm changes over irc with Peter, he agreed that some simplification could be good, but he didn't saw the patches O:-)
- mips: no pci chipset has been ported, so migration don't work there. I have embedded a couple of structs to improve vmstate checking. Notice that they were always allocated, so there shouldn't be any problem.
- sparc: I changed the format a little bit to be able to use normal arrays.
- sparc: If we always send the whole register windows, we don't need VMSTATE_VARRAY_MULTIPLY. As that array is quite big (520 elements), I am not sure what is best.
- cpsr_vmstate on arm: I am not sure if I could "abuse" uncached_cpsr for that purpose?
I have only tested on x86, for the rest, I double checked, but it is possible that I missed something. I expect all patches to be integrated by Anthony in one go. Architecture maintainers are CC'd for an ACK/NACK/comments.
Please, review.
PD. Is there an easy way of creating this "CC" list of mail addresses,
or the only way is to edit comments and write it by hand as I did?
Juan Quintela (25):
vmstate: Fix VMSTATE_VARRAY_UINT32
vmstate: Simplify test for CPU_SAVE_VERSION
vmstate: make all architectures export a way to migrate cpu's
vmstate: unicore32 don't support cpu migration
vmstate: use new cpu style for x86
vmstate: use new style for lm32 cpus
vmstate: make microblaze cpus not migrateable
vmstate: port cris cpu to vmstate
vmstate: machine.c is only compiled for !CONFIG_USER_ONLY
vmstate: introduce float32 arrays
vmstate: introduce float64 arrays
vmstate: Introduce VMSTATE_STRUCT_VARRAY_INT32_TEST
vmstate: port ppc cpu
vmstate: introduce VMSTATE_VARRAY_MULTIPLY
vmstate: define vmstate_info_uinttls
vmstate: port sparc cpu
vmstate: make incompatible change for sparc
mips_fulong2e: cpu vmstate already registered in cpu_exec_init
mips: make mvp an embedded struct instead of pointer
mips: make tlb an embedded struct instead of a pointer
mips: bump migration version to 4
vmstate: port mips cpu
arm: save always 32 fpu registers
vmstate: port arm cpu
vmstate: all cpus converted
exec.c | 7 +- hw/hw.h | 34 +++ hw/mips_fulong2e.c | 1 - hw/mips_malta.c | 4 +- hw/mips_timer.c | 2 +- hw/sun4u.c | 20 -- qemu-common.h | 4 - savevm.c | 68 ++++++ target-alpha/machine.c | 12 +- target-arm/cpu.h | 4 +- target-arm/machine.c | 350 +++++++++++++------------------ target-cris/cpu.h | 13 +- target-cris/machine.c | 138 +++++-------- target-i386/cpu.h | 2 - target-i386/machine.c | 14 +- target-lm32/cpu.h | 2 - target-lm32/machine.c | 14 +- target-m68k/machine.c | 10 + target-microblaze/cpu.h | 2 - target-microblaze/machine.c | 15 +- target-mips/cpu.h | 10 +- target-mips/helper.c | 30 ++- target-mips/machine.c | 468 ++++++++++++++++------------------------- target-mips/op_helper.c | 70 ++++--- target-mips/translate.c | 22 ++- target-mips/translate_init.c | 36 ++-- target-ppc/cpu.h | 4 +- target-ppc/machine.c | 253 ++++++++--------------- target-s390x/machine.c | 14 +- target-sh4/machine.c | 10 + target-sparc/cpu.h | 8 +- target-sparc/machine.c | 328 +++++++++++------------------ target-unicore32/cpu.h | 2 - target-xtensa/machine.c | 14 +- 34 files changed, 852 insertions(+), 1133 deletions(-)
Signature · 1 line
1.7.6.4
PATCH 1/25 vmstate: Fix VMSTATE_VARRAY_UINT32
We didn't saved elemnts with that size (brown paper bag for me).
--- savevm.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
savevm.c +2 -0
@@ -1457,6 +1457,8 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, n_elems = field->num; }else if (field->flags &VMS_VARRAY_INT32 ) { n_elems = *(int32_t *)(opaque+field->num_offset); + }else if (field->flags &VMS_VARRAY_UINT32 ) { + n_elems = *(uint32_t *)(opaque+field->num_offset); }else if (field->flags &VMS_VARRAY_UINT16 ) { n_elems = *(uint16_t *)(opaque+field->num_offset); }else if (field->flags &VMS_VARRAY_UINT8 ) {
Signature · 1 line
1.7.6.4
PATCH 2/25 vmstate: Simplify test for CPU_SAVE_VERSION
In reply to Juan QuintelaSome cpu's definitions define CPU_SAVE_VERSION, others not, but they have defined cpu_save/load.
--- exec.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
exec.c +4 -2
@@ -591,7 +591,7 @@ void cpu_exec_init_all(void)#endif } -#if defined(CPU_SAVE_VERSION ) && !defined(CONFIG_USER_ONLY ) +#if !defined(CONFIG_USER_ONLY )static int cpu_common_post_load (void *opaque,int version_id) {
@@ -658,11 +658,13 @@ void cpu_exec_init(CPUState *env)#if defined(CONFIG_USER_ONLY )cpu_list_unlock ();#endif -#if defined(CPU_SAVE_VERSION ) && !defined(CONFIG_USER_ONLY ) +#if !defined(CONFIG_USER_ONLY )vmstate_register (NULL , cpu_index, &vmstate_cpu_common, env); +#if defined(CPU_SAVE_VERSION )register_savevm (NULL ,"cpu" , cpu_index,CPU_SAVE_VERSION , cpu_save, cpu_load, env);#endif +#endif }/* Allocate a new translation block. Flush the translation buffer if
Signature · 1 line
1.7.6.4
PATCH 3/25 vmstate: make all architectures export a way to migrate cpu's
In reply to Juan QuintelaThis makes several changes:
- exports VMStateDescription vmstate_cpu non-static.
- makes sure that every cpu has a vmstate_cpu or cpu_save/load defined
- for the architecture that had nothing, it just register the cpu as unmigratable.
- Depending on CPU_SAVE_VERSION we register old/new migration style
--- exec.c | 2 ++ hw/hw.h | 2 ++ target-alpha/machine.c | 12 +----------- target-i386/machine.c | 2 +- target-lm32/machine.c | 2 +- target-m68k/machine.c | 10 ++++++++++ target-s390x/machine.c | 14 ++++++-------- target-sh4/machine.c | 10 ++++++++++ target-xtensa/machine.c | 14 ++++++-------- 9 files changed, 39 insertions(+), 29 deletions(-)
exec.c +2 -0
@@ -663,6 +663,8 @@ void cpu_exec_init(CPUState *env)#if defined(CPU_SAVE_VERSION )register_savevm (NULL ,"cpu" , cpu_index,CPU_SAVE_VERSION , cpu_save, cpu_load, env); +#else +vmstate_register (NULL , cpu_index, &vmstate_cpu, env);#endif #endif }
hw/hw.h +2 -0
@@ -359,6 +359,8 @@ extern const VMStateInfo vmstate_info_ptimer;extern const VMStateInfo vmstate_info_buffer;extern const VMStateInfo vmstate_info_unused_buffer; +extern const VMStateDescription vmstate_cpu; +#define type_check_array (t1,t2,n) ((t1(*)[n])0 - (t2*)0)#define type_check_pointer (t1,t2) ((t1**)0 - (t2*)0)
target-alpha/machine.c +1 -11
@@ -68,20 +68,10 @@ static VMStateField vmstate_cpu_fields[] = { VMSTATE_END_OF_LIST() }; -static const VMStateDescription vmstate_cpu = { +const VMStateDescription vmstate_cpu = { .name ="cpu" , .version_id =1 , .minimum_version_id =1 , .minimum_version_id_old =1 , .fields = vmstate_cpu_fields, }; - -void cpu_save (QEMUFile *f,void *opaque) -{ -vmstate_save_state (f, &vmstate_cpu, opaque); -} - -int cpu_load (QEMUFile *f,void *opaque,int version_id) -{ -return vmstate_load_state (f, &vmstate_cpu, opaque, version_id); -}
target-i386/machine.c +1 -1
@@ -310,7 +310,7 @@ static const VMStateDescription vmstate_fpop_ip_dp = { } }; -static const VMStateDescription vmstate_cpu = { +const VMStateDescription vmstate_cpu = { .name ="cpu" , .version_id =CPU_SAVE_VERSION , .minimum_version_id =3 ,
target-lm32/machine.c +1 -1
@@ -1,7 +1,7 @@#include "hw/hw.h" #include "hw/boards.h" -static const VMStateDescription vmstate_cpu = { +const VMStateDescription vmstate_cpu = { .name ="cpu" , .version_id =CPU_SAVE_VERSION , .minimum_version_id =1 ,
target-m68k/machine.c +10 -0
@@ -0,0 +1,10 @@ + +#include "hw/hw.h" + +/* To make this architecture migratable, we need to define cpu state +here. Other things need to be done elsewhere */ + +const VMStateDescription vmstate_cpu = { + .name ="cpu" , + .unmigratable =1 , +};
target-s390x/machine.c +6 -8
@@ -18,13 +18,11 @@*/ #include "hw/hw.h" -#include "hw/boards.h" -void cpu_save (QEMUFile *f,void *opaque) -{ -} +/* To make this architecture migratable, we need to define cpu state +here. Other things need to be done elsewhere */ -int cpu_load (QEMUFile *f,void *opaque,int version_id) -{ -return 0 ; -} +const VMStateDescription vmstate_cpu = { + .name ="cpu" , + .unmigratable =1 , +};
target-sh4/machine.c +10 -0
@@ -0,0 +1,10 @@ + +#include "hw/hw.h" + +/* To make this architecture migratable, we need to define cpu state +here. Other things need to be done elsewhere */ + +const VMStateDescription vmstate_cpu = { + .name ="cpu" , + .unmigratable =1 , +};
target-xtensa/machine.c +6 -8
@@ -26,13 +26,11 @@*/ #include "hw/hw.h" -#include "hw/boards.h" -void cpu_save (QEMUFile *f,void *opaque) -{ -} +/* To make this architecture migratable, we need to define cpu state +here. Other things need to be done elsewhere */ -int cpu_load (QEMUFile *f,void *opaque,int version_id) -{ -return 0 ; -} +const VMStateDescription vmstate_cpu = { + .name ="cpu" , + .unmigratable =1 , +};
Signature · 1 line
1.7.6.4
Re: [Qemu-devel] [PATCH 03/25] vmstate: make all architectures export a way to migrate cpu's
Am 25.10.2011 16:00, schrieb Juan Quintela:
Quoted 7 lines
This makes several changes:
- exports VMStateDescriptionvmstate_cpunon-static.
- makes sure that every cpu has avmstate_cpuor cpu_save/load defined
- for the architecture that had nothing, it just register the cpu as unmigratable.
- Depending onCPU_SAVE_VERSIONwe register old/new migration styleSigned-off-by Juan Quintela <[email protected]>
I like that move in general.
Quoted 5 lines
target-m68k/machine.c +0
-0
target-m68k/machine.c line 10
Quoted 10 lines
target-m68k/machine.c +10
-0@@ -0,0 +1,10 @@ + +#include "hw/hw.h" + +/* To make this architecture migratable, we need to define cpu state +here. Other things need to be done elsewhere */ + +const VMStateDescription vmstate_cpu = { + .name ="cpu" , + .unmigratable =1 , +};
Here ...
Quoted 5 lines
target-sh4/machine.c +0
-0
target-sh4/machine.c line 10
Quoted 10 lines
target-sh4/machine.c +10
-0@@ -0,0 +1,10 @@ + +#include "hw/hw.h" + +/* To make this architecture migratable, we need to define cpu state +here. Other things need to be done elsewhere */ + +const VMStateDescription vmstate_cpu = { + .name ="cpu" , + .unmigratable =1 , +};
... and here you sort-of create new files (empty before) without a license header. The contents is trivial right now, but it would get a case for the Wiki trying to figure out what license to put on other people's code.
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH 03/25] vmstate: make all architectures export a way to migrate cpu's
Quoted 41 lines · Andreas Färber
Am 25.10.2011 16:00, schrieb Juan Quintela:
Quoted 7 lines
This makes several changes:
- exports VMStateDescriptionvmstate_cpunon-static.
- makes sure that every cpu has avmstate_cpuor cpu_save/load defined
- for the architecture that had nothing, it just register the cpu as unmigratable.
- Depending onCPU_SAVE_VERSIONwe register old/new migration styleSigned-off-by Juan Quintela <[email protected]>I like that move in general.
Quoted 5 lines
target-m68k/machine.c +0
-0target-m68k/machine.c line 10
Quoted 10 lines
target-m68k/machine.c +10
-0@@ -0,0 +1,10 @@ + +#include "hw/hw.h" + +/* To make this architecture migratable, we need to define cpu state +here. Other things need to be done elsewhere */ + +const VMStateDescription vmstate_cpu = { + .name ="cpu" , + .unmigratable =1 , +};Here ...
Quoted 12 lines
target-sh4/machine.c +7
-0@@ -0,0 +1,10 @@ + +#include "hw/hw.h" + +/* To make this architecture migratable, we need to define cpu state +here. Other things need to be done elsewhere */ + +const VMStateDescription vmstate_cpu = {
Quoted 8 lines
target-sh4/machine.c line 10
Quoted 3 lines
target-sh4/machine.c +3
-0+ .name = "cpu", + .unmigratable = 1, +};... and here you sort-of create new files (empty before) without a license header. The contents is trivial right now, but it would get a case for the Wiki trying to figure out what license to put on other people's code.
None of target-*/machine.c files have a license line. I can put the normal boilerplate on them, but I have just transformed them, So .. who should I put as copyright owner? Puting me is (at least) a bit presumptuous, if not just plain false O:-)
Later, Juan.
Re: [Qemu-devel] [PATCH 03/25] vmstate: make all architectures export a way to migrate cpu's
Am 25.10.2011 17:50, schrieb Juan Quintela:
Quoted 40 lines
Quoted 30 lines · Andreas Färber
Quoted 5 lines
target-m68k/machine.c +0
-0target-m68k/machine.c line 10
Quoted 10 lines
target-m68k/machine.c +10
-0@@ -0,0 +1,10 @@ + +#include "hw/hw.h" + +/* To make this architecture migratable, we need to define cpu state +here. Other things need to be done elsewhere */ + +const VMStateDescription vmstate_cpu = { + .name ="cpu" , + .unmigratable =1 , +};Here ...
Quoted 12 lines
target-sh4/machine.c +7
-0@@ -0,0 +1,10 @@ + +#include "hw/hw.h" + +/* To make this architecture migratable, we need to define cpu state +here. Other things need to be done elsewhere */ + +const VMStateDescription vmstate_cpu = {Quoted 8 lines
target-sh4/machine.c line 10
Quoted 3 lines
target-sh4/machine.c +3
-0+ .name = "cpu", + .unmigratable = 1, +};... and here you sort-of create new files (empty before) without a license header. The contents is trivial right now, but it would get a case for the Wiki trying to figure out what license to put on other people's code.
Quoted 4 lines
None of
target-*/machine.cfiles have a license line. I can put the normal boilerplate on them, but I have just transformed them, So .. who should I put as copyright owner? Puting me is (at least) a bit presumptuous, if not just plain false O:-)
Note my comment was specific to those that you did not really transform.
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH 03/25] vmstate: make all architectures export a way to migrate cpu's
In reply to Juan QuintelaQuoted 7 lines
This makes several changes:
- exports VMStateDescriptionvmstate_cpunon-static.
- makes sure that every cpu has avmstate_cpuor cpu_save/load defined
- for the architecture that had nothing, it just register the cpu as unmigratable.
- Depending onCPU_SAVE_VERSIONwe register old/new migration styleSigned-off-by Juan Quintela <[email protected]>
[...snip...]
Quoted 15 lines
target-xtensa/machine.c +1
-4@@ -26,13 +26,11 @@*/ #include "hw/hw.h" -#include "hw/boards.h" -void cpu_save (QEMUFile *f,void *opaque) -{ -} +/* To make this architecture migratable, we need to define cpu state
target-xtensa/machine.c line 36
Quoted 10 lines
target-xtensa/machine.c +5
-4+here. Other things need to be done elsewhere */ -int cpu_load (QEMUFile *f,void *opaque,int version_id) -{ -return 0 ; -} +const VMStateDescription vmstate_cpu = { + .name ="cpu" , + .unmigratable =1 , +};
Thanks.
-- Max
Re: [Qemu-devel] [PATCH 03/25] vmstate: make all architectures export a way to migrate cpu's
In reply to Juan QuintelaQuoted 23 lines · Juan Quintela
This makes several changes:
- exports VMStateDescriptionvmstate_cpunon-static.
- makes sure that every cpu has avmstate_cpuor cpu_save/load defined
- for the architecture that had nothing, it just register the cpu as unmigratable.
- Depending onCPU_SAVE_VERSIONwe register old/new migration styleSigned-off-by Juan Quintela <[email protected]>CC Richard Henderson <[email protected]>CC Michael Walle <[email protected]>CC Paul Brook <[email protected]>CC Alexander Graf <[email protected]>CC Aurelien Jarno <[email protected]>CC Max Filippov <[email protected]>--- exec.c | 2 ++ hw/hw.h | 2 ++ target-alpha/machine.c | 12 +----------- target-i386/machine.c | 2 +- target-lm32/machine.c | 2 +- target-m68k/machine.c | 10 ++++++++++ target-s390x/machine.c | 14 ++++++-------- target-sh4/machine.c | 10 ++++++++++ target-xtensa/machine.c | 14 ++++++--------
...
Quoted 14 lines
target-alpha/machine.c +1
-1@@ -68,20 +68,10 @@ static VMStateField vmstate_cpu_fields[] = { VMSTATE_END_OF_LIST() }; -static const VMStateDescription vmstate_cpu = { +const VMStateDescription vmstate_cpu = { .name ="cpu" , .version_id =1 , .minimum_version_id =1 , .minimum_version_id_old =1 , .fields = vmstate_cpu_fields, };
target-alpha/machine.c static VMStateField vmstate_cpu_fields[] = { · line 87
Quoted 10 lines
target-alpha/machine.c +0
-10- -void cpu_save (QEMUFile *f,void *opaque) -{ -vmstate_save_state (f, &vmstate_cpu, opaque); -} - -int cpu_load (QEMUFile *f,void *opaque,int version_id) -{ -return vmstate_load_state (f, &vmstate_cpu, opaque, version_id); -}
r~
Re: [Qemu-devel] [PATCH 03/25] vmstate: make all architectures export a way to migrate cpu's
In reply to Juan QuintelaAm Dienstag 25 Oktober 2011, 16:00:37 schrieb Juan Quintela:
Quoted 6 lines
This makes several changes:
- exports VMStateDescriptionvmstate_cpunon-static.
- makes sure that every cpu has avmstate_cpuor cpu_save/load defined
- for the architecture that had nothing, it just register the cpu as unmigratable. - Depending onCPU_SAVE_VERSIONwe register old/new migration style
[..]
Quoted 15 lines
target-lm32/machine.c +1
-1@@ -1,7 +1,7 @@#include "hw/hw.h" #include "hw/boards.h" -static const VMStateDescription vmstate_cpu = { +const VMStateDescription vmstate_cpu = { .name ="cpu" , .version_id =CPU_SAVE_VERSION , .minimum_version_id =1 ,target-m68k/machine.c +0
-0
[..]
Signature · 1 line
Michael
PATCH 4/25 vmstate: unicore32 don't support cpu migration
In reply to Juan Quintela--- target-unicore32/cpu.h | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
target-unicore32/cpu.h +0 -2
@@ -132,8 +132,6 @@ int uc32_cpu_signal_handler(int host_signum, void *pinfo, void *puc);int uc32_cpu_handle_mmu_fault (CPUState *env,target_ulong address,int rw,int mmu_idx); -#define CPU_SAVE_VERSION 2 -/* MMU modes definitions */ #define MMU_MODE0_SUFFIX _kernel#define MMU_MODE1_SUFFIX _user
Signature · 1 line
1.7.6.4
PATCH 5/25 vmstate: use new cpu style for x86
In reply to Juan Quintela--- target-i386/cpu.h | 2 -- target-i386/machine.c | 12 +----------- 2 files changed, 1 insertions(+), 13 deletions(-)
target-i386/cpu.h +0 -2
@@ -949,8 +949,6 @@ uint64_t cpu_get_tsc(CPUX86State *env);#define cpu_list_id x86_cpu_list#define cpudef_setup x86_cpudef_setup -#define CPU_SAVE_VERSION 13 -/* MMU modes definitions */ #define MMU_MODE0_SUFFIX _kernel#define MMU_MODE1_SUFFIX _user
target-i386/machine.c +1 -11
@@ -312,7 +312,7 @@ static const VMStateDescription vmstate_fpop_ip_dp = {const VMStateDescription vmstate_cpu = { .name ="cpu" , - .version_id =CPU_SAVE_VERSION , + .version_id =13 , .minimum_version_id =3 , .minimum_version_id_old =3 , .pre_save = cpu_pre_save,
@@ -426,13 +426,3 @@ const VMStateDescription vmstate_cpu = { } } }; - -void cpu_save (QEMUFile *f,void *opaque) -{ -vmstate_save_state (f, &vmstate_cpu, opaque); -} - -int cpu_load (QEMUFile *f,void *opaque,int version_id) -{ -return vmstate_load_state (f, &vmstate_cpu, opaque, version_id); -}
Signature · 1 line
1.7.6.4
PATCH 6/25 vmstate: use new style for lm32 cpus
In reply to Juan Quintela--- target-lm32/cpu.h | 2 -- target-lm32/machine.c | 12 +----------- 2 files changed, 1 insertions(+), 13 deletions(-)
target-lm32/cpu.h +0 -2
@@ -202,8 +202,6 @@ void cpu_lm32_set_phys_msb_ignore(CPUState *env, int value);#define cpu_gen_code cpu_lm32_gen_code#define cpu_signal_handler cpu_lm32_signal_handler -#define CPU_SAVE_VERSION 1 -int cpu_lm32_handle_mmu_fault (CPUState *env,target_ulong address,int rw,int mmu_idx);#define cpu_handle_mmu_fault cpu_lm32_handle_mmu_fault
target-lm32/machine.c +1 -11
@@ -3,7 +3,7 @@const VMStateDescription vmstate_cpu = { .name ="cpu" , - .version_id =CPU_SAVE_VERSION , + .version_id =1 , .minimum_version_id =1 , .minimum_version_id_old =1 , .fields = (VMStateField []) {
@@ -21,13 +21,3 @@ const VMStateDescription vmstate_cpu = { VMSTATE_END_OF_LIST() } }; - -void cpu_save (QEMUFile *f,void *opaque) -{ -vmstate_save_state (f, &vmstate_cpu, opaque); -} - -int cpu_load (QEMUFile *f,void *opaque,int version_id) -{ -return vmstate_load_state (f, &vmstate_cpu, opaque, version_id); -}
Signature · 1 line
1.7.6.4
Re: [Qemu-devel] [PATCH 06/25] vmstate: use new style for lm32 cpus
Am Dienstag 25 Oktober 2011, 16:00:40 schrieb Juan Quintela:
Quoted 37 lines
Signed-off-by Juan Quintela <[email protected]>CC Michael Walle <[email protected]>--- target-lm32/cpu.h | 2 -- target-lm32/machine.c | 12 +----------- 2 files changed, 1 insertions(+), 13 deletions(-)target-lm32/cpu.h +0
-0@@ -202,8 +202,6 @@ void cpu_lm32_set_phys_msb_ignore(CPUState *env, intvalue); #define
cpu_gen_codecpu_lm32_gen_code
#definecpu_signal_handlercpu_lm32_signal_handlertarget-lm32/cpu.h +0
-2-#define CPU_SAVE_VERSION 1 -int cpu_lm32_handle_mmu_fault (CPUState *env,target_ulong address,int rw,int mmu_idx);#define cpu_handle_mmu_fault cpu_lm32_handle_mmu_faulttarget-lm32/machine.c +1
-1@@ -3,7 +3,7 @@const VMStateDescription vmstate_cpu = { .name ="cpu" , - .version_id =CPU_SAVE_VERSION , + .version_id =1 , .minimum_version_id =1 , .minimum_version_id_old =1 , .fields = (VMStateField []) {@@ -21,13 +21,3 @@ const VMStateDescription vmstate_cpu = { VMSTATE_END_OF_LIST() } };
target-lm32/machine.c const VMStateDescription vmstate_cpu = { · line 33
Quoted 10 lines
target-lm32/machine.c +0
-10- -void cpu_save (QEMUFile *f,void *opaque) -{ -vmstate_save_state (f, &vmstate_cpu, opaque); -} - -int cpu_load (QEMUFile *f,void *opaque,int version_id) -{ -return vmstate_load_state (f, &vmstate_cpu, opaque, version_id); -}
Signature · 1 line
Michael
PATCH 7/25 vmstate: make microblaze cpus not migrateable
In reply to Juan Quintela--- target-microblaze/cpu.h | 2 -- target-microblaze/machine.c | 15 +++++++-------- 2 files changed, 7 insertions(+), 10 deletions(-)
target-microblaze/cpu.h +0 -2
@@ -287,8 +287,6 @@ enum {#define cpu_gen_code cpu_mb_gen_code#define cpu_signal_handler cpu_mb_signal_handler -#define CPU_SAVE_VERSION 1 -/* MMU modes definitions */ #define MMU_MODE0_SUFFIX _nommu#define MMU_MODE1_SUFFIX _kernel
target-microblaze/machine.c +7 -8
@@ -1,11 +1,10 @@ +#include "hw/hw.h" -#include "hw/boards.h" -void cpu_save (QEMUFile *f,void *opaque) -{ -} +/* To make this architecture migratable, we need to define cpu state +here. Other things need to be done elsewhere */ -int cpu_load (QEMUFile *f,void *opaque,int version_id) -{ -return 0 ; -} +const VMStateDescription vmstate_cpu = { + .name ="cpu" , + .unmigratable =1 , +};
Signature · 1 line
1.7.6.4
PATCH 8/25 vmstate: port cris cpu to vmstate
In reply to Juan QuintelaHave to define TLBSet struct.
Multidimensional arrays in C are a mess, just unroll them.
--- target-cris/cpu.h | 13 ++--- target-cris/machine.c | 138 +++++++++++++++++++------------------------------ 2 files changed, 60 insertions(+), 91 deletions(-)
target-cris/cpu.h +6 -7
@@ -99,6 +99,11 @@#define NB_MMU_MODES 2 +typedef struct { +uint32_t hi; +uint32_t lo; +}TLBSet ; + typedef struct CPUCRISState { uint32_t regs[16]; /* P0 - P15 are referred to as special registers in the docs. */
@@ -152,11 +157,7 @@ typedef struct CPUCRISState {* * One for I and another for D. */ -struct - { -uint32_t hi; -uint32_t lo; - } tlbsets[2 ][4 ][16 ]; +TLBSet tlbsets[2 ][4 ][16 ];CPU_COMMON
@@ -214,8 +215,6 @@ enum {#define cpu_gen_code cpu_cris_gen_code#define cpu_signal_handler cpu_cris_signal_handler -#define CPU_SAVE_VERSION 1 -/* MMU modes definitions */ #define MMU_MODE0_SUFFIX _kernel#define MMU_MODE1_SUFFIX _user
target-cris/machine.c +54 -84
144 lines not on this page · raw message
Signature · 1 line
1.7.6.4
PATCH 9/25 vmstate: machine.c is only compiled for !CONFIG_USER_ONLY
In reply to Juan Quintela--- target-ppc/machine.c | 8 -------- 1 files changed, 0 insertions(+), 8 deletions(-)
target-ppc/machine.c +0 -8
@@ -32,7 +32,6 @@ void cpu_save(QEMUFile *f, void *opaque) }qemu_put_be32s (f, &env->fpscr);qemu_put_sbe32s (f, &env->access_type); -#if !defined(CONFIG_USER_ONLY )#if defined(TARGET_PPC64 )qemu_put_betls (f, &env->asr);qemu_put_sbe32s (f, &env->slb_nr);
@@ -62,7 +61,6 @@ void cpu_save(QEMUFile *f, void *opaque) }for (i =0 ; i <4 ; i++)qemu_put_betls (f, &env->pb[i]); -#endif for (i =0 ; i <1024 ; i++)qemu_put_betls (f, &env->spr[i]);qemu_put_be32s (f, &env->vscr);
@@ -72,7 +70,6 @@ void cpu_save(QEMUFile *f, void *opaque)qemu_put_be32s (f, &env->flags);qemu_put_sbe32s (f, &env->error_code);qemu_put_be32s (f, &env->pending_interrupts); -#if !defined(CONFIG_USER_ONLY )qemu_put_be32s (f, &env->irq_input_state);for (i =0 ; i <POWERPC_EXCP_NB ; i++)qemu_put_betls (f, &env->excp_vectors[i]);
@@ -81,7 +78,6 @@ void cpu_save(QEMUFile *f, void *opaque)qemu_put_betls (f, &env->ivor_mask);qemu_put_betls (f, &env->ivpr_mask);qemu_put_betls (f, &env->hreset_vector); -#endif qemu_put_betls (f, &env->nip);qemu_put_betls (f, &env->hflags);qemu_put_betls (f, &env->hflags_nmsr);
@@ -120,7 +116,6 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) }qemu_get_be32s (f, &env->fpscr);qemu_get_sbe32s (f, &env->access_type); -#if !defined(CONFIG_USER_ONLY )#if defined(TARGET_PPC64 )qemu_get_betls (f, &env->asr);qemu_get_sbe32s (f, &env->slb_nr);
@@ -150,7 +145,6 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) }for (i =0 ; i <4 ; i++)qemu_get_betls (f, &env->pb[i]); -#endif for (i =0 ; i <1024 ; i++)qemu_get_betls (f, &env->spr[i]);ppc_store_sdr1 (env, sdr1);
@@ -161,7 +155,6 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)qemu_get_be32s (f, &env->flags);qemu_get_sbe32s (f, &env->error_code);qemu_get_be32s (f, &env->pending_interrupts); -#if !defined(CONFIG_USER_ONLY )qemu_get_be32s (f, &env->irq_input_state);for (i =0 ; i <POWERPC_EXCP_NB ; i++)qemu_get_betls (f, &env->excp_vectors[i]);
@@ -170,7 +163,6 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)qemu_get_betls (f, &env->ivor_mask);qemu_get_betls (f, &env->ivpr_mask);qemu_get_betls (f, &env->hreset_vector); -#endif qemu_get_betls (f, &env->nip);qemu_get_betls (f, &env->hflags);qemu_get_betls (f, &env->hflags_nmsr);
Signature · 1 line
1.7.6.4
PATCH 10/25 vmstate: introduce float32 arrays
In reply to Juan Quintela--- hw/hw.h | 5 +++++ savevm.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 0 deletions(-)
hw/hw.h +5 -0
@@ -354,6 +354,8 @@ extern const VMStateInfo vmstate_info_uint16;extern const VMStateInfo vmstate_info_uint32;extern const VMStateInfo vmstate_info_uint64; +extern const VMStateInfo vmstate_info_float32; +extern const VMStateInfo vmstate_info_timer;extern const VMStateInfo vmstate_info_ptimer;extern const VMStateInfo vmstate_info_buffer;
@@ -875,6 +877,9 @@ extern const VMStateDescription vmstate_hid_ptr_device;#define VMSTATE_INT64_ARRAY (_f, _s, _n) \ VMSTATE_INT64_ARRAY_V(_f, _s, _n, 0) +#define VMSTATE_FLOAT32_ARRAY (_f, _s, _n) \ + VMSTATE_ARRAY(_f, _s, _n, 0, vmstate_info_float32, float32) +#define VMSTATE_BUFFER_V (_f, _s, _v) \ VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, 0, sizeof(typeof_field(_s, _f)))
savevm.c +30 -0
@@ -1027,6 +1027,36 @@ const VMStateInfo vmstate_info_uint16_equal = { .put = put_uint16, }; +/* 32 bit float */ + +typedef union { +float32 f; +uint32_t i; +}VMStateFloat32 ; + +static int get_float32 (QEMUFile *f,void *pv,size_t size) +{ +float32 *v = pv; +VMStateFloat32 u; +qemu_get_be32s (f, &u.i); + *v = u.f; +return 0 ; +} + +static void put_float32 (QEMUFile *f,void *pv,size_t size) +{ +float32 *v = pv; +VMStateFloat32 u; + u.f = *v; +qemu_put_be32s (f, &u.i); +} + +const VMStateInfo vmstate_info_float32 = { + .name ="float32" , + .get = get_float32, + .put = put_float32, +}; +/* timers */ static int get_timer (QEMUFile *f,void *pv,size_t size)
Signature · 1 line
1.7.6.4
PATCH 11/25 vmstate: introduce float64 arrays
In reply to Juan Quintela--- hw/hw.h | 4 ++++ savevm.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 0 deletions(-)
hw/hw.h +4 -0
@@ -355,6 +355,7 @@ extern const VMStateInfo vmstate_info_uint32;extern const VMStateInfo vmstate_info_uint64;extern const VMStateInfo vmstate_info_float32; +extern const VMStateInfo vmstate_info_float64;extern const VMStateInfo vmstate_info_timer;extern const VMStateInfo vmstate_info_ptimer;
@@ -880,6 +881,9 @@ extern const VMStateDescription vmstate_hid_ptr_device;#define VMSTATE_FLOAT32_ARRAY (_f, _s, _n) \ VMSTATE_ARRAY(_f, _s, _n, 0, vmstate_info_float32, float32) +#define VMSTATE_FLOAT64_ARRAY (_f, _s, _n) \ + VMSTATE_ARRAY(_f, _s, _n, 0, vmstate_info_float64, float64) +#define VMSTATE_BUFFER_V (_f, _s, _v) \ VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, 0, sizeof(typeof_field(_s, _f)))
savevm.c +30 -0
@@ -1057,6 +1057,36 @@ const VMStateInfo vmstate_info_float32 = { .put = put_float32, }; +/* 64 bit float */ + +typedef union { +float64 d; +uint64_t l; +}VMStateFloat64 ; + +static int get_float64 (QEMUFile *f,void *pv,size_t size) +{ +float64 *v = pv; +VMStateFloat64 u; +qemu_get_be64s (f, &u.l); + *v = u.d; +return 0 ; +} + +static void put_float64 (QEMUFile *f,void *pv,size_t size) +{ +float64 *v = pv; +VMStateFloat64 u; + u.d = *v; +qemu_put_be64s (f, &u.l); +} + +const VMStateInfo vmstate_info_float64 = { + .name ="float64" , + .get = get_float64, + .put = put_float64, +}; +/* timers */ static int get_timer (QEMUFile *f,void *pv,size_t size)
Signature · 1 line
1.7.6.4
PATCH 12/25 vmstate: Introduce VMSTATE_STRUCT_VARRAY_INT32_TEST
In reply to Juan QuintelaWe have an array of structs whose size is an int32 in the same struct that depends on a test value to know if it is there or not.
--- hw/hw.h | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
hw/hw.h +10 -0
@@ -533,6 +533,16 @@ extern const VMStateDescription vmstate_cpu; .offset = offsetof(_state, _field), \ } +#define VMSTATE_STRUCT_VARRAY_INT32_TEST (_field, _state, _field_num, _test, _vmsd, _type) { \ + .name = (stringify(_field)), \ + .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \ + .vmsd = &(_vmsd), \ + .field_exists = (_test), \ + .size = sizeof(_type), \ + .flags = VMS_STRUCT|VMS_VARRAY_INT32, \ + .offset = offsetof(_state, _field), \ +} +#define VMSTATE_STRUCT_VARRAY_POINTER_INT32 (_field, _state, _field_num, _vmsd, _type) { \ .name = (stringify(_field)), \ .version_id = 0, \
Signature · 1 line
1.7.6.4
PATCH 13/25 vmstate: port ppc cpu
In reply to Juan QuintelaAdded sdr1_vmstate because storing the value requires calling ppc_store_sdr1(). The position when the function is called also changes (I think it is save).
--- target-ppc/cpu.h | 4 +- target-ppc/machine.c | 245 ++++++++++++++++++-------------------------------- 2 files changed, 89 insertions(+), 160 deletions(-)
target-ppc/cpu.h +2 -2
@@ -1029,6 +1029,8 @@ struct CPUPPCState {*/ uint8_t fit_period[4 ];uint8_t wdt_period[4 ]; + +target_ulong sdr1_vmstate; };#define SET_FIT_PERIOD (a_, b_, c_, d_) \
@@ -1183,8 +1185,6 @@ int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, uint32_t val);#define cpu_signal_handler cpu_ppc_signal_handler#define cpu_list ppc_cpu_list -#define CPU_SAVE_VERSION 4 -/* MMU modes definitions */ #define MMU_MODE0_SUFFIX _user#define MMU_MODE1_SUFFIX _kernel
target-ppc/machine.c +87 -158
259 lines not on this page · raw message
Signature · 1 line
1.7.6.4
Re: [Qemu-devel] [PATCH 13/25] vmstate: port ppc cpu
Quoted 2 lines · Juan Quintela
Added
sdr1_vmstatebecause storing the value requires callingppc_store_sdr1(). The position when the function is called also changes (I think it is save).
Thanks for converting this. I'm fairly sure that vmsave is broken atm anyways and that someone will have to go through all the fields and make sure they're still working properly. However you're definitely not making the situation worse, so here's only a small comment:
Quoted 9 lines
Signed-off-by Juan Quintela <[email protected]>CC Alexander Graf <[email protected]>---
target-ppc/cpu.h| 4 +-target-ppc/machine.c| 245 ++++++++++++++++++--------------------------------2 files changed, 89 insertions(+), 160 deletions(-)+
VMSTATE_UINTTL_ARRAY(spr, CPUState, 1024),
Shouldn't sizeof(((CPUState*)NULL)->spr / sizeof(target_ulong)) work as size field?
Alex
Re: [Qemu-devel] [PATCH 13/25] vmstate: port ppc cpu
Quoted 15 lines · Alexander Graf
Quoted 2 lines · Juan Quintela
Added
sdr1_vmstatebecause storing the value requires callingppc_store_sdr1(). The position when the function is called also changes (I think it is save).Thanks for converting this. I'm fairly sure that vmsave is broken atm anyways and that someone will have to go through all the fields and make sure they're still working properly. However you're definitely not making the situation worse, so here's only a small comment:
Quoted 8 lines
Signed-off-by Juan Quintela <[email protected]>CC Alexander Graf <[email protected]>---
target-ppc/cpu.h| 4 +-target-ppc/machine.c| 245 ++++++++++++++++++--------------------------------2 files changed, 89 insertions(+), 160 deletions(-)
Quoted 3 lines
Quoted 1 line
+
VMSTATE_UINTTL_ARRAY(spr, CPUState, 1024),Shouldn't
sizeof(((CPUState*)NULL)->spr / sizeof(target_ulong))work as size field?
vmstate is inconsistent about this.
It "calculates" sizes for "strings" (ar uint8_t * if your preffer), but not for arrays.
#define VMSTATE_BUFFER_V(_f, _s, _v) \
VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, 0, sizeof(typeof_field(_s, _f)))#define VMSTATE_BUFFER(_f, _s) \
VMSTATE_BUFFER_V(_f, _s, 0)And I don't know what the "right" solution is:
- Putting explicit size helps detect changes on that size (good)
- But, on lots of places, we are putting there a constant:
VMSTATE_INT32_ARRAY(tx_fifo, smc91c111_state, NUM_PACKETS),
So, we are not going to detect changes either.
Next on my plate is to get someway of unittesting and being able to detect this kind of changes (then we can actually drop the sizes always).
Later, Juan.
PATCH 14/25 vmstate: introduce VMSTATE_VARRAY_MULTIPLY
In reply to Juan QuintelaThiss allows to sent a partial array where the size is another structure field multiplied by a constant.
--- hw/hw.h | 11 +++++++++++ savevm.c | 6 ++++++ 2 files changed, 17 insertions(+), 0 deletions(-)
hw/hw.h +11 -0
@@ -300,6 +300,7 @@ enum VMStateFlags {VMS_MULTIPLY =0x200 ,/* multiply "size" field by field_size */ VMS_VARRAY_UINT8 =0x400 ,/* Array with size in uint8_t field*/ VMS_VARRAY_UINT32 =0x800 ,/* Array with size in uint32_t field*/ + VMS_MULTIPLY_ELEMENTS= 0x1000, /* multiply "size" field by field_size */ }; typedef struct {
@@ -424,6 +425,16 @@ extern const VMStateDescription vmstate_cpu; .offset = vmstate_offset_array(_state, _field, _type, _num), \ } +#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 = offsetof(_state, _field), \ +} +#define VMSTATE_ARRAY_TEST (_field, _state, _num, _test, _info, _type) {\ .name = (stringify(_field)), \ .field_exists = (_test), \
savevm.c +6 -0
@@ -1460,6 +1460,9 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, }else if (field->flags &VMS_VARRAY_UINT8 ) { n_elems = *(uint8_t *)(opaque+field->num_offset); } +if (field->flags &VMS_MULTIPLY_ELEMENTS ) { + n_elems *= field->num; + }if (field->flags &VMS_POINTER ) { base_addr = *(void **)base_addr + field->start; }
@@ -1524,6 +1527,9 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, }else if (field->flags &VMS_VARRAY_UINT8 ) { n_elems = *(uint8_t *)(opaque+field->num_offset); } +if (field->flags &VMS_MULTIPLY_ELEMENTS ) { + n_elems *= field->num; + }if (field->flags &VMS_POINTER ) { base_addr = *(void **)base_addr + field->start; }
Signature · 1 line
1.7.6.4
PATCH 15/25 vmstate: define vmstate_info_uinttls
In reply to Juan QuintelaWe are going to define arrays of this type, so we need the integer type.
--- hw/hw.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
hw/hw.h +2 -0
@@ -947,11 +947,13 @@ extern const VMStateDescription vmstate_hid_ptr_device; 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_uinttls 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_uinttls vmstate_info_uint32#endif #define VMSTATE_UINTTL (_f, _s) \ VMSTATE_UINTTL_V(_f, _s, 0)
Signature · 1 line
1.7.6.4
PATCH 16/25 vmstate: port sparc cpu
In reply to Juan Quintela--- hw/sun4u.c | 20 -- target-sparc/cpu.h | 8 +- target-sparc/machine.c | 482 ++++++++++++++++++++++++++++-------------------- 3 files changed, 282 insertions(+), 228 deletions(-)
hw/sun4u.c +0 -20
@@ -324,26 +324,6 @@ typedef struct ResetData {uint64_t prom_addr; } ResetData; -void cpu_put_timer (QEMUFile *f,CPUTimer *s) -{ -qemu_put_be32s (f, &s->frequency); -qemu_put_be32s (f, &s->disabled); -qemu_put_be64s (f, &s->disabled_mask); -qemu_put_sbe64s (f, &s->clock_offset); - -qemu_put_timer (f, s->qtimer); -} - -void cpu_get_timer (QEMUFile *f,CPUTimer *s) -{ -qemu_get_be32s (f, &s->frequency); -qemu_get_be32s (f, &s->disabled); -qemu_get_be64s (f, &s->disabled_mask); -qemu_get_sbe64s (f, &s->clock_offset); - -qemu_get_timer (f, s->qtimer); -} -static CPUTimer *cpu_timer_create (const char * name,CPUState *env,QEMUBHFunc *cb,uint32_t frequency,uint64_t disabled_mask)
target-sparc/cpu.h +2 -6
@@ -352,10 +352,6 @@ struct CPUTimertypedef struct CPUTimer CPUTimer ; -struct QEMUFile ; -void cpu_put_timer (struct QEMUFile *f,CPUTimer *s); -void cpu_get_timer (struct QEMUFile *f,CPUTimer *s); - typedef struct CPUSPARCState { target_ulong gregs[8]; /* general registers */ target_ulong *regwptr; /* pointer to current register window */
@@ -482,6 +478,8 @@ typedef struct CPUSPARCState {/* Leon3 cache control */ uint32_t cache_control; + +uint32_t psr_vmstate; } CPUSPARCState;#ifndef NO_CPU_IO_DEFS
@@ -569,8 +567,6 @@ int cpu_sparc_signal_handler(int host_signum, void *pinfo, void *puc);#define cpu_signal_handler cpu_sparc_signal_handler#define cpu_list sparc_cpu_list -#define CPU_SAVE_VERSION 7 -/* MMU modes definitions */ #if defined (TARGET_SPARC64 )#define MMU_USER_IDX 0
target-sparc/machine.c +280 -202
502 lines not on this page · raw message
Signature · 1 line
1.7.6.4
PATCH 17/25 vmstate: make incompatible change for sparc
In reply to Juan QuintelaWith this change, we sent arrays as arrays, making state description much simpler. The change is incompatible, but as far as I know, sparc don't care about migration compatibility beteween versions.
--- target-sparc/machine.c | 172 +++--------------------------------------------- 1 files changed, 9 insertions(+), 163 deletions(-)
target-sparc/machine.c +9 -163
@@ -74,9 +74,9 @@ static int cpu_post_load(void *opaque, int version_id)const VMStateDescription vmstate_cpu = { .name ="cpu" , - .version_id =7 , - .minimum_version_id =7 , - .minimum_version_id_old =7 , + .version_id =8 , + .minimum_version_id =8 , + .minimum_version_id_old =8 , .pre_save = cpu_pre_save, .post_load = cpu_post_load, .fields = (VMStateField []) {
@@ -106,166 +106,12 @@ const VMStateDescription vmstate_cpu = {VMSTATE_UINT64_ARRAY (mmubpregs, CPUState,4 ), #elseVMSTATE_UINT64 (lsu, CPUState), -VMSTATE_UINT64 (immuregs[0 ], CPUState), -VMSTATE_UINT64 (dmmuregs[0 ], CPUState), -VMSTATE_UINT64 (immuregs[1 ], CPUState), -VMSTATE_UINT64 (dmmuregs[1 ], CPUState), -VMSTATE_UINT64 (immuregs[2 ], CPUState), -VMSTATE_UINT64 (dmmuregs[2 ], CPUState), -VMSTATE_UINT64 (immuregs[3 ], CPUState), -VMSTATE_UINT64 (dmmuregs[3 ], CPUState), -VMSTATE_UINT64 (immuregs[4 ], CPUState), -VMSTATE_UINT64 (dmmuregs[4 ], CPUState), -VMSTATE_UINT64 (immuregs[5 ], CPUState), -VMSTATE_UINT64 (dmmuregs[5 ], CPUState), -VMSTATE_UINT64 (immuregs[6 ], CPUState), -VMSTATE_UINT64 (dmmuregs[6 ], CPUState), -VMSTATE_UINT64 (immuregs[7 ], CPUState), -VMSTATE_UINT64 (dmmuregs[7 ], CPUState), -VMSTATE_UINT64 (immuregs[8 ], CPUState), -VMSTATE_UINT64 (dmmuregs[8 ], CPUState), -VMSTATE_UINT64 (immuregs[9 ], CPUState), -VMSTATE_UINT64 (dmmuregs[9 ], CPUState), -VMSTATE_UINT64 (immuregs[10 ], CPUState), -VMSTATE_UINT64 (dmmuregs[10 ], CPUState), -VMSTATE_UINT64 (immuregs[11 ], CPUState), -VMSTATE_UINT64 (dmmuregs[11 ], CPUState), -VMSTATE_UINT64 (immuregs[12 ], CPUState), -VMSTATE_UINT64 (dmmuregs[12 ], CPUState), -VMSTATE_UINT64 (immuregs[13 ], CPUState), -VMSTATE_UINT64 (dmmuregs[13 ], CPUState), -VMSTATE_UINT64 (immuregs[14 ], CPUState), -VMSTATE_UINT64 (dmmuregs[14 ], CPUState), -VMSTATE_UINT64 (immuregs[15 ], CPUState), -VMSTATE_UINT64 (dmmuregs[15 ], CPUState), -VMSTATE_STRUCT (itlb[0 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[0 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[1 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[1 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[2 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[2 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[3 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[3 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[4 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[4 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[5 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[5 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[6 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[6 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[7 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[7 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[8 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[8 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[9 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[9 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[10 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[10 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[11 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[11 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[12 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[12 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[13 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[13 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[14 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[14 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[15 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[15 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[16 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[16 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[17 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[17 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[18 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[18 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[19 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[19 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[20 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[20 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[21 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[21 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[22 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[22 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[23 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[23 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[24 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[24 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[25 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[25 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[26 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[26 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[27 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[27 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[28 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[28 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[29 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[29 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[30 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[30 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[31 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[31 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[32 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[32 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[33 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[33 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[34 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[34 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[35 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[35 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[36 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[36 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[37 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[37 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[38 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[38 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[39 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[39 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[40 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[40 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[41 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[41 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[42 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[42 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[43 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[43 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[44 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[44 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[45 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[45 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[46 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[46 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[47 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[47 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[48 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[48 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[49 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[49 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[50 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[50 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[51 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[51 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[52 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[52 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[53 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[53 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[54 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[54 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[55 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[55 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[56 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[56 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[57 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[57 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[58 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[58 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[59 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[59 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[60 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[60 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[61 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[61 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[62 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[62 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (itlb[63 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), -VMSTATE_STRUCT (dtlb[63 ], CPUState,0 , vmstate_tlb_entry, SparcTLBEntry), +VMSTATE_UINT64_ARRAY (immuregs, CPUState,16 ), +VMSTATE_UINT64_ARRAY (dmmuregs, CPUState,16 ), +VMSTATE_STRUCT_ARRAY (itlb, CPUState,64 ,0 , + vmstate_tlb_entry, SparcTLBEntry), +VMSTATE_STRUCT_ARRAY (dtlb, CPUState,64 ,0 , + vmstate_tlb_entry, SparcTLBEntry),VMSTATE_UINT32 (mmu_version, CPUState),VMSTATE_STRUCT_ARRAY (ts, CPUState,MAXTL_MAX ,0 , vmstate_trap_state, trap_state),
Signature · 1 line
1.7.6.4
Re: [Qemu-devel] [PATCH 17/25] vmstate: make incompatible change for sparc
Quoted 3 lines · Juan Quintela
With this change, we sent arrays as arrays, making state description much simpler. The change is incompatible, but as far as I know, sparc don't care about migration compatibility beteween versions.
Can't speak for other sparc, but at least I don't care much and nobody has complained IIRC.
Quoted 200 lines
Signed-off-by Juan Quintela <[email protected]>CC Blue Swirl <[email protected]>---
target-sparc/machine.c | 172 +++---------------------------------------------1 files changed, 9 insertions(+), 163 deletions(-)target-sparc/machine.c +9
-164@@ -74,9 +74,9 @@ static int cpu_post_load(void *opaque, int version_id) const VMStateDescription vmstate_cpu = { .name = "cpu", - .version_id = 7, - .minimum_version_id = 7, - .minimum_version_id_old = 7, + .version_id = 8, + .minimum_version_id = 8, + .minimum_version_id_old = 8, .pre_save = cpu_pre_save, .post_load = cpu_post_load, .fields = (VMStateField[]) {@@ -106,166 +106,12 @@ const VMStateDescription vmstate_cpu = { VMSTATE_UINT64_ARRAY(mmubpregs, CPUState, 4), #else VMSTATE_UINT64(lsu, CPUState), - VMSTATE_UINT64(immuregs[0], CPUState), - VMSTATE_UINT64(dmmuregs[0], CPUState), - VMSTATE_UINT64(immuregs[1], CPUState), - VMSTATE_UINT64(dmmuregs[1], CPUState), - VMSTATE_UINT64(immuregs[2], CPUState), - VMSTATE_UINT64(dmmuregs[2], CPUState), - VMSTATE_UINT64(immuregs[3], CPUState), - VMSTATE_UINT64(dmmuregs[3], CPUState), - VMSTATE_UINT64(immuregs[4], CPUState), - VMSTATE_UINT64(dmmuregs[4], CPUState), - VMSTATE_UINT64(immuregs[5], CPUState), - VMSTATE_UINT64(dmmuregs[5], CPUState), - VMSTATE_UINT64(immuregs[6], CPUState), - VMSTATE_UINT64(dmmuregs[6], CPUState), - VMSTATE_UINT64(immuregs[7], CPUState), - VMSTATE_UINT64(dmmuregs[7], CPUState), - VMSTATE_UINT64(immuregs[8], CPUState), - VMSTATE_UINT64(dmmuregs[8], CPUState), - VMSTATE_UINT64(immuregs[9], CPUState), - VMSTATE_UINT64(dmmuregs[9], CPUState), - VMSTATE_UINT64(immuregs[10], CPUState), - VMSTATE_UINT64(dmmuregs[10], CPUState), - VMSTATE_UINT64(immuregs[11], CPUState), - VMSTATE_UINT64(dmmuregs[11], CPUState), - VMSTATE_UINT64(immuregs[12], CPUState), - VMSTATE_UINT64(dmmuregs[12], CPUState), - VMSTATE_UINT64(immuregs[13], CPUState), - VMSTATE_UINT64(dmmuregs[13], CPUState), - VMSTATE_UINT64(immuregs[14], CPUState), - VMSTATE_UINT64(dmmuregs[14], CPUState), - VMSTATE_UINT64(immuregs[15], CPUState), - VMSTATE_UINT64(dmmuregs[15], CPUState), - VMSTATE_STRUCT(itlb[0], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[0], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[1], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[1], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[2], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[2], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[3], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[3], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[4], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[4], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[5], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[5], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[6], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[6], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[7], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[7], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[8], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[8], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[9], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[9], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[10], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[10], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[11], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[11], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[12], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[12], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[13], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[13], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[14], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[14], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[15], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[15], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[16], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[16], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[17], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[17], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[18], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[18], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[19], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[19], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[20], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[20], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[21], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[21], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[22], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[22], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[23], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[23], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[24], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[24], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[25], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[25], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[26], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[26], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[27], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[27], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[28], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[28], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[29], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[29], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[30], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[30], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[31], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[31], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[32], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[32], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[33], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[33], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[34], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[34], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[35], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[35], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[36], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[36], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[37], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[37], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[38], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[38], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[39], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[39], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[40], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[40], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[41], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[41], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[42], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[42], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[43], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[43], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[44], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[44], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[45], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[45], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[46], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[46], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[47], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[47], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[48], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[48], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[49], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[49], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[50], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[50], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[51], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[51], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[52], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[52], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[53], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[53], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[54], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[54], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[55], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[55], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[56], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[56], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[57], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[57], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[58], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[58], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[59], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[59], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[60], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[60], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[61], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[61], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[62], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[62], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(itlb[63], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), - VMSTATE_STRUCT(dtlb[63], CPUState, 0, vmstate_tlb_entry, SparcTLBEntry), + VMSTATE_UINT64_ARRAY(immuregs, CPUState, 16), + VMSTATE_UINT64_ARRAY(dmmuregs, CPUState, 16), + VMSTATE_STRUCT_ARRAY(itlb, CPUState, 64, 0, + vmstate_tlb_entry, SparcTLBEntry), + VMSTATE_STRUCT_ARRAY(dtlb, CPUState, 64, 0, + vmstate_tlb_entry, SparcTLBEntry), VMSTATE_UINT32(mmu_version, CPUState), VMSTATE_STRUCT_ARRAY(ts, CPUState, MAXTL_MAX, 0, vmstate_trap_state, trap_state), --1.7.6.4
PATCH 18/25 mips_fulong2e: cpu vmstate already registered in cpu_exec_init
In reply to Juan QuintelaThis is the second place that register cpu migration code, it is done in general in cpu_exec_init(), just remove this call.
--- hw/mips_fulong2e.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
hw/mips_fulong2e.c +0 -1
@@ -281,7 +281,6 @@ static void mips_fulong2e_init(ram_addr_t ram_size, const char *boot_device,exit (1 ); } -register_savevm (NULL ,"cpu" ,0 ,3 , cpu_save, cpu_load, env);qemu_register_reset (main_cpu_reset, env);/* fulong 2e has 256M ram. */
Signature · 1 line
1.7.6.4
PATCH 19/25 mips: make mvp an embedded struct instead of pointer
In reply to Juan QuintelaAdjust all callers.
--- hw/mips_malta.c | 4 ++-- target-mips/cpu.h | 4 ++-- target-mips/machine.c | 12 ++++++------ target-mips/op_helper.c | 30 +++++++++++++++++------------- target-mips/translate.c | 6 +++--- target-mips/translate_init.c | 14 ++++++-------- 6 files changed, 36 insertions(+), 34 deletions(-)
hw/mips_malta.c +2 -2
@@ -732,8 +732,8 @@ static int64_t load_kernel (void)static void malta_mips_config (CPUState *env) { - env->mvp->CP0_MVPConf0 |= ((smp_cpus -1 ) <<CP0MVPC0_PVPE ) | - ((smp_cpus * env->nr_threads -1 ) <<CP0MVPC0_PTC ); + env->mvp.CP0_MVPConf0 |= ((smp_cpus -1 ) <<CP0MVPC0_PVPE ) | + ((smp_cpus * env->nr_threads -1 ) <<CP0MVPC0_PTC ); }static void main_cpu_reset (void *opaque)
target-mips/cpu.h +2 -2
@@ -473,7 +473,7 @@ struct CPUMIPSState {CPU_COMMON - CPUMIPSMVPContext *mvp; + CPUMIPSMVPContext mvp;#if !defined(CONFIG_USER_ONLY )CPUMIPSTLBContext *tlb;#endif
@@ -675,7 +675,7 @@ static inline int mips_vpe_active(CPUState *env)int active =1 ;/* Check that the VPE is enabled. */ -if (!(env->mvp->CP0_MVPControl & (1 << CP0MVPCo_EVP))) { +if (!(env->mvp.CP0_MVPControl & (1 << CP0MVPCo_EVP))) { active =0 ; }/* Check that the VPE is actived. */
target-mips/machine.c +6 -6
@@ -52,9 +52,9 @@ void cpu_save(QEMUFile *f, void *opaque)save_fpu (f, &env->active_fpu);/* Save MVP */ -qemu_put_sbe32s (f, &env->mvp->CP0_MVPControl); -qemu_put_sbe32s (f, &env->mvp->CP0_MVPConf0); -qemu_put_sbe32s (f, &env->mvp->CP0_MVPConf1); +qemu_put_sbe32s (f, &env->mvp.CP0_MVPControl); +qemu_put_sbe32s (f, &env->mvp.CP0_MVPConf0); +qemu_put_sbe32s (f, &env->mvp.CP0_MVPConf1);/* Save TLB */ qemu_put_be32s (f, &env->tlb->nb_tlb);
@@ -203,9 +203,9 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)load_fpu (f, &env->active_fpu);/* Load MVP */ -qemu_get_sbe32s (f, &env->mvp->CP0_MVPControl); -qemu_get_sbe32s (f, &env->mvp->CP0_MVPConf0); -qemu_get_sbe32s (f, &env->mvp->CP0_MVPConf1); +qemu_get_sbe32s (f, &env->mvp.CP0_MVPControl); +qemu_get_sbe32s (f, &env->mvp.CP0_MVPConf0); +qemu_get_sbe32s (f, &env->mvp.CP0_MVPConf1);/* Load TLB */ qemu_get_be32s (f, &env->tlb->nb_tlb);
target-mips/op_helper.c +17 -13
@@ -909,17 +909,17 @@ static void sync_c0_entryhi(CPUState *cpu, int tc)/* CP0 helpers */ target_ulong helper_mfc0_mvpcontrol (void ) { -return env->mvp->CP0_MVPControl; +return env->mvp.CP0_MVPControl; }target_ulong helper_mfc0_mvpconf0 (void ) { -return env->mvp->CP0_MVPConf0; +return env->mvp.CP0_MVPConf0; }target_ulong helper_mfc0_mvpconf1 (void ) { -return env->mvp->CP0_MVPConf1; +return env->mvp.CP0_MVPConf1; }target_ulong helper_mfc0_random (void )
@@ -1172,13 +1172,14 @@ void helper_mtc0_mvpcontrol (target_ulong arg1)if (env->CP0_VPEConf0 & (1 <<CP0VPEC0_MVP )) mask |= (1 << CP0MVPCo_CPA) | (1 << CP0MVPCo_VPC) | (1 << CP0MVPCo_EVP); -if (env->mvp->CP0_MVPControl & (1 << CP0MVPCo_VPC)) +if (env->mvp.CP0_MVPControl & (1 << CP0MVPCo_VPC)) { mask |= (1 << CP0MVPCo_STLB); - newval = (env->mvp->CP0_MVPControl & ~mask) | (arg1 & mask); + } + newval = (env->mvp.CP0_MVPControl & ~mask) | (arg1 & mask);// TODO: Enable/disable shared TLB, enable/disable VPEs. - env->mvp->CP0_MVPControl = newval; + env->mvp.CP0_MVPControl = newval; }void helper_mtc0_vpecontrol (target_ulong arg1)
@@ -1266,9 +1267,10 @@ void helper_mtc0_vpeconf1 (target_ulong arg1)uint32_t mask =0 ;uint32_t newval; -if (env->mvp->CP0_MVPControl & (1 << CP0MVPCo_VPC)) +if (env->mvp.CP0_MVPControl & (1 << CP0MVPCo_VPC)) { mask |= (0xff <<CP0VPEC1_NCX ) | (0xff <<CP0VPEC1_NCP2 ) | (0xff <<CP0VPEC1_NCP1 ); + } newval = (env->CP0_VPEConf1 & ~mask) | (arg1 & mask);/* UDI not implemented. */
@@ -1325,8 +1327,9 @@ void helper_mtc0_tcbind (target_ulong arg1)uint32_t mask = (1 << CP0TCBd_TBE);uint32_t newval; -if (env->mvp->CP0_MVPControl & (1 << CP0MVPCo_VPC)) +if (env->mvp.CP0_MVPControl & (1 << CP0MVPCo_VPC)) { mask |= (1 << CP0TCBd_CurVPE); + } newval = (env->active_tc.CP0_TCBind & ~mask) | (arg1 & mask); env->active_tc.CP0_TCBind = newval; }
@@ -1338,8 +1341,9 @@ void helper_mttc0_tcbind (target_ulong arg1)uint32_t newval;CPUState *other =mips_cpu_map_tc (&other_tc); -if (other->mvp->CP0_MVPControl & (1 << CP0MVPCo_VPC)) +if (other->mvp.CP0_MVPControl & (1 << CP0MVPCo_VPC)) { mask |= (1 << CP0TCBd_CurVPE); + }if (other_tc == other->current_tc) { newval = (other->active_tc.CP0_TCBind & ~mask) | (arg1 & mask); other->active_tc.CP0_TCBind = newval;
@@ -1910,12 +1914,12 @@ target_ulong helper_emt(void)target_ulong helper_dvpe (void ) {CPUState *other_cpu = first_cpu; -target_ulong prev = env->mvp->CP0_MVPControl; +target_ulong prev = env->mvp.CP0_MVPControl; do { /* Turn off all VPEs except the one executing the dvpe. */ if (other_cpu != env) { - other_cpu->mvp->CP0_MVPControl &= ~(1 << CP0MVPCo_EVP); + other_cpu->mvp.CP0_MVPControl &= ~(1 << CP0MVPCo_EVP); mips_vpe_sleep(other_cpu); } other_cpu = other_cpu->next_cpu;
@@ -1926,14 +1930,14 @@ target_ulong helper_dvpe(void)target_ulong helper_evpe (void ) {CPUState *other_cpu = first_cpu; -target_ulong prev = env->mvp->CP0_MVPControl; +target_ulong prev = env->mvp.CP0_MVPControl; do { if (other_cpu != env /* If the VPE is WFI, dont distrub it's sleep. */ && !mips_vpe_is_wfi(other_cpu)) { /* Enable the VPE. */ - other_cpu->mvp->CP0_MVPControl |= (1 << CP0MVPCo_EVP); + other_cpu->mvp.CP0_MVPControl |= (1 << CP0MVPCo_EVP); mips_vpe_wake(other_cpu); /* And wake it up. */ } other_cpu = other_cpu->next_cpu;
target-mips/translate.c +3 -3
@@ -5533,7 +5533,7 @@ static void gen_mftr(CPUState *env, DisasContext *ctx, int rt, int rd, (env->active_tc.CP0_TCBind & (0xf << CP0TCBd_CurVPE))))tcg_gen_movi_tl (t0,-1 ); else if ((env->CP0_VPEControl & (0xff << CP0VPECo_TargTC)) > - (env->mvp->CP0_MVPConf0 & (0xff << CP0MVPC0_PTC))) + (env->mvp.CP0_MVPConf0 & (0xff << CP0MVPC0_PTC)))tcg_gen_movi_tl (t0,-1 ); else if (u == 0) {switch (rt) {
@@ -5751,7 +5751,7 @@ static void gen_mttr(CPUState *env, DisasContext *ctx, int rd, int rt, (env->active_tc.CP0_TCBind & (0xf << CP0TCBd_CurVPE))))/* NOP */ ; else if ((env->CP0_VPEControl & (0xff << CP0VPECo_TargTC)) > - (env->mvp->CP0_MVPConf0 & (0xff << CP0MVPC0_PTC))) + (env->mvp.CP0_MVPConf0 & (0xff << CP0MVPC0_PTC)))/* NOP */ ; else if (u == 0) {switch (rd) {
@@ -12827,7 +12827,7 @@ void cpu_reset (CPUMIPSState *env)if (!env->cpu_index) {/* VPE0 starts up enabled. */ - env->mvp->CP0_MVPControl |= (1 << CP0MVPCo_EVP); + env->mvp.CP0_MVPControl |= (1 << CP0MVPCo_EVP); env->CP0_VPEConf0 |= (1 <<CP0VPEC0_MVP ) | (1 <<CP0VPEC0_VPA );/* TC0 starts up unhalted. */
target-mips/translate_init.c +6 -8
@@ -568,27 +568,25 @@ static void fpu_init (CPUMIPSState *env, const mips_def_t *def)static void mvp_init (CPUMIPSState *env,const mips_def_t *def) { - env->mvp =g_malloc0 (sizeof (CPUMIPSMVPContext)); -/* MVPConf1 implemented, TLB sharable, no gating storage support, programmable cache partitioning implemented, number of allocatable and sharable TLB entries, MVP has allocatable TCs, 2 VPEs implemented, 5 TCs implemented. */ - env->mvp->CP0_MVPConf0 = (1 <<CP0MVPC0_M ) | (1 <<CP0MVPC0_TLBS ) | - (0 <<CP0MVPC0_GS ) | (1 <<CP0MVPC0_PCP ) | + env->mvp.CP0_MVPConf0 = (1 <<CP0MVPC0_M ) | (1 <<CP0MVPC0_TLBS ) | + (0 <<CP0MVPC0_GS ) | (1 <<CP0MVPC0_PCP ) |// TODO: actually do 2 VPEs. // (1 << CP0MVPC0_TCA) | (0x1 << CP0MVPC0_PVPE) | // (0x04 << CP0MVPC0_PTC); - (1 <<CP0MVPC0_TCA ) | (0x0 <<CP0MVPC0_PVPE ) | - (0x00 <<CP0MVPC0_PTC ); + (1 <<CP0MVPC0_TCA ) | (0x0 <<CP0MVPC0_PVPE ) | + (0x00 <<CP0MVPC0_PTC );#if !defined(CONFIG_USER_ONLY )/* Usermode has no TLB support */ - env->mvp->CP0_MVPConf0 |= (env->tlb->nb_tlb <<CP0MVPC0_PTLBE ); + env->mvp.CP0_MVPConf0 |= (env->tlb->nb_tlb <<CP0MVPC0_PTLBE );#endif /* Allocatable CP1 have media extensions, allocatable CP1 have FP support, no UDI implemented, no CP2 implemented, 1 CP1 implemented. */ - env->mvp->CP0_MVPConf1 = (1 <<CP0MVPC1_CIM ) | (1 <<CP0MVPC1_CIF ) | + env->mvp.CP0_MVPConf1 = (1 <<CP0MVPC1_CIM ) | (1 <<CP0MVPC1_CIF ) | (0x0 <<CP0MVPC1_PCX ) | (0x0 <<CP0MVPC1_PCP2 ) | (0x1 <<CP0MVPC1_PCP1 ); }
Signature · 1 line
1.7.6.4
PATCH 20/25 mips: make tlb an embedded struct instead of a pointer
In reply to Juan QuintelaAdjust all callers.
--- hw/mips_timer.c | 2 +- target-mips/cpu.h | 2 +- target-mips/helper.c | 30 +++++++++++++--------- target-mips/machine.c | 56 +++++++++++++++++++++--------------------- target-mips/op_helper.c | 40 +++++++++++++++--------------- target-mips/translate.c | 16 +++++++---- target-mips/translate_init.c | 24 ++++++++--------- 7 files changed, 89 insertions(+), 81 deletions(-)
hw/mips_timer.c +1 -1
@@ -35,7 +35,7 @@ uint32_t cpu_mips_get_random (CPUState *env)/* Don't return same value twice, so get another value */ do { lfsr = (lfsr >>1 ) ^ (-(lfsr &1u ) &0xd0000001u ); - idx = lfsr % (env->tlb->nb_tlb - env->CP0_Wired) + env->CP0_Wired; + idx = lfsr % (env->tlb.nb_tlb - env->CP0_Wired) + env->CP0_Wired; }while (idx == prev_idx); prev_idx = idx;return idx;
target-mips/cpu.h +1 -1
@@ -475,7 +475,7 @@ struct CPUMIPSState {CPUMIPSMVPContext mvp;#if !defined(CONFIG_USER_ONLY ) -CPUMIPSTLBContext *tlb; +CPUMIPSTLBContext tlb;#endif const mips_def_t *cpu_model;
target-mips/helper.c +18 -12
@@ -69,8 +69,8 @@ int r4k_map_address (CPUState *env, target_phys_addr_t *physical, int *prot,uint8_t ASID = env->CP0_EntryHi &0xFF ;int i; -for (i =0 ; i < env->tlb->tlb_in_use; i++) { -r4k_tlb_t *tlb = &env->tlb->mmu.r4k.tlb[i]; +for (i =0 ; i < env->tlb.tlb_in_use; i++) { +r4k_tlb_t *tlb = &env->tlb.mmu.r4k.tlb[i];/* 1k pages are not supported. */ target_ulong mask = tlb->PageMask | ~(TARGET_PAGE_MASK <<1 );target_ulong tag = address & ~mask;
@@ -124,13 +124,15 @@ static int get_physical_address (CPUState *env, target_phys_addr_t *physical, *physical = address &0xFFFFFFFF ; *prot =PAGE_READ |PAGE_WRITE ; }else { - ret = env->tlb->map_address (env, physical, prot, address, rw, access_type); + ret = env->tlb.map_address (env, physical, prot, address, rw, + access_type); }#if defined(TARGET_MIPS64 ) } else if (address < 0x4000000000000000ULL) {/* xuseg */ if (UX && address <= (0x3FFFFFFFFFFFFFFFULL & env->SEGMask)) { - ret = env->tlb->map_address (env, physical, prot, address, rw, access_type); + ret = env->tlb.map_address (env, physical, prot, address, rw, + access_type); }else { ret =TLBRET_BADADDR ; }
@@ -138,7 +140,8 @@ static int get_physical_address (CPUState *env, target_phys_addr_t *physical,/* xsseg */ if ((supervisor_mode || kernel_mode) &&SX && address <= (0x7FFFFFFFFFFFFFFFULL & env->SEGMask)) { - ret = env->tlb->map_address (env, physical, prot, address, rw, access_type); + ret = env->tlb.map_address (env, physical, prot, address, rw, + access_type); }else { ret =TLBRET_BADADDR ; }
@@ -155,7 +158,8 @@ static int get_physical_address (CPUState *env, target_phys_addr_t *physical,/* xkseg */ if (kernel_mode &&KX && address <= (0xFFFFFFFF7FFFFFFFULL & env->SEGMask)) { - ret = env->tlb->map_address (env, physical, prot, address, rw, access_type); + ret = env->tlb.map_address (env, physical, prot, address, rw, + access_type); }else { ret =TLBRET_BADADDR ; }
@@ -179,7 +183,8 @@ static int get_physical_address (CPUState *env, target_phys_addr_t *physical, }else if (address < (int32_t )0xE0000000UL ) {/* sseg (kseg2) */ if (supervisor_mode || kernel_mode) { - ret = env->tlb->map_address (env, physical, prot, address, rw, access_type); + ret = env->tlb.map_address (env, physical, prot, address, rw, + access_type); }else { ret =TLBRET_BADADDR ; }
@@ -187,7 +192,8 @@ static int get_physical_address (CPUState *env, target_phys_addr_t *physical,/* kseg3 */ /* XXX: debug segment is not emulated */ if (kernel_mode) { - ret = env->tlb->map_address (env, physical, prot, address, rw, access_type); + ret = env->tlb.map_address (env, physical, prot, address, rw, + access_type); }else { ret =TLBRET_BADADDR ; }
@@ -645,19 +651,19 @@ void r4k_invalidate_tlb (CPUState *env, int idx, int use_extra)uint8_t ASID = env->CP0_EntryHi &0xFF ;target_ulong mask; - tlb = &env->tlb->mmu.r4k.tlb[idx]; + tlb = &env->tlb.mmu.r4k.tlb[idx];/* The qemu TLB is flushed when the ASID changes, so no need to flush these entries again. */ if (tlb->G ==0 && tlb->ASID !=ASID ) {return ; } -if (use_extra && env->tlb->tlb_in_use <MIPS_TLB_MAX ) { +if (use_extra && env->tlb.tlb_in_use <MIPS_TLB_MAX ) {/* For tlbwr, we can shadow the discarded entry into a new (fake) TLB entry, as long as the guest can not tell that it's there. */ - env->tlb->mmu.r4k.tlb[env->tlb->tlb_in_use] = *tlb; - env->tlb->tlb_in_use++; + env->tlb.mmu.r4k.tlb[env->tlb.tlb_in_use] = *tlb; + env->tlb.tlb_in_use++;return ; }
target-mips/machine.c +28 -28
79 lines not on this page · raw message
target-mips/op_helper.c +20 -20
@@ -1155,7 +1155,7 @@ target_ulong helper_dmfc0_watchlo (uint32_t sel)void helper_mtc0_index (target_ulong arg1) {int num =1 ; -unsigned int tmp = env->tlb->nb_tlb; +unsigned int tmp = env->tlb.nb_tlb; do { tmp >>= 1;
@@ -1486,7 +1486,7 @@ void helper_mtc0_pagegrain (target_ulong arg1)void helper_mtc0_wired (target_ulong arg1) { - env->CP0_Wired = arg1 % env->tlb->nb_tlb; + env->CP0_Wired = arg1 % env->tlb.nb_tlb; }void helper_mtc0_srsconf0 (target_ulong arg1)
@@ -1989,14 +1989,14 @@ static void cpu_mips_tlb_flush (CPUState *env, int flush_global) {/* Flush qemu's TLB and discard all shadowed entries. */ tlb_flush (env, flush_global); - env->tlb->tlb_in_use = env->tlb->nb_tlb; + env->tlb.tlb_in_use = env->tlb.nb_tlb; }static void r4k_mips_tlb_flush_extra (CPUState *env,int first) {/* Discard entries from env->tlb[first] onwards. */ -while (env->tlb->tlb_in_use > first) { -r4k_invalidate_tlb (env, --env->tlb->tlb_in_use,0 ); +while (env->tlb.tlb_in_use > first) { +r4k_invalidate_tlb (env, --env->tlb.tlb_in_use,0 ); } }
@@ -2005,7 +2005,7 @@ static void r4k_fill_tlb (int idx)r4k_tlb_t *tlb;/* XXX: detect conflicting TLBs and raise a MCHECK exception when needed */ - tlb = &env->tlb->mmu.r4k.tlb[idx]; + tlb = &env->tlb.mmu.r4k.tlb[idx]; tlb->VPN = env->CP0_EntryHi & (TARGET_PAGE_MASK <<1 );#if defined(TARGET_MIPS64 ) tlb->VPN &= env->SEGMask;
@@ -2027,12 +2027,12 @@ void r4k_helper_tlbwi (void) {int idx; - idx = (env->CP0_Index & ~0x80000000 ) % env->tlb->nb_tlb; + idx = (env->CP0_Index & ~0x80000000 ) % env->tlb.nb_tlb;/* Discard cached TLB entries. We could avoid doing this if the tlbwi is just upgrading access permissions on the current entry; that might be a further win. */ -r4k_mips_tlb_flush_extra (env, env->tlb->nb_tlb); +r4k_mips_tlb_flush_extra (env, env->tlb.nb_tlb);r4k_invalidate_tlb (env, idx,0 );r4k_fill_tlb (idx);
@@ -2056,8 +2056,8 @@ void r4k_helper_tlbp (void)int i;ASID = env->CP0_EntryHi &0xFF ; -for (i =0 ; i < env->tlb->nb_tlb; i++) { - tlb = &env->tlb->mmu.r4k.tlb[i]; +for (i =0 ; i < env->tlb.nb_tlb; i++) { + tlb = &env->tlb.mmu.r4k.tlb[i];/* 1k pages are not supported. */ mask = tlb->PageMask | ~(TARGET_PAGE_MASK <<1 ); tag = env->CP0_EntryHi & ~mask;
@@ -2069,10 +2069,10 @@ void r4k_helper_tlbp (void)break ; } } -if (i == env->tlb->nb_tlb) { +if (i == env->tlb.nb_tlb) {/* No match. Discard any shadow entries, if any of them match. */ -for (i = env->tlb->nb_tlb; i < env->tlb->tlb_in_use; i++) { - tlb = &env->tlb->mmu.r4k.tlb[i]; +for (i = env->tlb.nb_tlb; i < env->tlb.tlb_in_use; i++) { + tlb = &env->tlb.mmu.r4k.tlb[i];/* 1k pages are not supported. */ mask = tlb->PageMask | ~(TARGET_PAGE_MASK <<1 ); tag = env->CP0_EntryHi & ~mask;
@@ -2095,14 +2095,14 @@ void r4k_helper_tlbr (void)int idx;ASID = env->CP0_EntryHi &0xFF ; - idx = (env->CP0_Index & ~0x80000000 ) % env->tlb->nb_tlb; - tlb = &env->tlb->mmu.r4k.tlb[idx]; + idx = (env->CP0_Index & ~0x80000000 ) % env->tlb.nb_tlb; + tlb = &env->tlb.mmu.r4k.tlb[idx];/* If this will change the current ASID, flush qemu's TLB. */ if (ASID != tlb->ASID)cpu_mips_tlb_flush (env,1 ); -r4k_mips_tlb_flush_extra (env, env->tlb->nb_tlb); +r4k_mips_tlb_flush_extra (env, env->tlb.nb_tlb); env->CP0_EntryHi = tlb->VPN | tlb->ASID; env->CP0_PageMask = tlb->PageMask;
@@ -2114,22 +2114,22 @@ void r4k_helper_tlbr (void)void helper_tlbwi (void ) { - env->tlb->helper_tlbwi (); + env->tlb.helper_tlbwi (); }void helper_tlbwr (void ) { - env->tlb->helper_tlbwr (); + env->tlb.helper_tlbwr (); }void helper_tlbp (void ) { - env->tlb->helper_tlbp (); + env->tlb.helper_tlbp (); }void helper_tlbr (void ) { - env->tlb->helper_tlbr (); + env->tlb.helper_tlbr (); }/* Specials */
target-mips/translate.c +10 -6
@@ -5999,26 +5999,30 @@ static void gen_cp0 (CPUState *env, DisasContext *ctx, uint32_t opc, int rt, intbreak ;case OPC_TLBWI : opn ="tlbwi" ; -if (!env->tlb->helper_tlbwi) +if (!env->tlb.helper_tlbwi) { goto die; + }gen_helper_tlbwi ();break ;case OPC_TLBWR : opn ="tlbwr" ; -if (!env->tlb->helper_tlbwr) +if (!env->tlb.helper_tlbwr) { goto die; + }gen_helper_tlbwr ();break ;case OPC_TLBP : opn ="tlbp" ; -if (!env->tlb->helper_tlbp) +if (!env->tlb.helper_tlbp) { goto die; + }gen_helper_tlbp ();break ;case OPC_TLBR : opn ="tlbr" ; -if (!env->tlb->helper_tlbr) +if (!env->tlb.helper_tlbr) { goto die; + }gen_helper_tlbr ();break ;case OPC_ERET :
@@ -12792,8 +12796,8 @@ void cpu_reset (CPUMIPSState *env) env->CP0_ErrorEPC = env->active_tc.PC; } env->active_tc.PC = (int32_t )0xBFC00000 ; - env->CP0_Random = env->tlb->nb_tlb -1 ; - env->tlb->tlb_in_use = env->tlb->nb_tlb; + env->CP0_Random = env->tlb.nb_tlb -1 ; + env->tlb.tlb_in_use = env->tlb.nb_tlb; env->CP0_Wired =0 ; env->CP0_EBase =0x80000000 | (env->cpu_index &0x3FF ); env->CP0_Status = (1 << CP0St_BEV) | (1 << CP0St_ERL);
target-mips/translate_init.c +11 -13
@@ -513,30 +513,28 @@ void mips_cpu_list (FILE *f, fprintf_function cpu_fprintf)#ifndef CONFIG_USER_ONLY static void no_mmu_init (CPUMIPSState *env,const mips_def_t *def) { - env->tlb->nb_tlb =1 ; - env->tlb->map_address = &no_mmu_map_address; + env->tlb.nb_tlb =1 ; + env->tlb.map_address = &no_mmu_map_address; }static void fixed_mmu_init (CPUMIPSState *env,const mips_def_t *def) { - env->tlb->nb_tlb =1 ; - env->tlb->map_address = &fixed_mmu_map_address; + env->tlb.nb_tlb =1 ; + env->tlb.map_address = &fixed_mmu_map_address; }static void r4k_mmu_init (CPUMIPSState *env,const mips_def_t *def) { - env->tlb->nb_tlb =1 + ((def->CP0_Config1 >>CP0C1_MMU ) &63 ); - env->tlb->map_address = &r4k_map_address; - env->tlb->helper_tlbwi = r4k_helper_tlbwi; - env->tlb->helper_tlbwr = r4k_helper_tlbwr; - env->tlb->helper_tlbp = r4k_helper_tlbp; - env->tlb->helper_tlbr = r4k_helper_tlbr; + env->tlb.nb_tlb =1 + ((def->CP0_Config1 >>CP0C1_MMU ) &63 ); + env->tlb.map_address = &r4k_map_address; + env->tlb.helper_tlbwi = r4k_helper_tlbwi; + env->tlb.helper_tlbwr = r4k_helper_tlbwr; + env->tlb.helper_tlbp = r4k_helper_tlbp; + env->tlb.helper_tlbr = r4k_helper_tlbr; }static void mmu_init (CPUMIPSState *env,const mips_def_t *def) { - env->tlb =g_malloc0 (sizeof (CPUMIPSTLBContext)); -switch (def->mmu_type) {case MMU_TYPE_NONE :no_mmu_init (env, def);
@@ -581,7 +579,7 @@ static void mvp_init (CPUMIPSState *env, const mips_def_t *def) (0x00 <<CP0MVPC0_PTC );#if !defined(CONFIG_USER_ONLY )/* Usermode has no TLB support */ - env->mvp.CP0_MVPConf0 |= (env->tlb->nb_tlb <<CP0MVPC0_PTLBE ); + env->mvp.CP0_MVPConf0 |= (env->tlb.nb_tlb <<CP0MVPC0_PTLBE );#endif /* Allocatable CP1 have media extensions, allocatable CP1 have FP support,
Signature · 1 line
1.7.6.4
PATCH 21/25 mips: bump migration version to 4
In reply to Juan Quintelabcond state was stored as int32, but it is target_ulong. Change migration state to reflect that.
--- target-mips/cpu.h | 2 +- target-mips/machine.c | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-)
target-mips/cpu.h +1 -1
@@ -507,7 +507,7 @@ void mips_cpu_list (FILE *f, fprintf_function cpu_fprintf);#define cpu_signal_handler cpu_mips_signal_handler#define cpu_list mips_cpu_list -#define CPU_SAVE_VERSION 3 +#define CPU_SAVE_VERSION 4/* MMU modes definitions. We carefully match the indices with our hflags layout. */
target-mips/machine.c +4 -6
@@ -84,8 +84,7 @@ void cpu_save(QEMUFile *f, void *opaque)qemu_put_sbe32s (f, &env->error_code);qemu_put_be32s (f, &env->hflags);qemu_put_betls (f, &env->btarget); - i = env->bcond; -qemu_put_sbe32s (f, &i); +qemu_put_betls (f, &env->bcond);/* Save remaining CP1 registers */ qemu_put_sbe32s (f, &env->CP0_Index);
@@ -193,9 +192,9 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)CPUState *env = opaque;int i; -if (version_id !=3 ) +if (version_id !=4 ) {return -EINVAL ; - + }/* Load active TC */ load_tc (f, &env->active_tc);
@@ -236,8 +235,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)qemu_get_sbe32s (f, &env->error_code);qemu_get_be32s (f, &env->hflags);qemu_get_betls (f, &env->btarget); -qemu_get_sbe32s (f, &i); - env->bcond = i; +qemu_get_betls (f, &env->bcond);/* Load remaining CP1 registers */ qemu_get_sbe32s (f, &env->CP0_Index);
Signature · 1 line
1.7.6.4
PATCH 22/25 vmstate: port mips cpu
In reply to Juan Quintela--- target-mips/cpu.h | 4 +- target-mips/machine.c | 466 +++++++++++++++++++------------------------------ 2 files changed, 185 insertions(+), 285 deletions(-)
target-mips/cpu.h +2 -2
@@ -37,6 +37,8 @@ struct r4k_tlb_t { uint_fast16_t D0:1; uint_fast16_t D1:1;target_ulong PFN [2 ]; +uint8_t asid_vmstate; +uint16_t flags_vmstate; };#if !defined(CONFIG_USER_ONLY )
@@ -507,8 +509,6 @@ void mips_cpu_list (FILE *f, fprintf_function cpu_fprintf);#define cpu_signal_handler cpu_mips_signal_handler#define cpu_list mips_cpu_list -#define CPU_SAVE_VERSION 4 -/* MMU modes definitions. We carefully match the indices with our hflags layout. */ #define MMU_MODE0_SUFFIX _kernel
target-mips/machine.c +183 -283
487 lines not on this page · raw message
Signature · 1 line
1.7.6.4
PATCH 23/25 arm: save always 32 fpu registers
In reply to Juan QuintelaThis way, we fix a bug (we were overwritten the 16 first registers on load), and we don't need to check for ARM_FEATUR_VPF3, we always send the 32 registers.
--- target-arm/cpu.h | 2 +- target-arm/machine.c | 22 ++-------------------- 2 files changed, 3 insertions(+), 21 deletions(-)
target-arm/cpu.h +1 -1
@@ -446,7 +446,7 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,#define cpu_signal_handler cpu_arm_signal_handler#define cpu_list arm_cpu_list -#define CPU_SAVE_VERSION 4 +#define CPU_SAVE_VERSION 5/* MMU modes definitions */ #define MMU_MODE0_SUFFIX _kernel
target-arm/machine.c +2 -20
@@ -60,7 +60,7 @@ void cpu_save(QEMUFile *f, void *opaque)qemu_put_be32 (f, env->features);if (arm_feature (env,ARM_FEATURE_VFP )) { -for (i =0 ; i <16 ; i++) { +for (i =0 ; i <32 ; i++) {CPU_DoubleU u; u.d = env->vfp.regs[i];qemu_put_be32 (f, u.l.upper);
@@ -73,15 +73,6 @@ void cpu_save(QEMUFile *f, void *opaque)/* TODO: Should use proper FPSCR access functions. */ qemu_put_be32 (f, env->vfp.vec_len);qemu_put_be32 (f, env->vfp.vec_stride); - -if (arm_feature (env,ARM_FEATURE_VFP3 )) { -for (i =16 ; i <32 ; i++) { -CPU_DoubleU u; - u.d = env->vfp.regs[i]; -qemu_put_be32 (f, u.l.upper); -qemu_put_be32 (f, u.l.lower); - } - } }if (arm_feature (env,ARM_FEATURE_IWMMXT )) {
@@ -174,7 +165,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) env->features =qemu_get_be32 (f);if (arm_feature (env,ARM_FEATURE_VFP )) { -for (i =0 ; i <16 ; i++) { +for (i =0 ; i <32 ; i++) {CPU_DoubleU u; u.l.upper =qemu_get_be32 (f); u.l.lower =qemu_get_be32 (f);
@@ -187,15 +178,6 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)/* TODO: Should use proper FPSCR access functions. */ env->vfp.vec_len =qemu_get_be32 (f); env->vfp.vec_stride =qemu_get_be32 (f); - -if (arm_feature (env,ARM_FEATURE_VFP3 )) { -for (i =0 ; i <16 ; i++) { -CPU_DoubleU u; - u.l.upper =qemu_get_be32 (f); - u.l.lower =qemu_get_be32 (f); - env->vfp.regs[i] = u.d; - } - } }if (arm_feature (env,ARM_FEATURE_IWMMXT )) {
Signature · 1 line
1.7.6.4
PATCH 24/25 vmstate: port arm cpu
In reply to Juan QuintelaUse one subsection for each feature. This means that we don't need to bump the version field each time that a new feature gets introduced.
Introduce cpsr_vmstate field, as I am not sure if I can "use" uncached_cpsr for saving state.
--- target-arm/cpu.h | 4 +- target-arm/machine.c | 332 ++++++++++++++++++++++--------------------------- 2 files changed, 151 insertions(+), 185 deletions(-)
target-arm/cpu.h +2 -2
@@ -228,6 +228,8 @@ typedef struct CPUARMState { } cp[15 ];void *nvic;const struct arm_boot_info *boot_info; + +uint32_t cpsr_vmstate; } CPUARMState;CPUARMState *cpu_arm_init (const char *cpu_model);
@@ -446,8 +448,6 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,#define cpu_signal_handler cpu_arm_signal_handler#define cpu_list arm_cpu_list -#define CPU_SAVE_VERSION 5 -/* MMU modes definitions */ #define MMU_MODE0_SUFFIX _kernel#define MMU_MODE1_SUFFIX _user
target-arm/machine.c +149 -183
356 lines not on this page · raw message
Signature · 1 line
1.7.6.4
Re: [Qemu-devel] [PATCH 24/25] vmstate: port arm cpu
target-arm/machine.c
Quoted 6 lines
target-arm/machine.c +3
-3-/* Avoid mode switch when restoring CPSR. */ - env->uncached_cpsr = val &CPSR_M ; -cpsr_write (env, val,0xffffffff ); + + env->uncached_cpsr = env->cpsr_vmstate &CPSR_M ; +cpsr_write (env, env->cpsr_vmstate,0xffffffff );
You've removed the helpful comment explaining why this wierdness exists. Please put it back.
A comment in cpu.h explaining what cpsr_vmstate is for would also be nice. Specifically it's a hack[1] to transfer data between the pre_save/post_load hooks and the vmstate machinery. IMO "vmstate" is a sufficiently generic term that it could be confused with some actual cpu register, especially once we get round to implementing the hypervisor extensions.
Paul
[1] Maybe a necessary hack, but still a wart from requiring static table driven vmstate descriptions.
Re: [Qemu-devel] [PATCH 24/25] vmstate: port arm cpu
Quoted 16 lines · Paul Brook
target-arm/machine.c
Quoted 6 lines
target-arm/machine.c +3
-3-/* Avoid mode switch when restoring CPSR. */ - env->uncached_cpsr = val &CPSR_M ; -cpsr_write (env, val,0xffffffff ); + + env->uncached_cpsr = env->cpsr_vmstate &CPSR_M ; +cpsr_write (env, env->cpsr_vmstate,0xffffffff );You've removed the helpful comment explaining why this wierdness exists. Please put it back.
A comment in
cpu.hexplaining whatcpsr_vmstateis for would also be nice. Specifically it's a hack[1] to transfer data between the pre_save/post_load hooks and the vmstate machinery. IMO "vmstate" is a sufficiently generic term that it could be confused with some actual cpu register, especially once we get round to implementing the hypervisor extensions.
Quoted 4 lines
Paul
[1] Maybe a necessary hack, but still a wart from requiring static table driven vmstate descriptions.
I wonder if we shouldn't make it easier to do what I do for Alpha with the rather different hack for the fpcr.
That might avoid some of the other pre/post_load hooks, and the extra data fields that requires in the cpu structure.
r~
Re: [Qemu-devel] [PATCH 24/25] vmstate: port arm cpu
Quoted 11 lines
Quoted 5 lines
target-arm/machine.c line 99
Quoted 2 lines
target-arm/machine.c +2
-0+ env->uncached_cpsr = env->cpsr_vmstate &CPSR_M ; +cpsr_write (env, env->cpsr_vmstate,0xffffffff );[1] Maybe a necessary hack, but still a wart from requiring static table driven vmstate descriptions.
I wonder if we shouldn't make it easier to do what I do for Alpha with the rather different hack for the fpcr.
That might avoid some of the other pre/post_load hooks, and the extra data fields that requires in the cpu structure.
Sounds reasonable.
Having either woraround is a bit lame. Having ARM and Alpha use different workarounds for the same problem really sucks.
Paul
PATCH 25/25 vmstate: all cpus converted
In reply to Juan QuintelaWe don't have any more CPU_SAVEVM_VERSION users, neither cpu_save/load() ones.
--- exec.c | 5 ----- qemu-common.h | 4 ---- 2 files changed, 0 insertions(+), 9 deletions(-)
exec.c +0 -5
@@ -660,13 +660,8 @@ void cpu_exec_init(CPUState *env)#endif #if !defined(CONFIG_USER_ONLY )vmstate_register (NULL , cpu_index, &vmstate_cpu_common, env); -#if defined(CPU_SAVE_VERSION ) -register_savevm (NULL ,"cpu" , cpu_index,CPU_SAVE_VERSION , - cpu_save, cpu_load, env); -#else vmstate_register (NULL , cpu_index, &vmstate_cpu, env);#endif -#endif }/* Allocate a new translation block. Flush the translation buffer if
qemu-common.h +0 -4
@@ -246,10 +246,6 @@ bool tcg_enabled(void);void cpu_exec_init_all (void ); -/* CPU save/load. */ -void cpu_save (QEMUFile *f,void *opaque); -int cpu_load (QEMUFile *f,void *opaque,int version_id); -/* Unblock cpu */ void qemu_cpu_kick (void *env);void qemu_cpu_kick_self (void );
Signature · 1 line
1.7.6.4