From 0e88d45a33928445aa3031ee76af354b4f6b3088 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Mon, 11 Jan 2016 12:40:27 +0000 Subject: target-sparc: Use VMState arrays for SPARC64 TLB/MMU state Use VMState arrays for SPARC64 TLB/MMU state. This is a migration-break for SPARC64 (but not for SPARC32), which is acceptable because currently migration does not work for any SPARC64 machines due to the lack of any migration of interrupt controller state. Signed-off-by: Peter Maydell Signed-off-by: Mark Cave-Ayland --- target-sparc/machine.c | 314 +++---------------------------------------------- 1 file changed, 19 insertions(+), 295 deletions(-) (limited to 'target-sparc') diff --git a/target-sparc/machine.c b/target-sparc/machine.c index bb9e44c..f8eebdd 100644 --- a/target-sparc/machine.c +++ b/target-sparc/machine.c @@ -93,11 +93,21 @@ static void cpu_pre_save(void *opaque) cpu_set_cwp(env, env->cwp); } +/* 32-bit SPARC retains migration compatibility with older versions + * of QEMU; 64-bit SPARC has had a migration break since then, so the + * versions are different. + */ +#ifndef TARGET_SPARC64 +#define SPARC_VMSTATE_VER 7 +#else +#define SPARC_VMSTATE_VER 8 +#endif + const VMStateDescription vmstate_sparc_cpu = { .name = "cpu", - .version_id = 7, - .minimum_version_id = 7, - .minimum_version_id_old = 7, + .version_id = SPARC_VMSTATE_VER, + .minimum_version_id = SPARC_VMSTATE_VER, + .minimum_version_id_old = SPARC_VMSTATE_VER, .pre_save = cpu_pre_save, .fields = (VMStateField[]) { VMSTATE_UINTTL_ARRAY(env.gregs, SPARCCPU, 8), @@ -134,298 +144,12 @@ const VMStateDescription vmstate_sparc_cpu = { VMSTATE_UINT64_ARRAY(env.mmubpregs, SPARCCPU, 4), #else VMSTATE_UINT64(env.lsu, SPARCCPU), - /* Unfortunately we cannot use vmstate arrays for these because - * the pre-VMState migration code sent the contents on the wire - * interleaved rather than one array at a time. - */ - VMSTATE_UINT64(env.immuregs[0], SPARCCPU), - VMSTATE_UINT64(env.dmmuregs[0], SPARCCPU), - VMSTATE_UINT64(env.immuregs[1], SPARCCPU), - VMSTATE_UINT64(env.dmmuregs[1], SPARCCPU), - VMSTATE_UINT64(env.immuregs[2], SPARCCPU), - VMSTATE_UINT64(env.dmmuregs[2], SPARCCPU), - VMSTATE_UINT64(env.immuregs[3], SPARCCPU), - VMSTATE_UINT64(env.dmmuregs[3], SPARCCPU), - VMSTATE_UINT64(env.immuregs[4], SPARCCPU), - VMSTATE_UINT64(env.dmmuregs[4], SPARCCPU), - VMSTATE_UINT64(env.immuregs[5], SPARCCPU), - VMSTATE_UINT64(env.dmmuregs[5], SPARCCPU), - VMSTATE_UINT64(env.immuregs[6], SPARCCPU), - VMSTATE_UINT64(env.dmmuregs[6], SPARCCPU), - VMSTATE_UINT64(env.immuregs[7], SPARCCPU), - VMSTATE_UINT64(env.dmmuregs[7], SPARCCPU), - VMSTATE_UINT64(env.immuregs[8], SPARCCPU), - VMSTATE_UINT64(env.dmmuregs[8], SPARCCPU), - VMSTATE_UINT64(env.immuregs[9], SPARCCPU), - VMSTATE_UINT64(env.dmmuregs[9], SPARCCPU), - VMSTATE_UINT64(env.immuregs[10], SPARCCPU), - VMSTATE_UINT64(env.dmmuregs[10], SPARCCPU), - VMSTATE_UINT64(env.immuregs[11], SPARCCPU), - VMSTATE_UINT64(env.dmmuregs[11], SPARCCPU), - VMSTATE_UINT64(env.immuregs[12], SPARCCPU), - VMSTATE_UINT64(env.dmmuregs[12], SPARCCPU), - VMSTATE_UINT64(env.immuregs[13], SPARCCPU), - VMSTATE_UINT64(env.dmmuregs[13], SPARCCPU), - VMSTATE_UINT64(env.immuregs[14], SPARCCPU), - VMSTATE_UINT64(env.dmmuregs[14], SPARCCPU), - VMSTATE_UINT64(env.immuregs[15], SPARCCPU), - VMSTATE_UINT64(env.dmmuregs[15], SPARCCPU), - VMSTATE_STRUCT(env.itlb[0], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[0], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[1], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[1], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[2], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[2], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[3], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[3], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[4], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[4], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[5], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[5], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[6], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[6], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[7], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[7], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[8], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[8], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[9], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[9], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[10], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[10], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[11], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[11], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[12], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[12], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[13], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[13], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[14], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[14], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[15], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[15], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[16], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[16], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[17], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[17], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[18], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[18], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[19], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[19], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[20], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[20], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[21], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[21], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[22], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[22], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[23], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[23], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[24], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[24], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[25], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[25], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[26], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[26], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[27], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[27], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[28], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[28], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[29], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[29], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[30], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[30], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[31], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[31], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[32], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[32], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[33], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[33], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[34], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[34], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[35], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[35], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[36], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[36], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[37], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[37], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[38], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[38], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[39], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[39], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[40], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[40], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[41], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[41], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[42], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[42], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[43], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[43], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[44], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[44], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[45], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[45], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[46], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[46], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[47], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[47], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[48], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[48], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[49], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[49], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[50], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[50], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[51], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[51], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[52], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[52], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[53], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[53], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[54], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[54], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[55], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[55], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[56], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[56], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[57], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[57], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[58], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[58], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[59], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[59], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[60], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[60], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[61], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[61], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[62], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[62], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.itlb[63], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), - VMSTATE_STRUCT(env.dtlb[63], SPARCCPU, 0, vmstate_tlb_entry, - SparcTLBEntry), + VMSTATE_UINT64_ARRAY(env.immuregs, SPARCCPU, 16), + VMSTATE_UINT64_ARRAY(env.dmmuregs, SPARCCPU, 16), + VMSTATE_STRUCT_ARRAY(env.itlb, SPARCCPU, 64, 0, + vmstate_tlb_entry, SparcTLBEntry), + VMSTATE_STRUCT_ARRAY(env.dtlb, SPARCCPU, 64, 0, + vmstate_tlb_entry, SparcTLBEntry), VMSTATE_UINT32(env.mmu_version, SPARCCPU), VMSTATE_STRUCT_ARRAY(env.ts, SPARCCPU, MAXTL_MAX, 0, vmstate_trap_state, trap_state), -- cgit v1.1