target/ppc: more cleanups around the 403 CPUs
v2 cover target/ppc: more cleanups around the 403 CPUs
Hello,
This is a follow up of "target/ppc: Finish removal of 401/403 CPUs".
To "finish" the removal, we need to get rid of the 403 protection registers under CPUPPCState. This is done after having removed the last user of .load_state_old. This change breaks migration compatibility with very old versions of QEMU but it should not be a problem.
Thanks,
C.
Cédric Le Goater (2):
target/ppc: Remove last user of .load_state_old
target/ppc: Finish removal of 401/403 CPUs
target/ppc/cpu.h | 1 - target/ppc/helper.h | 1 - target/ppc/cpu-models.c | 1 - target/ppc/machine.c | 136 --------------------------------------- target/ppc/misc_helper.c | 9 --- target/ppc/translate.c | 16 +---- 6 files changed, 1 insertion(+), 163 deletions(-)
Signature · 1 line
2.31.1
PATCH v2 1/2 target/ppc: Remove last user of .load_state_old
This breaks migration compatibility from (very) old versions of QEMU. This should not be a problem for the pseries machine for which migration is only supported on recent QEMUs ( > 2.x). There is no clear status on what is supported or not for the other machines. Let's move forward and remove the .load_state_old handler.
--- target/ppc/machine.c | 112 ------------------------------------------- 1 file changed, 112 deletions(-)
target/ppc/machine.c +0 -112
@@ -23,117 +23,6 @@ static void post_load_update_msr(CPUPPCState *env)pmu_update_summaries (env); } -static int cpu_load_old (QEMUFile *f,void *opaque,int version_id) -{ -PowerPCCPU *cpu = opaque; -CPUPPCState *env = &cpu->env; -unsigned int i, j; -target_ulong sdr1; -uint32_t fpscr, vscr; -#if defined(TARGET_PPC64 ) -int32_t slb_nr; -#endif -target_ulong xer; - -for (i =0 ; i <32 ; i++) { -qemu_get_betls (f, &env->gpr[i]); - } -#if !defined(TARGET_PPC64 ) -for (i =0 ; i <32 ; i++) { -qemu_get_betls (f, &env->gprh[i]); - } -#endif -qemu_get_betls (f, &env->lr); -qemu_get_betls (f, &env->ctr); -for (i =0 ; i <8 ; i++) { -qemu_get_be32s (f, &env->crf[i]); - } -qemu_get_betls (f, &xer); -cpu_write_xer (env, xer); -qemu_get_betls (f, &env->reserve_addr); -qemu_get_betls (f, &env->msr); -for (i =0 ; i <4 ; i++) { -qemu_get_betls (f, &env->tgpr[i]); - } -for (i =0 ; i <32 ; i++) { -union { -float64 d; -uint64_t l; - } u; - u.l =qemu_get_be64 (f); - *cpu_fpr_ptr (env, i) = u.d; - } -qemu_get_be32s (f, &fpscr); - env->fpscr = fpscr; -qemu_get_sbe32s (f, &env->access_type); -#if defined(TARGET_PPC64 ) -qemu_get_betls (f, &env->spr[SPR_ASR ]); -qemu_get_sbe32s (f, &slb_nr); -#endif -qemu_get_betls (f, &sdr1); -for (i =0 ; i <32 ; i++) { -qemu_get_betls (f, &env->sr[i]); - } -for (i =0 ; i <2 ; i++) { -for (j =0 ; j <8 ; j++) { -qemu_get_betls (f, &env->DBAT[i][j]); - } - } -for (i =0 ; i <2 ; i++) { -for (j =0 ; j <8 ; j++) { -qemu_get_betls (f, &env->IBAT[i][j]); - } - } -qemu_get_sbe32s (f, &env->nb_tlb); -qemu_get_sbe32s (f, &env->tlb_per_way); -qemu_get_sbe32s (f, &env->nb_ways); -qemu_get_sbe32s (f, &env->last_way); -qemu_get_sbe32s (f, &env->id_tlbs); -qemu_get_sbe32s (f, &env->nb_pids); -if (env->tlb.tlb6) { -/* XXX assumes 6xx */ -for (i =0 ; i < env->nb_tlb; i++) { -qemu_get_betls (f, &env->tlb.tlb6[i].pte0); -qemu_get_betls (f, &env->tlb.tlb6[i].pte1); -qemu_get_betls (f, &env->tlb.tlb6[i].EPN); - } - } -for (i =0 ; i <4 ; i++) { -qemu_get_betls (f, &env->pb[i]); - } -for (i =0 ; i <1024 ; i++) { -qemu_get_betls (f, &env->spr[i]); - } -if (!cpu->vhyp) { -ppc_store_sdr1 (env, sdr1); - } -qemu_get_be32s (f, &vscr); -ppc_store_vscr (env, vscr); -qemu_get_be64s (f, &env->spe_acc); -qemu_get_be32s (f, &env->spe_fscr); -qemu_get_betls (f, &env->msr_mask); -qemu_get_be32s (f, &env->flags); -qemu_get_sbe32s (f, &env->error_code); -qemu_get_be32s (f, &env->pending_interrupts); -qemu_get_be32s (f, &env->irq_input_state); -for (i =0 ; i <POWERPC_EXCP_NB ; i++) { -qemu_get_betls (f, &env->excp_vectors[i]); - } -qemu_get_betls (f, &env->excp_prefix); -qemu_get_betls (f, &env->ivor_mask); -qemu_get_betls (f, &env->ivpr_mask); -qemu_get_betls (f, &env->hreset_vector); -qemu_get_betls (f, &env->nip); -qemu_get_sbetl (f);/* Discard unused hflags */ -qemu_get_sbetl (f);/* Discard unused hflags_nmsr */ -qemu_get_sbe32 (f);/* Discard unused mmu_idx */ -qemu_get_sbe32 (f);/* Discard unused power_mode */ - -post_load_update_msr (env); - -return 0 ; -} -static int get_avr (QEMUFile *f,void *pv,size_t size,const VMStateField *field) {
@@ -808,7 +697,6 @@ const VMStateDescription vmstate_ppc_cpu = { .version_id = 5, .minimum_version_id = 5, .minimum_version_id_old = 4, - .load_state_old = cpu_load_old, .pre_save = cpu_pre_save, .post_load = cpu_post_load, .fields = (VMStateField []) {
Signature · 1 line
2.31.1
Re: [PATCH v2 1/2] target/ppc: Remove last user of .load_state_old
Quoted 7 lines · Cédric le Goater
This breaks migration compatibility from (very) old versions of QEMU. This should not be a problem for the pseries machine for which migration is only supported on recent QEMUs ( > 2.x). There is no clear status on what is supported or not for the other machines. Let's move forward and remove the .load_state_old handler.
Signed-off-by Cédric Le Goater <[email protected]>
Quoted 134 lines
--- target/ppc/machine.c | 112 ------------------------------------------- 1 file changed, 112 deletions(-)target/ppc/machine.c +0
-112@@ -23,117 +23,6 @@ static void post_load_update_msr(CPUPPCState *env)pmu_update_summaries (env); } -static int cpu_load_old (QEMUFile *f,void *opaque,int version_id) -{ -PowerPCCPU *cpu = opaque; -CPUPPCState *env = &cpu->env; -unsigned int i, j; -target_ulong sdr1; -uint32_t fpscr, vscr; -#if defined(TARGET_PPC64 ) -int32_t slb_nr; -#endif -target_ulong xer; - -for (i =0 ; i <32 ; i++) { -qemu_get_betls (f, &env->gpr[i]); - } -#if !defined(TARGET_PPC64 ) -for (i =0 ; i <32 ; i++) { -qemu_get_betls (f, &env->gprh[i]); - } -#endif -qemu_get_betls (f, &env->lr); -qemu_get_betls (f, &env->ctr); -for (i =0 ; i <8 ; i++) { -qemu_get_be32s (f, &env->crf[i]); - } -qemu_get_betls (f, &xer); -cpu_write_xer (env, xer); -qemu_get_betls (f, &env->reserve_addr); -qemu_get_betls (f, &env->msr); -for (i =0 ; i <4 ; i++) { -qemu_get_betls (f, &env->tgpr[i]); - } -for (i =0 ; i <32 ; i++) { -union { -float64 d; -uint64_t l; - } u; - u.l =qemu_get_be64 (f); - *cpu_fpr_ptr (env, i) = u.d; - } -qemu_get_be32s (f, &fpscr); - env->fpscr = fpscr; -qemu_get_sbe32s (f, &env->access_type); -#if defined(TARGET_PPC64 ) -qemu_get_betls (f, &env->spr[SPR_ASR ]); -qemu_get_sbe32s (f, &slb_nr); -#endif -qemu_get_betls (f, &sdr1); -for (i =0 ; i <32 ; i++) { -qemu_get_betls (f, &env->sr[i]); - } -for (i =0 ; i <2 ; i++) { -for (j =0 ; j <8 ; j++) { -qemu_get_betls (f, &env->DBAT[i][j]); - } - } -for (i =0 ; i <2 ; i++) { -for (j =0 ; j <8 ; j++) { -qemu_get_betls (f, &env->IBAT[i][j]); - } - } -qemu_get_sbe32s (f, &env->nb_tlb); -qemu_get_sbe32s (f, &env->tlb_per_way); -qemu_get_sbe32s (f, &env->nb_ways); -qemu_get_sbe32s (f, &env->last_way); -qemu_get_sbe32s (f, &env->id_tlbs); -qemu_get_sbe32s (f, &env->nb_pids); -if (env->tlb.tlb6) { -/* XXX assumes 6xx */ -for (i =0 ; i < env->nb_tlb; i++) { -qemu_get_betls (f, &env->tlb.tlb6[i].pte0); -qemu_get_betls (f, &env->tlb.tlb6[i].pte1); -qemu_get_betls (f, &env->tlb.tlb6[i].EPN); - } - } -for (i =0 ; i <4 ; i++) { -qemu_get_betls (f, &env->pb[i]); - } -for (i =0 ; i <1024 ; i++) { -qemu_get_betls (f, &env->spr[i]); - } -if (!cpu->vhyp) { -ppc_store_sdr1 (env, sdr1); - } -qemu_get_be32s (f, &vscr); -ppc_store_vscr (env, vscr); -qemu_get_be64s (f, &env->spe_acc); -qemu_get_be32s (f, &env->spe_fscr); -qemu_get_betls (f, &env->msr_mask); -qemu_get_be32s (f, &env->flags); -qemu_get_sbe32s (f, &env->error_code); -qemu_get_be32s (f, &env->pending_interrupts); -qemu_get_be32s (f, &env->irq_input_state); -for (i =0 ; i <POWERPC_EXCP_NB ; i++) { -qemu_get_betls (f, &env->excp_vectors[i]); - } -qemu_get_betls (f, &env->excp_prefix); -qemu_get_betls (f, &env->ivor_mask); -qemu_get_betls (f, &env->ivpr_mask); -qemu_get_betls (f, &env->hreset_vector); -qemu_get_betls (f, &env->nip); -qemu_get_sbetl (f);/* Discard unused hflags */ -qemu_get_sbetl (f);/* Discard unused hflags_nmsr */ -qemu_get_sbe32 (f);/* Discard unused mmu_idx */ -qemu_get_sbe32 (f);/* Discard unused power_mode */ - -post_load_update_msr (env); - -return 0 ; -} -static int get_avr (QEMUFile *f,void *pv,size_t size,const VMStateField *field) {@@ -808,7 +697,6 @@ const VMStateDescription vmstate_ppc_cpu = { .version_id = 5, .minimum_version_id = 5, .minimum_version_id_old = 4, - .load_state_old = cpu_load_old, .pre_save = cpu_pre_save, .post_load = cpu_post_load, .fields = (VMStateField []) {
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [PATCH v2 1/2] target/ppc: Remove last user of .load_state_old
In reply to Cédric Le GoaterQuoted 22 lines · Cédric Le Goater
This breaks migration compatibility from (very) old versions of QEMU. This should not be a problem for the pseries machine for which migration is only supported on recent QEMUs ( > 2.x). There is no clear status on what is supported or not for the other machines. Let's move forward and remove the .load_state_old handler.
Signed-off-by Cédric Le Goater <[email protected]>--- target/ppc/machine.c | 112 ------------------------------------------- 1 file changed, 112 deletions(-)target/ppc/machine.c +0
-3@@ -23,117 +23,6 @@ static void post_load_update_msr(CPUPPCState *env)pmu_update_summaries (env); } -static int cpu_load_old (QEMUFile *f,void *opaque,int version_id) -{ -PowerPCCPU *cpu = opaque;
<snip>
target/ppc/machine.c const VMStateDescription vmstate_ppc_cpu = { · line 811
Quoted 9 lines
target/ppc/machine.c +0
-2-static int get_avr (QEMUFile *f,void *pv,size_t size,const VMStateField *field) {@@ -808,7 +697,6 @@ const VMStateDescription vmstate_ppc_cpu = { .version_id = 5, .minimum_version_id = 5, .minimum_version_id_old = 4, - .load_state_old = cpu_load_old,
According to docs/devel/migration.rst, .minimum_version_id_old is ignored if no load_state_old handler is provided, I think we can drop it too.
Quoted 5 lines
target/ppc/machine.c +0
-1.pre_save = cpu_pre_save, .post_load = cpu_post_load, .fields = (VMStateField []) { --2.31.1
Thanks,
Matheus K. Ferst
Instituto de Pesquisas ELDORADO <http://www.eldorado.org.br/>
Analista de Software
Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>
Re: [PATCH v2 1/2] target/ppc: Remove last user of .load_state_old
Quoted 27 lines · Matheus K. Ferst
Quoted 22 lines · Cédric Le Goater
This breaks migration compatibility from (very) old versions of QEMU. This should not be a problem for the pseries machine for which migration is only supported on recent QEMUs ( > 2.x). There is no clear status on what is supported or not for the other machines. Let's move forward and remove the .load_state_old handler.
Signed-off-by Cédric Le Goater <[email protected]>--- target/ppc/machine.c | 112 ------------------------------------------- 1 file changed, 112 deletions(-)target/ppc/machine.c +0
-3@@ -23,117 +23,6 @@ static void post_load_update_msr(CPUPPCState *env)pmu_update_summaries (env); } -static int cpu_load_old (QEMUFile *f,void *opaque,int version_id) -{ -PowerPCCPU *cpu = opaque;<snip>
Quoted 13 lines
target/ppc/machine.c const VMStateDescription vmstate_ppc_cpu = { · line 811
Quoted 9 lines
target/ppc/machine.c +0
-2-static int get_avr (QEMUFile *f,void *pv,size_t size,const VMStateField *field) {@@ -808,7 +697,6 @@ const VMStateDescription vmstate_ppc_cpu = { .version_id = 5, .minimum_version_id = 5, .minimum_version_id_old = 4, - .load_state_old = cpu_load_old,According to
docs/devel/migration.rst, .minimum_version_id_old is ignored if noload_state_oldhandler is provided, I think we can drop it too.
Yes; the migration code only checks the field if load_state_old is non-NULL.
-- PMM
PATCH v2 2/2 target/ppc: Finish removal of 401/403 CPUs
In reply to Cédric Le GoaterCommit c8f49e6b938e ("target/ppc: remove 401/403 CPUs") left a few things behind.
Message-Id: <[email protected]>
---
Changes in v2:
- Removal of the 403 protection registers
target/ppc/cpu.h | 1 - target/ppc/helper.h | 1 - target/ppc/cpu-models.c | 1 - target/ppc/machine.c | 24 ------------------------ target/ppc/misc_helper.c | 9 --------- target/ppc/translate.c | 16 +--------------- 6 files changed, 1 insertion(+), 51 deletions(-)
target/ppc/cpu.h +0 -1
@@ -1133,7 +1133,6 @@ struct CPUPPCState {int nb_pids;/* Number of available PID registers */ int tlb_type;/* Type of TLB we're dealing with */ ppc_tlb_t tlb;/* TLB is optional. Allocate them only if needed */ -target_ulong pb[4 ];/* 403 dedicated access protection registers */ bool tlb_dirty;/* Set to non-zero when modifying TLB */ bool kvm_sw_tlb;/* non-zero if KVM SW TLB API is active */ uint32_t tlb_need_flush;/* Delayed flush needed */
target/ppc/helper.h +0 -1
@@ -703,7 +703,6 @@ DEF_HELPER_FLAGS_2(store_hdecr, TCG_CALL_NO_RWG, void, env, tl) DEF_HELPER_FLAGS_2(store_vtb, TCG_CALL_NO_RWG, void, env, tl) DEF_HELPER_FLAGS_2(store_tbu40, TCG_CALL_NO_RWG, void, env, tl) DEF_HELPER_2(store_hid0_601, void, env, tl) -DEF_HELPER_3(store_403_pbr, void, env, i32, tl) DEF_HELPER_FLAGS_1(load_40x_pit, TCG_CALL_NO_RWG, tl, env) DEF_HELPER_FLAGS_2(store_40x_pit, TCG_CALL_NO_RWG, void, env, tl)DEF_HELPER_FLAGS_2 (store_40x_tcr,TCG_CALL_NO_RWG , void, env, tl)
target/ppc/cpu-models.c +0 -1
@@ -750,7 +750,6 @@/* PowerPC CPU aliases */ PowerPCCPUAlias ppc_cpu_aliases[] = { - {"403" ,"403gc" }, {"405" ,"405d4" }, {"405cr" ,"405crc" }, {"405gp" ,"405gpd" },
target/ppc/machine.c +0 -24
@@ -598,25 +598,6 @@ static bool tlbemb_needed(void *opaque)return env->nb_tlb && (env->tlb_type ==TLB_EMB ); } -static bool pbr403_needed (void *opaque) -{ -PowerPCCPU *cpu = opaque; -uint32_t pvr = cpu->env.spr[SPR_PVR ]; - -return (pvr &0xffff0000 ) ==0x00200000 ; -} - -static const VMStateDescription vmstate_pbr403 = { - .name ="cpu/pbr403" , - .version_id =1 , - .minimum_version_id =1 , - .needed = pbr403_needed, - .fields = (VMStateField []) { -VMSTATE_UINTTL_ARRAY (env.pb, PowerPCCPU,4 ), -VMSTATE_END_OF_LIST () - }, -}; -static const VMStateDescription vmstate_tlbemb = { .name ="cpu/tlb6xx" , .version_id =1 ,
@@ -628,13 +609,8 @@ static const VMStateDescription vmstate_tlbemb = { env.nb_tlb, vmstate_tlbemb_entry, ppcemb_tlb_t), -/* 403 protection registers */ VMSTATE_END_OF_LIST () }, - .subsections = (const VMStateDescription *[]) { - &vmstate_pbr403, -NULL - } };static const VMStateDescription vmstate_tlbmas_entry = {
target/ppc/misc_helper.c +0 -9
@@ -226,15 +226,6 @@ void helper_store_hid0_601(CPUPPCState *env, target_ulong val) } } -void helper_store_403_pbr (CPUPPCState *env,uint32_t num,target_ulong value) -{ -if (likely (env->pb[num] != value)) { - env->pb[num] = value; -/* Should be optimized */ -tlb_flush (env_cpu (env)); - } -} -void helper_store_40x_dbcr0 (CPUPPCState *env,target_ulong val) {/* Bits 26 & 27 affect single-stepping. */
target/ppc/translate.c +1 -15
@@ -911,22 +911,8 @@ void spr_write_booke_tsr(DisasContext *ctx, int sprn, int gprn) }#endif -/* PowerPC 403 specific registers */ -/* PBL1 / PBU1 / PBL2 / PBU2 */ +/* PIR */ #if !defined(CONFIG_USER_ONLY ) -void spr_read_403_pbr (DisasContext *ctx,int gprn,int sprn) -{ -tcg_gen_ld_tl (cpu_gpr[gprn], cpu_env, - offsetof(CPUPPCState, pb[sprn - SPR_403_PBL1])); -} - -void spr_write_403_pbr (DisasContext *ctx,int sprn,int gprn) -{ -TCGv_i32 t0 =tcg_const_i32 (sprn -SPR_403_PBL1 ); -gen_helper_store_403_pbr (cpu_env, t0, cpu_gpr[gprn]); -tcg_temp_free_i32 (t0); -} -void spr_write_pir (DisasContext *ctx,int sprn,int gprn) {TCGv t0 =tcg_temp_new ();
Signature · 1 line
2.31.1
Cédric Le Goater
AppliedQuoted 10 lines · Cédric Le Goater
Hello,
This is a follow up of "target/ppc: Finish removal of 401/403 CPUs".
To "finish" the removal, we need to get rid of the 403 protection registers under CPUPPCState. This is done after having removed the last user of .load_state_old. This change breaks migration compatibility with very old versions of QEMU but it should not be a problem.
Quoted 7 lines
Thanks,
C.
Cédric Le Goater (2):
target/ppc: Remove last user of .load_state_old target/ppc: Finish removal of 401/403 CPUs
Applied to ppc-7.0
Thanks,
C.