target/microblaze: Remove all uses of target_ulong type
cover target/microblaze: Remove all uses of target_ulong type
Remove the left over target_ulong uses in MicroBlaze frontend.
Philippe Mathieu-Daudé (5):
target/microblaze: Remove target_ulong use in cpu_handle_mmu_fault() target/microblaze: Remove target_ulong uses in
get_phys_page_attrs_debug
target/microblaze: Remove target_ulong use in gen_goto_tb() target/microblaze: Remove target_ulong use in helper_stackprot() target/microblaze: Convert CPUMBState::res_addr field to uint32_t type
target/microblaze/cpu.h | 2 +- target/microblaze/helper.h | 2 +- target/microblaze/mmu.h | 2 +- target/microblaze/helper.c | 3 ++- target/microblaze/machine.c | 6 +++--- target/microblaze/mmu.c | 4 ++-- target/microblaze/op_helper.c | 4 ++-- target/microblaze/translate.c | 19 ++++++++++--------- 8 files changed, 22 insertions(+), 20 deletions(-)
Signature · 1 line
2.51.0
PATCH 1/5 target/microblaze: Remove target_ulong use in cpu_handle_mmu_fault()
cpu_handle_mmu_fault() -- renamed in commit f429d607c71 -- expects a vaddr type for its address argument since commit 7510454e3e7 ("cpu: Turn cpu_handle_mmu_fault() into a CPUClass hook").
--- target/microblaze/mmu.h | 2 +- target/microblaze/mmu.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
target/microblaze/mmu.h +1 -1
@@ -86,7 +86,7 @@ typedef struct { } MicroBlazeMMULookup;unsigned int mmu_translate (MicroBlazeCPU *cpu,MicroBlazeMMULookup *lu, -target_ulong vaddr,MMUAccessType rw,int mmu_idx); +vaddr vaddr,MMUAccessType rw,int mmu_idx);uint32_t mmu_read (CPUMBState *env,bool ea,uint32_t rn);void mmu_write (CPUMBState *env,bool ea,uint32_t rn,uint32_t v);void mmu_init (MicroBlazeMMU *mmu);
target/microblaze/mmu.c +2 -2
@@ -78,7 +78,7 @@ static void mmu_change_pid(CPUMBState *env, unsigned int newpid)/* rw - 0 = read, 1 = write, 2 = fetch. */ unsigned int mmu_translate (MicroBlazeCPU *cpu,MicroBlazeMMULookup *lu, -target_ulong vaddr,MMUAccessType rw,int mmu_idx) +vaddr vaddr,MMUAccessType rw,int mmu_idx) {MicroBlazeMMU *mmu = &cpu->env.mmu;unsigned int i, hit =0 ;
@@ -172,7 +172,7 @@ unsigned int mmu_translate(MicroBlazeCPU *cpu, MicroBlazeMMULookup *lu, } done:qemu_log_mask (CPU_LOG_MMU , -"MMU vaddr=0x" TARGET_FMT_lx +"MMU vaddr=0x%" VADDR_PRIx" rw=%d tlb_wr=%d tlb_ex=%d hit=%d\n" , vaddr, rw, tlb_wr, tlb_ex, hit);return hit;
Signature · 1 line
2.51.0
Re: [PATCH 1/5] target/microblaze: Remove target_ulong use in cpu_handle_mmu_fault()
Quoted 28 lines · Philippe Mathieu-Daudé
cpu_handle_mmu_fault()-- renamed in commitf429d607c71-- expects a vaddr type for its address argument since commit7510454e3e7("cpu: Turncpu_handle_mmu_fault()into a CPUClass hook").Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/microblaze/mmu.h | 2 +- target/microblaze/mmu.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)target/microblaze/mmu.h +1
-1@@ -86,7 +86,7 @@ typedef struct { } MicroBlazeMMULookup;unsigned int mmu_translate (MicroBlazeCPU *cpu,MicroBlazeMMULookup *lu, -target_ulong vaddr,MMUAccessType rw,int mmu_idx); +vaddr vaddr,MMUAccessType rw,int mmu_idx);uint32_t mmu_read (CPUMBState *env,bool ea,uint32_t rn);void mmu_write (CPUMBState *env,bool ea,uint32_t rn,uint32_t v);void mmu_init (MicroBlazeMMU *mmu);target/microblaze/mmu.c +0
-0
target/microblaze/mmu.c static void mmu_change_pid(CPUMBState *env, unsigned int newpid) · line 81
Quoted 5 lines
target/microblaze/mmu.c +1
-1@@ -78,7 +78,7 @@ static void mmu_change_pid(CPUMBState *env, unsigned int newpid)/* rw - 0 = read, 1 = write, 2 = fetch. */ unsigned int mmu_translate (MicroBlazeCPU *cpu,MicroBlazeMMULookup *lu, -target_ulong vaddr,MMUAccessType rw,int mmu_idx) +vaddr vaddr,MMUAccessType rw,int mmu_idx)
vaddr vaddr looks a bit awkward, but very nitty and not like it really matters.
Re: [PATCH 1/5] target/microblaze: Remove target_ulong use in cpu_handle_mmu_fault()
In reply to Philippe Mathieu-DaudéQuoted 9 lines · Philippe Mathieu-Daudé
cpu_handle_mmu_fault()-- renamed in commitf429d607c71-- expects a vaddr type for its address argument since commit7510454e3e7("cpu: Turncpu_handle_mmu_fault()into a CPUClass hook").Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/microblaze/mmu.h | 2 +- target/microblaze/mmu.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
PATCH 2/5 target/microblaze: Remove target_ulong uses in get_phys_page_attrs_debug
In reply to Philippe Mathieu-DaudéThe CPUClass::get_phys_page_debug() handler takes a 'vaddr' address and return a 'hwaddr' type since commit 00b941e581b ("cpu: Turn cpu_get_phys_page_debug() into a CPUClass hook").
--- target/microblaze/helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/microblaze/helper.c +2 -1
@@ -274,7 +274,8 @@ hwaddr mb_cpu_get_phys_page_attrs_debug(CPUState *cs, vaddr addr, MemTxAttrs *attrs) {MicroBlazeCPU *cpu =MICROBLAZE_CPU (cs); -target_ulong vaddr, paddr =0 ; +vaddr vaddr; +hwaddr paddr =0 ;MicroBlazeMMULookup lu;int mmu_idx =cpu_mmu_index (cs, false);unsigned int hit;
Signature · 1 line
2.51.0
Re: [PATCH 2/5] target/microblaze: Remove target_ulong uses in get_phys_page_attrs_debug
Quoted 14 lines · Philippe Mathieu-Daudé
The
CPUClass::get_phys_page_debug()handler takes a 'vaddr' address and return a 'hwaddr' type since commit00b941e581b("cpu: Turncpu_get_phys_page_debug()into a CPUClass hook").Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/microblaze/helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)target/microblaze/helper.c +0
-0
target/microblaze/helper.c hwaddr mb_cpu_get_phys_page_attrs_debug(CPUState *cs, vaddr addr, · line 281
Quoted 9 lines
target/microblaze/helper.c +2
-1@@ -274,7 +274,8 @@ hwaddr mb_cpu_get_phys_page_attrs_debug(CPUState *cs, vaddr addr, MemTxAttrs *attrs) {MicroBlazeCPU *cpu =MICROBLAZE_CPU (cs); -target_ulong vaddr, paddr =0 ; +vaddr vaddr; +hwaddr paddr =0 ;MicroBlazeMMULookup lu;int mmu_idx =cpu_mmu_index (cs, false);unsigned int hit;
PATCH 3/5 target/microblaze: Remove target_ulong use in gen_goto_tb()
In reply to Philippe Mathieu-Daudétranslator_use_goto_tb() expects a vaddr type since commit b1c09220b4c ("accel/tcg: Replace target_ulong with vaddr in translator_*()").
--- target/microblaze/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/microblaze/translate.c +1 -1
@@ -116,7 +116,7 @@ static void gen_raise_hw_excp(DisasContext *dc, uint32_t esr_ec)gen_raise_exception_sync (dc,EXCP_HW_EXCP ); } -static void gen_goto_tb (DisasContext *dc,int n,target_ulong dest) +static void gen_goto_tb (DisasContext *dc,int n,vaddr dest) {if (translator_use_goto_tb (&dc->base, dest)) {tcg_gen_goto_tb (n);
Signature · 1 line
2.51.0
Re: [PATCH 3/5] target/microblaze: Remove target_ulong use in gen_goto_tb()
Quoted 25 lines · Philippe Mathieu-Daudé
translator_use_goto_tb()expects a vaddr type since commitb1c09220b4c("accel/tcg: Replacetarget_ulongwith vaddr in translator_*()").Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/microblaze/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/microblaze/translate.c +1
-1@@ -116,7 +116,7 @@ static void gen_raise_hw_excp(DisasContext *dc, uint32_t esr_ec)gen_raise_exception_sync (dc,EXCP_HW_EXCP ); } -static void gen_goto_tb (DisasContext *dc,int n,target_ulong dest) +static void gen_goto_tb (DisasContext *dc,int n,vaddr dest) {if (translator_use_goto_tb (&dc->base, dest)) {tcg_gen_goto_tb (n);Signature · 1 line
2.51.0
Re: [PATCH 3/5] target/microblaze: Remove target_ulong use in gen_goto_tb()
In reply to Philippe Mathieu-DaudéQuoted 14 lines · Philippe Mathieu-Daudé
translator_use_goto_tb()expects a vaddr type since commitb1c09220b4c("accel/tcg: Replacetarget_ulongwith vaddr in translator_*()").Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/microblaze/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/microblaze/translate.c +0
-0
target/microblaze/translate.c static void gen_raise_hw_excp(DisasContext *dc, uint32_t esr_ec) · line 122
Quoted 8 lines
target/microblaze/translate.c +1
-1@@ -116,7 +116,7 @@ static void gen_raise_hw_excp(DisasContext *dc, uint32_t esr_ec)gen_raise_exception_sync (dc,EXCP_HW_EXCP ); } -static void gen_goto_tb (DisasContext *dc,int n,target_ulong dest) +static void gen_goto_tb (DisasContext *dc,int n,vaddr dest) {if (translator_use_goto_tb (&dc->base, dest)) {tcg_gen_goto_tb (n);
PATCH 4/5 target/microblaze: Remove target_ulong use in helper_stackprot()
In reply to Philippe Mathieu-DaudéSince commit 36a9529e60e ("target/microblaze: Simplify compute_ldst_addr_type{a,b}"), helper_stackprot() takes a TCGv_i32 argument.
--- target/microblaze/helper.h | 2 +- target/microblaze/op_helper.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
target/microblaze/helper.h +1 -1
@@ -20,7 +20,7 @@ DEF_HELPER_FLAGS_3(fcmp_ne, TCG_CALL_NO_WG, i32, env, i32, i32) DEF_HELPER_FLAGS_3(fcmp_ge, TCG_CALL_NO_WG, i32, env, i32, i32) DEF_HELPER_FLAGS_2(pcmpbf, TCG_CALL_NO_RWG_SE, i32, i32, i32) -DEF_HELPER_FLAGS_2(stackprot, TCG_CALL_NO_WG, void, env, tl) +DEF_HELPER_FLAGS_2(stackprot, TCG_CALL_NO_WG, void, env, i32) DEF_HELPER_FLAGS_2(get, TCG_CALL_NO_RWG, i32, i32, i32)DEF_HELPER_FLAGS_3 (put,TCG_CALL_NO_RWG , void, i32, i32, i32)
target/microblaze/op_helper.c +2 -2
@@ -365,13 +365,13 @@ uint32_t helper_pcmpbf(uint32_t a, uint32_t b)return 0 ; } -void helper_stackprot (CPUMBState *env,target_ulong addr) +void helper_stackprot (CPUMBState *env,uint32_t addr) {if (addr < env->slr || addr > env->shr) {CPUState *cs =env_cpu (env);qemu_log_mask (CPU_LOG_INT ,"Stack protector violation at " - TARGET_FMT_lx" %x %x\n" , +"0x%x 0x%x 0x%x\n" , addr, env->slr, env->shr); env->ear = addr;
Signature · 1 line
2.51.0
Re: [PATCH 4/5] target/microblaze: Remove target_ulong use in helper_stackprot()
Quoted 46 lines · Philippe Mathieu-Daudé
Since commit
36a9529e60e("target/microblaze: Simplify compute_ldst_addr_type{a,b}"),helper_stackprot()takes aTCGv_i32argument.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/microblaze/helper.h | 2 +- target/microblaze/op_helper.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)target/microblaze/helper.h +1
-1@@ -20,7 +20,7 @@ DEF_HELPER_FLAGS_3(fcmp_ne, TCG_CALL_NO_WG, i32, env, i32, i32) DEF_HELPER_FLAGS_3(fcmp_ge, TCG_CALL_NO_WG, i32, env, i32, i32) DEF_HELPER_FLAGS_2(pcmpbf, TCG_CALL_NO_RWG_SE, i32, i32, i32) -DEF_HELPER_FLAGS_2(stackprot, TCG_CALL_NO_WG, void, env, tl) +DEF_HELPER_FLAGS_2(stackprot, TCG_CALL_NO_WG, void, env, i32) DEF_HELPER_FLAGS_2(get, TCG_CALL_NO_RWG, i32, i32, i32)DEF_HELPER_FLAGS_3 (put,TCG_CALL_NO_RWG , void, i32, i32, i32)target/microblaze/op_helper.c +2
-2@@ -365,13 +365,13 @@ uint32_t helper_pcmpbf(uint32_t a, uint32_t b)return 0 ; } -void helper_stackprot (CPUMBState *env,target_ulong addr) +void helper_stackprot (CPUMBState *env,uint32_t addr) {if (addr < env->slr || addr > env->shr) {CPUState *cs =env_cpu (env);qemu_log_mask (CPU_LOG_INT ,"Stack protector violation at " - TARGET_FMT_lx" %x %x\n" , +"0x%x 0x%x 0x%x\n" , addr, env->slr, env->shr); env->ear = addr;Signature · 1 line
2.51.0
Might as well update call sites to gen_helper_stackprot() as well. compute_ldst_addr_type[ab]() calls into gen_helper_stackprot() but returns TCGv. That return value is passed to do_load() and do_store() as TCGv, but the bodies of these function clearly expect TCG_i32.
Otherwise
Re: [PATCH 4/5] target/microblaze: Remove target_ulong use in helper_stackprot()
Quoted 43 lines · Anton Johansson
Quoted 42 lines · Philippe Mathieu-Daudé
Since commit
36a9529e60e("target/microblaze: Simplify compute_ldst_addr_type{a,b}"),helper_stackprot()takes aTCGv_i32argument.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/microblaze/helper.h | 2 +- target/microblaze/op_helper.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)target/microblaze/helper.h +1
-1@@ -20,7 +20,7 @@ DEF_HELPER_FLAGS_3(fcmp_ne, TCG_CALL_NO_WG, i32, env, i32, i32) DEF_HELPER_FLAGS_3(fcmp_ge, TCG_CALL_NO_WG, i32, env, i32, i32) DEF_HELPER_FLAGS_2(pcmpbf, TCG_CALL_NO_RWG_SE, i32, i32, i32) -DEF_HELPER_FLAGS_2(stackprot, TCG_CALL_NO_WG, void, env, tl) +DEF_HELPER_FLAGS_2(stackprot, TCG_CALL_NO_WG, void, env, i32) DEF_HELPER_FLAGS_2(get, TCG_CALL_NO_RWG, i32, i32, i32)DEF_HELPER_FLAGS_3 (put,TCG_CALL_NO_RWG , void, i32, i32, i32)target/microblaze/op_helper.c +2
-2@@ -365,13 +365,13 @@ uint32_t helper_pcmpbf(uint32_t a, uint32_t b)return 0 ; } -void helper_stackprot (CPUMBState *env,target_ulong addr) +void helper_stackprot (CPUMBState *env,uint32_t addr) {if (addr < env->slr || addr > env->shr) {CPUState *cs =env_cpu (env);qemu_log_mask (CPU_LOG_INT ,"Stack protector violation at " - TARGET_FMT_lx" %x %x\n" , +"0x%x 0x%x 0x%x\n" , addr, env->slr, env->shr);
Quoted 10 lines
Quoted 4 lines
target/microblaze/op_helper.c +0
-0env->ear = addr;Signature · 1 line
2.51.0Might as well update call sites to
gen_helper_stackprot()as well. compute_ldst_addr_type[ab]() calls intogen_helper_stackprot()but returns TCGv. That return value is passed todo_load()anddo_store()as TCGv, but the bodies of these function clearly expectTCG_i32.
Right, but tcg_gen_qemu_ld_i32/tcg_gen_qemu_st_i32() take a TCGv...
I'll address as follow up patches I think.
Quoted 4 lines
Otherwise
Reviewed-by Anton Johansson <[email protected]>
Thanks!
Re: [PATCH 4/5] target/microblaze: Remove target_ulong use in helper_stackprot()
In reply to Philippe Mathieu-DaudéQuoted 33 lines · Philippe Mathieu-Daudé
Since commit
36a9529e60e("target/microblaze: Simplify compute_ldst_addr_type{a,b}"),helper_stackprot()takes aTCGv_i32argument.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/microblaze/helper.h | 2 +- target/microblaze/op_helper.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)target/microblaze/helper.h +1
-1@@ -20,7 +20,7 @@ DEF_HELPER_FLAGS_3(fcmp_ne, TCG_CALL_NO_WG, i32, env, i32, i32) DEF_HELPER_FLAGS_3(fcmp_ge, TCG_CALL_NO_WG, i32, env, i32, i32) DEF_HELPER_FLAGS_2(pcmpbf, TCG_CALL_NO_RWG_SE, i32, i32, i32) -DEF_HELPER_FLAGS_2(stackprot, TCG_CALL_NO_WG, void, env, tl) +DEF_HELPER_FLAGS_2(stackprot, TCG_CALL_NO_WG, void, env, i32) DEF_HELPER_FLAGS_2(get, TCG_CALL_NO_RWG, i32, i32, i32)DEF_HELPER_FLAGS_3 (put,TCG_CALL_NO_RWG , void, i32, i32, i32)target/microblaze/op_helper.c +1
-1@@ -365,13 +365,13 @@ uint32_t helper_pcmpbf(uint32_t a, uint32_t b)return 0 ; } -void helper_stackprot (CPUMBState *env,target_ulong addr) +void helper_stackprot (CPUMBState *env,uint32_t addr)
target/microblaze/op_helper.c uint32_t helper_pcmpbf(uint32_t a, uint32_t b) · line 377
Quoted 10 lines
target/microblaze/op_helper.c +1
-1{if (addr < env->slr || addr > env->shr) {CPUState *cs =env_cpu (env);qemu_log_mask (CPU_LOG_INT ,"Stack protector violation at " - TARGET_FMT_lx" %x %x\n" , +"0x%x 0x%x 0x%x\n" , addr, env->slr, env->shr); env->ear = addr;
PATCH 5/5 target/microblaze: Convert CPUMBState::res_addr field to uint32_t type
In reply to Philippe Mathieu-DaudéCPUMBState::@res_addr field is used as u32 since commit cfeea807e5a ("target-microblaze: Tighten up TCGv_i32 vs TCGv type usage"). Convert it as such, bumping the migration version. Use the RES_ADDR_NONE definition when appropriate.
--- target/microblaze/cpu.h | 2 +- target/microblaze/machine.c | 6 +++--- target/microblaze/translate.c | 17 +++++++++-------- 3 files changed, 13 insertions(+), 12 deletions(-)
target/microblaze/cpu.h +1 -1
@@ -259,7 +259,7 @@ struct CPUArchState {/* lwx/swx reserved address */ #define RES_ADDR_NONE 0xffffffff/* Use 0xffffffff to indicate no reservation */ -target_ulong res_addr; +uint32_t res_addr;uint32_t res_val;/* Internal flags. */
target/microblaze/machine.c +3 -3
@@ -78,7 +78,7 @@ static const VMStateField vmstate_env_fields[] = {VMSTATE_UINT32 (iflags, CPUMBState),VMSTATE_UINT32 (res_val, CPUMBState), -VMSTATE_UINTTL (res_addr, CPUMBState), +VMSTATE_UINT32 (res_addr, CPUMBState), VMSTATE_STRUCT(mmu, CPUMBState, 0, vmstate_mmu, MicroBlazeMMU),
@@ -87,8 +87,8 @@ static const VMStateField vmstate_env_fields[] = {static const VMStateDescription vmstate_env = { .name ="env" , - .version_id =0 , - .minimum_version_id =0 , + .version_id =1 , + .minimum_version_id =1 , .fields = vmstate_env_fields, };
target/microblaze/translate.c +9 -8
@@ -55,7 +55,7 @@ static TCGv_i32 cpu_imm;static TCGv_i32 cpu_bvalue;static TCGv_i32 cpu_btarget;static TCGv_i32 cpu_iflags; -static TCGv cpu_res_addr; +static TCGv_i32 cpu_res_addr;static TCGv_i32 cpu_res_val;/* This is the state at translation time. */
@@ -857,7 +857,7 @@ static bool trans_lwx(DisasContext *dc, arg_typea *arg)tcg_gen_qemu_ld_i32 (cpu_res_val, addr, dc->mem_index,mo_endian (dc) |MO_UL ); -tcg_gen_mov_tl (cpu_res_addr, addr); +tcg_gen_mov_i32 (cpu_res_addr, addr);if (arg->rd) {tcg_gen_mov_i32 (cpu_R[arg->rd], cpu_res_val);
@@ -1024,7 +1024,7 @@ static bool trans_swx(DisasContext *dc, arg_typea *arg)* branch, but we know we can use the equal version in the global. * In either case, addr is no longer needed. */ -tcg_gen_brcond_tl (TCG_COND_NE , cpu_res_addr, addr, swx_fail); +tcg_gen_brcond_i32 (TCG_COND_NE , cpu_res_addr, addr, swx_fail);/* * Compare the value loaded during lwx with current contents of
@@ -1052,7 +1052,7 @@ static bool trans_swx(DisasContext *dc, arg_typea *arg)* Prevent the saved address from working again without another ldx. * Akin to the pseudocode setting reservation = 0. */ -tcg_gen_movi_tl (cpu_res_addr,-1 ); +tcg_gen_movi_i32 (cpu_res_addr,RES_ADDR_NONE );return true; }
@@ -1173,7 +1173,7 @@ static bool trans_brk(DisasContext *dc, arg_typea_br *arg)tcg_gen_movi_i32 (cpu_R[arg->rd], dc->base.pc_next); }tcg_gen_ori_i32 (cpu_msr, cpu_msr,MSR_BIP ); -tcg_gen_movi_tl (cpu_res_addr,-1 ); +tcg_gen_movi_i32 (cpu_res_addr,RES_ADDR_NONE ); dc->base.is_jmp =DISAS_EXIT ;return true;
@@ -1194,7 +1194,7 @@ static bool trans_brki(DisasContext *dc, arg_typeb_br *arg)if (arg->rd) {tcg_gen_movi_i32 (cpu_R[arg->rd], dc->base.pc_next); } -tcg_gen_movi_tl (cpu_res_addr,-1 ); +tcg_gen_movi_i32 (cpu_res_addr,RES_ADDR_NONE );#ifdef CONFIG_USER_ONLY switch (imm) {
@@ -1885,6 +1885,7 @@ void mb_tcg_init(void)tcg_global_mem_new_i32 (tcg_env, i32s[i].ofs, i32s[i].name); } - cpu_res_addr = -tcg_global_mem_new (tcg_env, offsetof(CPUMBState , res_addr),"res_addr" ); + cpu_res_addr =tcg_global_mem_new_i32 (tcg_env, + offsetof(CPUMBState , res_addr), +"res_addr" ); }
Signature · 1 line
2.51.0
Re: [PATCH 5/5] target/microblaze: Convert CPUMBState::res_addr field to uint32_t type
Quoted 11 lines · Philippe Mathieu-Daudé
CPUMBState::@res_addr field is used as u32 since commit
cfeea807e5a("target-microblaze: Tighten upTCGv_i32vs TCGv type usage"). Convert it as such, bumping the migration version. Use theRES_ADDR_NONEdefinition when appropriate.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/microblaze/cpu.h | 2 +- target/microblaze/machine.c | 6 +++--- target/microblaze/translate.c | 17 +++++++++-------- 3 files changed, 13 insertions(+), 12 deletions(-)
Re: [PATCH 5/5] target/microblaze: Convert CPUMBState::res_addr field to uint32_t type
In reply to Philippe Mathieu-DaudéQuoted 108 lines · Philippe Mathieu-Daudé
CPUMBState::@res_addr field is used as u32 since commit
cfeea807e5a("target-microblaze: Tighten upTCGv_i32vs TCGv type usage"). Convert it as such, bumping the migration version. Use theRES_ADDR_NONEdefinition when appropriate.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/microblaze/cpu.h | 2 +- target/microblaze/machine.c | 6 +++--- target/microblaze/translate.c | 17 +++++++++-------- 3 files changed, 13 insertions(+), 12 deletions(-)target/microblaze/cpu.h +1
-1@@ -259,7 +259,7 @@ struct CPUArchState {/* lwx/swx reserved address */ #define RES_ADDR_NONE 0xffffffff/* Use 0xffffffff to indicate no reservation */ -target_ulong res_addr; +uint32_t res_addr;uint32_t res_val;/* Internal flags. */ target/microblaze/machine.c +3
-3@@ -78,7 +78,7 @@ static const VMStateField vmstate_env_fields[] = {VMSTATE_UINT32 (iflags, CPUMBState),VMSTATE_UINT32 (res_val, CPUMBState), -VMSTATE_UINTTL (res_addr, CPUMBState), +VMSTATE_UINT32 (res_addr, CPUMBState), VMSTATE_STRUCT(mmu, CPUMBState, 0, vmstate_mmu, MicroBlazeMMU),@@ -87,8 +87,8 @@ static const VMStateField vmstate_env_fields[] = {static const VMStateDescription vmstate_env = { .name ="env" , - .version_id =0 , - .minimum_version_id =0 , + .version_id =1 , + .minimum_version_id =1 , .fields = vmstate_env_fields, };target/microblaze/translate.c +6
-6@@ -55,7 +55,7 @@ static TCGv_i32 cpu_imm;static TCGv_i32 cpu_bvalue;static TCGv_i32 cpu_btarget;static TCGv_i32 cpu_iflags; -static TCGv cpu_res_addr; +static TCGv_i32 cpu_res_addr;static TCGv_i32 cpu_res_val;/* This is the state at translation time. */ @@ -857,7 +857,7 @@ static bool trans_lwx(DisasContext *dc, arg_typea *arg)tcg_gen_qemu_ld_i32 (cpu_res_val, addr, dc->mem_index,mo_endian (dc) |MO_UL ); -tcg_gen_mov_tl (cpu_res_addr, addr); +tcg_gen_mov_i32 (cpu_res_addr, addr);if (arg->rd) {tcg_gen_mov_i32 (cpu_R[arg->rd], cpu_res_val);@@ -1024,7 +1024,7 @@ static bool trans_swx(DisasContext *dc, arg_typea *arg)* branch, but we know we can use the equal version in the global. * In either case, addr is no longer needed. */ -tcg_gen_brcond_tl (TCG_COND_NE , cpu_res_addr, addr, swx_fail); +tcg_gen_brcond_i32 (TCG_COND_NE , cpu_res_addr, addr, swx_fail);/* * Compare the value loaded during lwx with current contents of @@ -1052,7 +1052,7 @@ static bool trans_swx(DisasContext *dc, arg_typea *arg)* Prevent the saved address from working again without another ldx. * Akin to the pseudocode setting reservation = 0. */ -tcg_gen_movi_tl (cpu_res_addr,-1 ); +tcg_gen_movi_i32 (cpu_res_addr,RES_ADDR_NONE );return true; }@@ -1173,7 +1173,7 @@ static bool trans_brk(DisasContext *dc, arg_typea_br *arg)tcg_gen_movi_i32 (cpu_R[arg->rd], dc->base.pc_next); }tcg_gen_ori_i32 (cpu_msr, cpu_msr,MSR_BIP ); -tcg_gen_movi_tl (cpu_res_addr,-1 ); +tcg_gen_movi_i32 (cpu_res_addr,RES_ADDR_NONE ); dc->base.is_jmp =DISAS_EXIT ;return true;@@ -1194,7 +1194,7 @@ static bool trans_brki(DisasContext *dc, arg_typeb_br *arg)if (arg->rd) {tcg_gen_movi_i32 (cpu_R[arg->rd], dc->base.pc_next); } -tcg_gen_movi_tl (cpu_res_addr,-1 ); +tcg_gen_movi_i32 (cpu_res_addr,RES_ADDR_NONE );#ifdef CONFIG_USER_ONLY switch (imm) {
target/microblaze/translate.c void mb_tcg_init(void) · line 1891
Quoted 9 lines
target/microblaze/translate.c +3
-2@@ -1885,6 +1885,7 @@ void mb_tcg_init(void)tcg_global_mem_new_i32 (tcg_env, i32s[i].ofs, i32s[i].name); } - cpu_res_addr = -tcg_global_mem_new (tcg_env, offsetof(CPUMBState , res_addr),"res_addr" ); + cpu_res_addr =tcg_global_mem_new_i32 (tcg_env, + offsetof(CPUMBState , res_addr), +"res_addr" ); }