ppc/ppc405: Fixes
PATCH v2 2/9 target/ppc: Print out literal exception names in logs
In reply to Cédric Le GoaterIt facilitates reading the logs when mask CPU_LOG_INT is activated. We should do the same for error codes.
Message-Id: <[email protected]>
--- target/ppc/excp_helper.c | 75 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-)
target/ppc/excp_helper.c +74 -1
@@ -36,6 +36,78 @@/* Exception processing */ #if !defined(CONFIG_USER_ONLY ) +static const char *powerpc_excp_name (int excp) +{ +switch (excp) { +case POWERPC_EXCP_CRITICAL :return "CRITICAL" ; +case POWERPC_EXCP_MCHECK :return "MCHECK" ; +case POWERPC_EXCP_DSI :return "DSI" ; +case POWERPC_EXCP_ISI :return "ISI" ; +case POWERPC_EXCP_EXTERNAL :return "EXTERNAL" ; +case POWERPC_EXCP_ALIGN :return "ALIGN" ; +case POWERPC_EXCP_PROGRAM :return "PROGRAM" ; +case POWERPC_EXCP_FPU :return "FPU" ; +case POWERPC_EXCP_SYSCALL :return "SYSCALL" ; +case POWERPC_EXCP_APU :return "APU" ; +case POWERPC_EXCP_DECR :return "DECR" ; +case POWERPC_EXCP_FIT :return "FIT" ; +case POWERPC_EXCP_WDT :return "WDT" ; +case POWERPC_EXCP_DTLB :return "DTLB" ; +case POWERPC_EXCP_ITLB :return "ITLB" ; +case POWERPC_EXCP_DEBUG :return "DEBUG" ; +case POWERPC_EXCP_SPEU :return "SPEU" ; +case POWERPC_EXCP_EFPDI :return "EFPDI" ; +case POWERPC_EXCP_EFPRI :return "EFPRI" ; +case POWERPC_EXCP_EPERFM :return "EPERFM" ; +case POWERPC_EXCP_DOORI :return "DOORI" ; +case POWERPC_EXCP_DOORCI :return "DOORCI" ; +case POWERPC_EXCP_GDOORI :return "GDOORI" ; +case POWERPC_EXCP_GDOORCI :return "GDOORCI" ; +case POWERPC_EXCP_HYPPRIV :return "HYPPRIV" ; +case POWERPC_EXCP_RESET :return "RESET" ; +case POWERPC_EXCP_DSEG :return "DSEG" ; +case POWERPC_EXCP_ISEG :return "ISEG" ; +case POWERPC_EXCP_HDECR :return "HDECR" ; +case POWERPC_EXCP_TRACE :return "TRACE" ; +case POWERPC_EXCP_HDSI :return "HDSI" ; +case POWERPC_EXCP_HISI :return "HISI" ; +case POWERPC_EXCP_HDSEG :return "HDSEG" ; +case POWERPC_EXCP_HISEG :return "HISEG" ; +case POWERPC_EXCP_VPU :return "VPU" ; +case POWERPC_EXCP_PIT :return "PIT" ; +case POWERPC_EXCP_IO :return "IO" ; +case POWERPC_EXCP_RUNM :return "RUNM" ; +case POWERPC_EXCP_EMUL :return "EMUL" ; +case POWERPC_EXCP_IFTLB :return "IFTLB" ; +case POWERPC_EXCP_DLTLB :return "DLTLB" ; +case POWERPC_EXCP_DSTLB :return "DSTLB" ; +case POWERPC_EXCP_FPA :return "FPA" ; +case POWERPC_EXCP_DABR :return "DABR" ; +case POWERPC_EXCP_IABR :return "IABR" ; +case POWERPC_EXCP_SMI :return "SMI" ; +case POWERPC_EXCP_PERFM :return "PERFM" ; +case POWERPC_EXCP_THERM :return "THERM" ; +case POWERPC_EXCP_VPUA :return "VPUA" ; +case POWERPC_EXCP_SOFTP :return "SOFTP" ; +case POWERPC_EXCP_MAINT :return "MAINT" ; +case POWERPC_EXCP_MEXTBR :return "MEXTBR" ; +case POWERPC_EXCP_NMEXTBR :return "NMEXTBR" ; +case POWERPC_EXCP_ITLBE :return "ITLBE" ; +case POWERPC_EXCP_DTLBE :return "DTLBE" ; +case POWERPC_EXCP_VSXU :return "VSXU" ; +case POWERPC_EXCP_FU :return "FU" ; +case POWERPC_EXCP_HV_EMU :return "HV_EMU" ; +case POWERPC_EXCP_HV_MAINT :return "HV_MAINT" ; +case POWERPC_EXCP_HV_FU :return "HV_FU" ; +case POWERPC_EXCP_SDOOR :return "SDOOR" ; +case POWERPC_EXCP_SDOOR_HV :return "SDOOR_HV" ; +case POWERPC_EXCP_HVIRT :return "HVIRT" ; +case POWERPC_EXCP_SYSCALL_VECTORED :return "SYSCALL_VECTORED" ; +default : +g_assert_not_reached (); + } +} +static void dump_syscall (CPUPPCState *env) { qemu_log_mask(CPU_LOG_INT, "syscall r0=%016" PRIx64
@@ -301,7 +373,8 @@ static void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)int srr0, srr1, asrr0, asrr1, lev =-1 ;qemu_log_mask (CPU_LOG_INT ,"Raise exception at " TARGET_FMT_lx -" => %08x (%02x)\n" , env->nip, excp, env->error_code); +" => %s (%d) error=%02x\n" , env->nip,powerpc_excp_name (excp), + excp, env->error_code);/* new srr1 value excluding must-be-zero bits */ if (excp_model ==POWERPC_EXCP_BOOKE ) {
Signature · 1 line
2.31.1
PATCH v2 8/9 ppc/ppc405: Introduce a store helper for SPR_40x_PID
In reply to Cédric Le GoaterThe PID SPR of the 405 CPU contains the translation ID of the TLB which is a 8-bit field. Enforce the mask with a store helper.
Message-Id: <[email protected]>
--- target/ppc/spr_tcg.h | 1 + target/ppc/cpu_init.c | 2 +- target/ppc/translate.c | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-)
target/ppc/spr_tcg.h +1 -0
@@ -89,6 +89,7 @@ void spr_write_40x_dbcr0(DisasContext *ctx, int sprn, int gprn);void spr_write_40x_sler (DisasContext *ctx,int sprn,int gprn);void spr_write_40x_tcr (DisasContext *ctx,int sprn,int gprn);void spr_write_40x_tsr (DisasContext *ctx,int sprn,int gprn); +void spr_write_40x_pid (DisasContext *ctx,int sprn,int gprn);void spr_write_booke_tcr (DisasContext *ctx,int sprn,int gprn);void spr_write_booke_tsr (DisasContext *ctx,int sprn,int gprn);void spr_read_403_pbr (DisasContext *ctx,int gprn,int sprn);
target/ppc/cpu_init.c +1 -1
@@ -1454,7 +1454,7 @@ static void register_405_sprs(CPUPPCState *env)/* MMU */ spr_register (env, SPR_40x_PID,"PID" ,SPR_NOACCESS ,SPR_NOACCESS , - &spr_read_generic, &spr_write_generic, + &spr_read_generic, &spr_write_40x_pid,0x00000000 ); spr_register(env, SPR_4xx_CCR0, "CCR0", SPR_NOACCESS, SPR_NOACCESS,
target/ppc/translate.c +8 -0
@@ -890,6 +890,14 @@ void spr_write_40x_tsr(DisasContext *ctx, int sprn, int gprn)gen_helper_store_40x_tsr (cpu_env, cpu_gpr[gprn]); } +void spr_write_40x_pid (DisasContext *ctx,int sprn,int gprn) +{ +TCGv t0 =tcg_temp_new (); +tcg_gen_andi_tl (t0, cpu_gpr[gprn],0xFF ); +gen_store_spr (SPR_40x_PID, t0); +tcg_temp_free (t0); +} +void spr_write_booke_tcr (DisasContext *ctx,int sprn,int gprn) {gen_icount_io_start (ctx);
Signature · 1 line
2.31.1
v2 cover ppc/ppc405: Fixes
Hello,
The series starts with a couple of cleanups helping debug. It then adds back support for 405 timers which was broken 10 years ago.
Thanks,
C.
Changes in v2:
- removed inlining from powerpc_excp() routines
- fixed a compile breakage with CONFIG_USER_ONLY
- removed all DEBUG defines from MMU models
Cédric Le Goater (9):
target/ppc: Remove static inline
target/ppc: Print out literal exception names in logs ppc/ppc4xx: Convert printfs()
ppc/ppc405: Activate MMU logs
ppc/ppc405: Restore TCR and STR write handlers ppc/ppc405: Rework ppc_40x_timers_init() to use a PowerPCCPU ppc/ppc405: Fix timer initialization
ppc/ppc405: Introduce a store helper for SPR_40x_PID ppc/ppc405: Dump specific registers
target/ppc/cpu.h | 2 + target/ppc/helper.h | 2 + target/ppc/spr_tcg.h | 3 + hw/ppc/mpc8544_guts.c | 9 +- hw/ppc/ppc.c | 67 +++++++++----- hw/ppc/ppc405_uc.c | 2 - hw/ppc/ppc4xx_devs.c | 39 +++------ hw/ppc/ppc4xx_pci.c | 11 ++- target/ppc/cpu_init.c | 33 +++++-- target/ppc/excp_helper.c | 87 +++++++++++++++++-- target/ppc/mmu_common.c | 164 ++++++++++++++++------------------- target/ppc/mmu_helper.c | 97 ++++++++++----------- target/ppc/timebase_helper.c | 10 +++ target/ppc/translate.c | 20 +++++ hw/ppc/trace-events | 7 ++ 15 files changed, 338 insertions(+), 215 deletions(-)
Signature · 1 line
2.31.1
PATCH v2 1/9 target/ppc: Remove static inline
The compiler should know better how to inline code if necessary.
--- target/ppc/excp_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
target/ppc/excp_helper.c +6 -6
@@ -36,7 +36,7 @@/* Exception processing */ #if !defined(CONFIG_USER_ONLY ) -static inline void dump_syscall (CPUPPCState *env) +static void dump_syscall (CPUPPCState *env) {qemu_log_mask (CPU_LOG_INT ,"syscall r0=%016" PRIx64 " r3=%016" PRIx64 " r4=%016" PRIx64 " r5=%016" PRIx64
@@ -48,7 +48,7 @@ static inline void dump_syscall(CPUPPCState *env) ppc_dump_gpr(env, 8), env->nip); } -static inline void dump_hcall (CPUPPCState *env) +static void dump_hcall (CPUPPCState *env) {qemu_log_mask (CPU_LOG_INT ,"hypercall r3=%016" PRIx64 " r4=%016" PRIx64 " r5=%016" PRIx64 " r6=%016" PRIx64
@@ -161,7 +161,7 @@ static int powerpc_reset_wakeup(CPUState *cs, CPUPPCState *env, int excp,* | a | h | 11 | 1 | 1 | h | * +--------------------------------------------------------------------+ */ -static inline void ppc_excp_apply_ail (PowerPCCPU *cpu,int excp_model,int excp, +static void ppc_excp_apply_ail (PowerPCCPU *cpu,int excp_model,int excp,target_ulong msr,target_ulong *new_msr,target_ulong *vector)
@@ -258,7 +258,7 @@ static inline void ppc_excp_apply_ail(PowerPCCPU *cpu, int excp_model, int excp,#endif } -static inline void powerpc_set_excp_state (PowerPCCPU *cpu, +static void powerpc_set_excp_state (PowerPCCPU *cpu,target_ulong vector,target_ulong msr) {CPUState *cs =CPU (cpu);
@@ -293,7 +293,7 @@ static inline void powerpc_set_excp_state(PowerPCCPU *cpu,* Note that this function should be greatly optimized when called * with a constant excp, from ppc_hw_interrupt */ -static inline void powerpc_excp (PowerPCCPU *cpu,int excp_model,int excp) +static void powerpc_excp (PowerPCCPU *cpu,int excp_model,int excp) {CPUState *cs =CPU (cpu);CPUPPCState *env = &cpu->env;
@@ -1167,7 +1167,7 @@ void helper_pminsn(CPUPPCState *env, powerpc_pm_insn_t insn)#endif /* defined(TARGET_PPC64) */ #endif /* CONFIG_TCG */ -static inline void do_rfi (CPUPPCState *env,target_ulong nip,target_ulong msr) +static void do_rfi (CPUPPCState *env,target_ulong nip,target_ulong msr) {CPUState *cs =env_cpu (env);
Signature · 1 line
2.31.1
PATCH v2 7/9 ppc/ppc405: Fix timer initialization
In reply to Cédric Le GoaterTimers are already initialized in ppc4xx_init(). No need to do it a second time with a wrong set.
Message-Id: <[email protected]>
--- hw/ppc/ppc405_uc.c | 2 -- 1 file changed, 2 deletions(-)
hw/ppc/ppc405_uc.c +0 -2
@@ -1461,8 +1461,6 @@ PowerPCCPU *ppc405ep_init(MemoryRegion *address_space_mem,ppc4xx_pob_init (env);/* OBP arbitrer */ ppc4xx_opba_init (0xef600600 ); -/* Initialize timers */ -ppc_booke_timers_init (cpu, sysclk,0 );/* Universal interrupt controller */ uicdev =qdev_new (TYPE_PPC_UIC ); uicsbd =SYS_BUS_DEVICE (uicdev);
Signature · 1 line
2.31.1
PATCH v2 4/9 ppc/ppc405: Activate MMU logs
In reply to Cédric Le GoaterThere is no need to deactivate MMU logging at compile time. Remove all use of defines. Only keep DUMP_PAGE_TABLES for another series since page tables could be dumped from the monitor.
Message-Id: <[email protected]>
--- target/ppc/mmu_common.c | 164 +++++++++++++++++++--------------------- target/ppc/mmu_helper.c | 97 +++++++++++------------- 2 files changed, 122 insertions(+), 139 deletions(-)
target/ppc/mmu_common.c +77 -87
@@ -34,29 +34,7 @@#include "mmu-book3s-v3.h" #include "mmu-radix64.h" -/* #define DEBUG_MMU */ -/* #define DEBUG_BATS */ -/* #define DEBUG_SOFTWARE_TLB */ /* #define DUMP_PAGE_TABLES */ -/* #define FLUSH_ALL_TLBS */ - -#ifdef DEBUG_MMU -# define LOG_MMU_STATE (cpu) log_cpu_state_mask(CPU_LOG_MMU, (cpu), 0) -#else -# define LOG_MMU_STATE (cpu) do { } while (0) -#endif - -#ifdef DEBUG_SOFTWARE_TLB -# define LOG_SWTLB (...) qemu_log_mask(CPU_LOG_MMU, __VA_ARGS__) -#else -# define LOG_SWTLB (...) do { } while (0) -#endif - -#ifdef DEBUG_BATS -# define LOG_BATS (...) qemu_log_mask(CPU_LOG_MMU, __VA_ARGS__) -#else -# define LOG_BATS (...) do { } while (0) -#endif void ppc_store_sdr1 (CPUPPCState *env,target_ulong value) {
@@ -231,18 +209,20 @@ static int ppc6xx_tlb_check(CPUPPCState *env, mmu_ctx_t *ctx, tlb = &env->tlb.tlb6[nr];/* This test "emulates" the PTE index match for hardware TLBs */ if ((eaddr &TARGET_PAGE_MASK ) != tlb->EPN) { -LOG_SWTLB ("TLB %d/%d %s [" TARGET_FMT_lx" " TARGET_FMT_lx -"] <> " TARGET_FMT_lx"\n" , nr, env->nb_tlb, -pte_is_valid (tlb->pte0) ?"valid" :"inval" , - tlb->EPN, tlb->EPN +TARGET_PAGE_SIZE , eaddr); +qemu_log_mask (CPU_LOG_MMU ,"TLB %d/%d %s [" TARGET_FMT_lx +" " TARGET_FMT_lx"] <> " TARGET_FMT_lx"\n" , + nr, env->nb_tlb, +pte_is_valid (tlb->pte0) ?"valid" :"inval" , + tlb->EPN, tlb->EPN +TARGET_PAGE_SIZE , eaddr);continue ; } -LOG_SWTLB ("TLB %d/%d %s " TARGET_FMT_lx" <> " TARGET_FMT_lx" " - TARGET_FMT_lx" %c %c\n" , nr, env->nb_tlb, -pte_is_valid (tlb->pte0) ?"valid" :"inval" , - tlb->EPN, eaddr, tlb->pte1, - access_type ==MMU_DATA_STORE ?'S' :'L' , - access_type ==MMU_INST_FETCH ?'I' :'D' ); +qemu_log_mask (CPU_LOG_MMU ,"TLB %d/%d %s " TARGET_FMT_lx" <> " + TARGET_FMT_lx" " TARGET_FMT_lx" %c %c\n" , + nr, env->nb_tlb, +pte_is_valid (tlb->pte0) ?"valid" :"inval" , + tlb->EPN, eaddr, tlb->pte1, + access_type ==MMU_DATA_STORE ?'S' :'L' , + access_type ==MMU_INST_FETCH ?'I' :'D' );switch (ppc6xx_tlb_pte_check (ctx, tlb->pte0, tlb->pte1,0 , access_type)) {case -3 :
@@ -272,8 +252,9 @@ static int ppc6xx_tlb_check(CPUPPCState *env, mmu_ctx_t *ctx, }if (best !=-1 ) { done: -LOG_SWTLB ("found TLB at addr " TARGET_FMT_plx" prot=%01x ret=%d\n" , - ctx->raddr &TARGET_PAGE_MASK , ctx->prot, ret); +qemu_log_mask (CPU_LOG_MMU ,"found TLB at addr " TARGET_FMT_plx +" prot=%01x ret=%d\n" , + ctx->raddr &TARGET_PAGE_MASK , ctx->prot, ret);/* Update page flags */ pte_update_flags (ctx, &env->tlb.tlb6[best].pte1, ret, access_type); }
@@ -317,7 +298,7 @@ static int get_bat_6xx_tlb(CPUPPCState *env, mmu_ctx_t *ctx,int ret =-1 ;bool ifetch = access_type ==MMU_INST_FETCH ; -LOG_BATS ("%s: %cBAT v " TARGET_FMT_lx"\n" , __func__, +qemu_log_mask (CPU_LOG_MMU ,"%s: %cBAT v " TARGET_FMT_lx"\n" , __func__, ifetch ?'I' :'D' , virtual);if (ifetch) { BATlt = env->IBAT[1 ];
@@ -332,9 +313,9 @@ static int get_bat_6xx_tlb(CPUPPCState *env, mmu_ctx_t *ctx, BEPIu = *BATu &0xF0000000 ; BEPIl = *BATu &0x0FFE0000 ;bat_size_prot (env, &bl, &valid, &prot, BATu, BATl); -LOG_BATS ("%s: %cBAT%d v " TARGET_FMT_lx" BATu " TARGET_FMT_lx -" BATl " TARGET_FMT_lx"\n" , __func__, - ifetch ?'I' :'D' , i, virtual, *BATu, *BATl); +qemu_log_mask (CPU_LOG_MMU ,"%s: %cBAT%d v " TARGET_FMT_lx" BATu " + TARGET_FMT_lx" BATl " TARGET_FMT_lx"\n" , __func__, + ifetch ?'I' :'D' , i, virtual, *BATu, *BATl);if ((virtual &0xF0000000 ) == BEPIu && ((virtual &0x0FFE0000 ) & ~bl) == BEPIl) {/* BAT matches */
@@ -347,32 +328,33 @@ static int get_bat_6xx_tlb(CPUPPCState *env, mmu_ctx_t *ctx, ctx->prot = prot; ret =check_prot (ctx->prot, access_type);if (ret ==0 ) { -LOG_BATS ("BAT %d match: r " TARGET_FMT_plx" prot=%c%c\n" , - i, ctx->raddr, ctx->prot &PAGE_READ ?'R' :'-' , - ctx->prot &PAGE_WRITE ?'W' :'-' ); +qemu_log_mask (CPU_LOG_MMU ,"BAT %d match: r " TARGET_FMT_plx +" prot=%c%c\n" , i, ctx->raddr, + ctx->prot &PAGE_READ ?'R' :'-' , + ctx->prot &PAGE_WRITE ?'W' :'-' ); }break ; } } }if (ret <0 ) { -#if defined(DEBUG_BATS )if (qemu_log_enabled ()) { -LOG_BATS ("no BAT match for " TARGET_FMT_lx":\n" , virtual); +qemu_log_mask (CPU_LOG_MMU ,"no BAT match for " + TARGET_FMT_lx":\n" , virtual);for (i =0 ; i <4 ; i++) { BATu = &BATut[i]; BATl = &BATlt[i]; BEPIu = *BATu &0xF0000000 ; BEPIl = *BATu &0x0FFE0000 ; bl = (*BATu &0x00001FFC ) <<15 ; -LOG_BATS ("%s: %cBAT%d v " TARGET_FMT_lx" BATu " TARGET_FMT_lx -" BATl " TARGET_FMT_lx"\n\t" TARGET_FMT_lx" " - TARGET_FMT_lx" " TARGET_FMT_lx"\n" , - __func__, ifetch ?'I' :'D' , i, virtual, - *BATu, *BATl, BEPIu, BEPIl, bl); +qemu_log_mask (CPU_LOG_MMU ,"%s: %cBAT%d v " + TARGET_FMT_lx" BATu " TARGET_FMT_lx +" BATl " TARGET_FMT_lx"\n\t" TARGET_FMT_lx" " + TARGET_FMT_lx" " TARGET_FMT_lx"\n" , + __func__, ifetch ?'I' :'D' , i, virtual, + *BATu, *BATl, BEPIu, BEPIl, bl); } } -#endif }/* No hit */ return ret;
@@ -401,11 +383,12 @@ static int get_segment_6xx_tlb(CPUPPCState *env, mmu_ctx_t *ctx, vsid = sr &0x00FFFFFF ; target_page_bits =TARGET_PAGE_BITS ;qemu_log_mask (CPU_LOG_MMU , -"Check segment v=" TARGET_FMT_lx" %d " TARGET_FMT_lx -" nip=" TARGET_FMT_lx" lr=" TARGET_FMT_lx -" ir=%d dr=%d pr=%d %d t=%d\n" , - eaddr, (int )(eaddr >>28 ), sr, env->nip, env->lr, (int )msr_ir, - (int )msr_dr, pr !=0 ?1 :0 , access_type ==MMU_DATA_STORE , type); +"Check segment v=" TARGET_FMT_lx" %d " TARGET_FMT_lx +" nip=" TARGET_FMT_lx" lr=" TARGET_FMT_lx +" ir=%d dr=%d pr=%d %d t=%d\n" , + eaddr, (int )(eaddr >>28 ), sr, env->nip, env->lr, (int )msr_ir, + (int )msr_dr, pr !=0 ?1 :0 , + access_type ==MMU_DATA_STORE , type); pgidx = (eaddr & ~SEGMENT_MASK_256M ) >> target_page_bits; hash = vsid ^ pgidx; ctx->ptem = (vsid <<7 ) | (pgidx >>10 );
@@ -536,9 +519,10 @@ int ppcemb_tlb_check(CPUPPCState *env, ppcemb_tlb_t *tlb,return -1 ; } mask = ~(tlb->size -1 ); -LOG_SWTLB ("%s: TLB %d address " TARGET_FMT_lx" PID %u <=> " TARGET_FMT_lx -" " TARGET_FMT_lx" %u %x\n" , __func__, i, address, pid, tlb->EPN, - mask, (uint32_t )tlb->PID, tlb->prot); +qemu_log_mask (CPU_LOG_MMU ,"%s: TLB %d address " TARGET_FMT_lx +" PID %u <=> " TARGET_FMT_lx" " TARGET_FMT_lx" %u %x\n" , + __func__, i, address, pid, tlb->EPN, + mask, (uint32_t )tlb->PID, tlb->prot);/* Check PID */ if (tlb->PID !=0 && tlb->PID != pid) {return -1 ;
@@ -575,8 +559,9 @@ static int mmu40x_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx, } zsel = (tlb->attr >>4 ) &0xF ; zpr = (env->spr[SPR_40x_ZPR] >> (30 - (2 * zsel))) &0x3 ; -LOG_SWTLB ("%s: TLB %d zsel %d zpr %d ty %d attr %08x\n" , - __func__, i, zsel, zpr, access_type, tlb->attr); +qemu_log_mask (CPU_LOG_MMU , +"%s: TLB %d zsel %d zpr %d ty %d attr %08x\n" , + __func__, i, zsel, zpr, access_type, tlb->attr);/* Check execute enable bit */ switch (zpr) {case 0x2 :
@@ -610,14 +595,16 @@ static int mmu40x_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx, }if (ret >=0 ) { ctx->raddr = raddr; -LOG_SWTLB ("%s: access granted " TARGET_FMT_lx" => " TARGET_FMT_plx -" %d %d\n" , __func__, address, ctx->raddr, ctx->prot, - ret); +qemu_log_mask (CPU_LOG_MMU ,"%s: access granted " TARGET_FMT_lx +" => " TARGET_FMT_plx +" %d %d\n" , __func__, address, ctx->raddr, ctx->prot, + ret);return 0 ; } } -LOG_SWTLB ("%s: access refused " TARGET_FMT_lx" => " TARGET_FMT_plx -" %d %d\n" , __func__, address, raddr, ctx->prot, ret); +qemu_log_mask (CPU_LOG_MMU ,"%s: access refused " TARGET_FMT_lx +" => " TARGET_FMT_plx +" %d %d\n" , __func__, address, raddr, ctx->prot, ret);return ret; }
@@ -646,7 +633,7 @@ static int mmubooke_check_tlb(CPUPPCState *env, ppcemb_tlb_t *tlb, goto found_tlb; } -LOG_SWTLB ("%s: TLB entry not found\n" , __func__); +qemu_log_mask (CPU_LOG_MMU ,"%s: TLB entry not found\n" , __func__);return -1 ; found_tlb:
@@ -659,17 +646,17 @@ found_tlb:/* Check the address space */ if ((access_type ==MMU_INST_FETCH ? msr_ir : msr_dr) != (tlb->attr &1 )) { -LOG_SWTLB ("%s: AS doesn't match\n" , __func__); +qemu_log_mask (CPU_LOG_MMU ,"%s: AS doesn't match\n" , __func__);return -1 ; } *prot = prot2;if (prot2 &prot_for_access_type (access_type)) { -LOG_SWTLB ("%s: good TLB!\n" , __func__); +qemu_log_mask (CPU_LOG_MMU ,"%s: good TLB!\n" , __func__);return 0 ; } -LOG_SWTLB ("%s: no prot match: %x\n" , __func__, prot2); +qemu_log_mask (CPU_LOG_MMU ,"%s: no prot match: %x\n" , __func__, prot2);return access_type ==MMU_INST_FETCH ?-3 :-2 ; }
@@ -694,12 +681,13 @@ static int mmubooke_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,if (ret >=0 ) { ctx->raddr = raddr; -LOG_SWTLB ("%s: access granted " TARGET_FMT_lx" => " TARGET_FMT_plx -" %d %d\n" , __func__, address, ctx->raddr, ctx->prot, - ret); +qemu_log_mask (CPU_LOG_MMU ,"%s: access granted " TARGET_FMT_lx +" => " TARGET_FMT_plx" %d %d\n" , __func__, + address, ctx->raddr, ctx->prot, ret); }else { -LOG_SWTLB ("%s: access refused " TARGET_FMT_lx" => " TARGET_FMT_plx -" %d %d\n" , __func__, address, raddr, ctx->prot, ret); +qemu_log_mask (CPU_LOG_MMU ,"%s: access refused " TARGET_FMT_lx +" => " TARGET_FMT_plx" %d %d\n" , __func__, + address, raddr, ctx->prot, ret); }return ret;
@@ -734,10 +722,11 @@ int ppcmas_tlb_check(CPUPPCState *env, ppcmas_tlb_t *tlb, } mask = ~(booke206_tlb_to_page_size (env, tlb) -1 ); -LOG_SWTLB ("%s: TLB ADDR=0x" TARGET_FMT_lx" PID=0x%x MAS1=0x%x MAS2=0x%" - PRIx64" mask=0x%" HWADDR_PRIx" MAS7_3=0x%" PRIx64" MAS8=0x%" - PRIx32"\n" , __func__, address, pid, tlb->mas1, tlb->mas2, mask, - tlb->mas7_3, tlb->mas8); +qemu_log_mask (CPU_LOG_MMU ,"%s: TLB ADDR=0x" TARGET_FMT_lx +" PID=0x%x MAS1=0x%x MAS2=0x%" PRIx64" mask=0x%" + HWADDR_PRIx" MAS7_3=0x%" PRIx64" MAS8=0x%" PRIx32"\n" , + __func__, address, pid, tlb->mas1, tlb->mas2, mask, + tlb->mas7_3, tlb->mas8);/* Check PID */ tlb_pid = (tlb->mas1 &MAS1_TID_MASK ) >>MAS1_TID_SHIFT ;
@@ -838,7 +827,7 @@ static int mmubooke206_check_tlb(CPUPPCState *env, ppcmas_tlb_t *tlb, } } -LOG_SWTLB ("%s: TLB entry not found\n" , __func__); +qemu_log_mask (CPU_LOG_MMU ,"%s: TLB entry not found\n" , __func__);return -1 ; found_tlb:
@@ -873,17 +862,17 @@ found_tlb: }if (as != ((tlb->mas1 &MAS1_TS ) >>MAS1_TS_SHIFT )) { -LOG_SWTLB ("%s: AS doesn't match\n" , __func__); +qemu_log_mask (CPU_LOG_MMU ,"%s: AS doesn't match\n" , __func__);return -1 ; } *prot = prot2;if (prot2 &prot_for_access_type (access_type)) { -LOG_SWTLB ("%s: good TLB!\n" , __func__); +qemu_log_mask (CPU_LOG_MMU ,"%s: good TLB!\n" , __func__);return 0 ; } -LOG_SWTLB ("%s: no prot match: %x\n" , __func__, prot2); +qemu_log_mask (CPU_LOG_MMU ,"%s: no prot match: %x\n" , __func__, prot2);return access_type ==MMU_INST_FETCH ?-3 :-2 ; }
@@ -919,12 +908,13 @@ found_tlb:if (ret >=0 ) { ctx->raddr = raddr; -LOG_SWTLB ("%s: access granted " TARGET_FMT_lx" => " TARGET_FMT_plx -" %d %d\n" , __func__, address, ctx->raddr, ctx->prot, - ret); +qemu_log_mask (CPU_LOG_MMU ,"%s: access granted " TARGET_FMT_lx +" => " TARGET_FMT_plx" %d %d\n" , __func__, address, + ctx->raddr, ctx->prot, ret); }else { -LOG_SWTLB ("%s: access refused " TARGET_FMT_lx" => " TARGET_FMT_plx -" %d %d\n" , __func__, address, raddr, ctx->prot, ret); +qemu_log_mask (CPU_LOG_MMU ,"%s: access refused " TARGET_FMT_lx +" => " TARGET_FMT_plx" %d %d\n" , __func__, address, + raddr, ctx->prot, ret); }return ret;
@@ -1338,7 +1328,7 @@ static bool ppc_jumbo_xlate(PowerPCCPU *cpu, vaddr eaddr, }if (guest_visible) { -LOG_MMU_STATE (cs); +log_cpu_state_mask (CPU_LOG_MMU , cs,0 );if (type ==ACCESS_CODE ) {switch (ret) {case -1 :
target/ppc/mmu_helper.c +45 -52
180 lines not on this page · raw message
Signature · 1 line
2.31.1
PATCH v2 6/9 ppc/ppc405: Rework ppc_40x_timers_init() to use a PowerPCCPU
In reply to Cédric Le GoaterThis is a small cleanup to ease reading. It includes the removal of a check done on the returned value of g_malloc0(), which can not fail.
Message-Id: <[email protected]>
--- hw/ppc/ppc.c | 42 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 23 deletions(-)
hw/ppc/ppc.c +19 -23
@@ -1124,14 +1124,12 @@ struct ppc40x_timer_t {/* Fixed interval timer */ static void cpu_4xx_fit_cb (void *opaque) { -PowerPCCPU *cpu; -CPUPPCState *env; +PowerPCCPU *cpu = opaque; +CPUPPCState *env = &cpu->env;ppc_tb_t *tb_env;ppc40x_timer_t *ppc40x_timer;uint64_t now, next; - env = opaque; - cpu =env_archcpu (env); tb_env = env->tb_env; ppc40x_timer = tb_env->opaque; now =qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL );
@@ -1193,13 +1191,11 @@ static void start_stop_pit (CPUPPCState *env, ppc_tb_t *tb_env, int is_excp)static void cpu_4xx_pit_cb (void *opaque) { -PowerPCCPU *cpu; -CPUPPCState *env; +PowerPCCPU *cpu = opaque; +CPUPPCState *env = &cpu->env;ppc_tb_t *tb_env;ppc40x_timer_t *ppc40x_timer; - env = opaque; - cpu =env_archcpu (env); tb_env = env->tb_env; ppc40x_timer = tb_env->opaque; env->spr[SPR_40x_TSR] |=1 <<27 ;
@@ -1216,14 +1212,12 @@ static void cpu_4xx_pit_cb (void *opaque)/* Watchdog timer */ static void cpu_4xx_wdt_cb (void *opaque) { -PowerPCCPU *cpu; -CPUPPCState *env; +PowerPCCPU *cpu = opaque; +CPUPPCState *env = &cpu->env;ppc_tb_t *tb_env;ppc40x_timer_t *ppc40x_timer;uint64_t now, next; - env = opaque; - cpu =env_archcpu (env); tb_env = env->tb_env; ppc40x_timer = tb_env->opaque; now =qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL );
@@ -1341,24 +1335,26 @@ clk_setup_cb ppc_40x_timers_init (CPUPPCState *env, uint32_t freq, {ppc_tb_t *tb_env;ppc40x_timer_t *ppc40x_timer; +PowerPCCPU *cpu =env_archcpu (env); + +trace_ppc40x_timers_init (freq); tb_env =g_malloc0 (sizeof (ppc_tb_t)); + ppc40x_timer =g_malloc0 (sizeof (ppc40x_timer_t)); + env->tb_env = tb_env; tb_env->flags =PPC_DECR_UNDERFLOW_TRIGGERED ; - ppc40x_timer =g_malloc0 (sizeof (ppc40x_timer_t)); tb_env->tb_freq = freq; tb_env->decr_freq = freq; tb_env->opaque = ppc40x_timer; -trace_ppc40x_timers_init (freq); -if (ppc40x_timer !=NULL ) { -/* We use decr timer for PIT */ - tb_env->decr_timer =timer_new_ns (QEMU_CLOCK_VIRTUAL , &cpu_4xx_pit_cb, env); - ppc40x_timer->fit_timer = -timer_new_ns (QEMU_CLOCK_VIRTUAL , &cpu_4xx_fit_cb, env); - ppc40x_timer->wdt_timer = -timer_new_ns (QEMU_CLOCK_VIRTUAL , &cpu_4xx_wdt_cb, env); - ppc40x_timer->decr_excp = decr_excp; - } + +/* We use decr timer for PIT */ + tb_env->decr_timer =timer_new_ns (QEMU_CLOCK_VIRTUAL , &cpu_4xx_pit_cb, cpu); + ppc40x_timer->fit_timer = +timer_new_ns (QEMU_CLOCK_VIRTUAL , &cpu_4xx_fit_cb, cpu); + ppc40x_timer->wdt_timer = +timer_new_ns (QEMU_CLOCK_VIRTUAL , &cpu_4xx_wdt_cb, cpu); + ppc40x_timer->decr_excp = decr_excp;return &ppc_40x_set_tb_clk; }
Signature · 1 line
2.31.1
PATCH v2 9/9 ppc/ppc405: Dump specific registers
In reply to Cédric Le GoaterRework slightly ppc_cpu_dump_state() to replace the various 'if' statements with a 'switch'.
Message-Id: <[email protected]>
--- target/ppc/cpu_init.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
target/ppc/cpu_init.c +21 -6
@@ -8648,16 +8648,17 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, int flags) env->spr[SPR_SPRG4 ], env->spr[SPR_SPRG5 ], env->spr[SPR_SPRG6], env->spr[SPR_SPRG7]); +switch (env->excp_model) {#if defined(TARGET_PPC64 ) -if (env->excp_model ==POWERPC_EXCP_POWER7 || - env->excp_model ==POWERPC_EXCP_POWER8 || - env->excp_model ==POWERPC_EXCP_POWER9 || - env->excp_model ==POWERPC_EXCP_POWER10 ) { +case POWERPC_EXCP_POWER7 : +case POWERPC_EXCP_POWER8 : +case POWERPC_EXCP_POWER9 : +case POWERPC_EXCP_POWER10 :qemu_fprintf (f,"HSRR0 " TARGET_FMT_lx" HSRR1 " TARGET_FMT_lx"\n" , env->spr[SPR_HSRR0 ], env->spr[SPR_HSRR1 ]); - } +break ;#endif -if (env->excp_model ==POWERPC_EXCP_BOOKE ) { +case POWERPC_EXCP_BOOKE : qemu_fprintf(f, "CSRR0 " TARGET_FMT_lx " CSRR1 " TARGET_FMT_lx " MCSRR0 " TARGET_FMT_lx " MCSRR1 " TARGET_FMT_lx "\n", env->spr[SPR_BOOKE_CSRR0], env->spr[SPR_BOOKE_CSRR1],
@@ -8688,6 +8689,20 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, int flags)* IVORs are left out as they are large and do not change often -- * they can be read with "p $ivor0", "p $ivor1", etc. */ +break ; +case POWERPC_EXCP_40x: +qemu_fprintf (f," TCR " TARGET_FMT_lx" TSR " TARGET_FMT_lx +" ESR " TARGET_FMT_lx" DEAR " TARGET_FMT_lx"\n" , + env->spr[SPR_40x_TCR], env->spr[SPR_40x_TSR], + env->spr[SPR_40x_ESR], env->spr[SPR_40x_DEAR]); + +qemu_fprintf (f," EVPR " TARGET_FMT_lx" SRR2 " TARGET_FMT_lx +" SRR3 " TARGET_FMT_lx" PID " TARGET_FMT_lx"\n" , + env->spr[SPR_40x_EVPR], env->spr[SPR_40x_SRR2], + env->spr[SPR_40x_SRR3], env->spr[SPR_40x_PID]); +break ; +default : +break ; }#if defined(TARGET_PPC64 )
Signature · 1 line
2.31.1
PATCH v2 3/9 ppc/ppc4xx: Convert printfs()
In reply to Cédric Le GoaterUse a QEMU log primitive for errors and trace events for debug.
Message-Id: <[email protected]>
--- hw/ppc/mpc8544_guts.c | 9 ++++++--- hw/ppc/ppc4xx_devs.c | 39 +++++++++++---------------------------- hw/ppc/ppc4xx_pci.c | 11 +++++++---- hw/ppc/trace-events | 5 +++++ 4 files changed, 29 insertions(+), 35 deletions(-)
hw/ppc/mpc8544_guts.c +6 -3
@@ -19,6 +19,7 @@#include "qemu/osdep.h" #include "qemu/module.h" +#include "qemu/log.h" #include "sysemu/runstate.h" #include "cpu.h" #include "hw/sysbus.h"
@@ -82,7 +83,9 @@ static uint64_t mpc8544_guts_read(void *opaque, hwaddr addr, value = env->spr[SPR_E500_SVR ];break ;default : -fprintf (stderr,"guts: Unknown register read: %x\n" , (int )addr); +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Unknown register 0x%" HWADDR_PRIx"\n" , + __func__, addr);break ; }
@@ -101,8 +104,8 @@ static void mpc8544_guts_write(void *opaque, hwaddr addr, }break ;default : -fprintf (stderr,"guts: Unknown register write: %x = %x\n" , - (int )addr, (unsigned )value); +qemu_log_mask (LOG_GUEST_ERROR ,"%s: Unknown register 0x%" HWADDR_PRIx +" = 0x%" PRIx64"\n" , __func__, addr, value);break ; } }
hw/ppc/ppc4xx_devs.c +11 -28
@@ -35,14 +35,7 @@#include "exec/address-spaces.h" #include "qemu/error-report.h" #include "qapi/error.h" - -/*#define DEBUG_UIC*/ - -#ifdef DEBUG_UIC -# define LOG_UIC (...) qemu_log_mask(CPU_LOG_INT, ## __VA_ARGS__) -#else -# define LOG_UIC (...) do { } while (0) -#endif +#include "trace.h" static void ppc4xx_reset (void *opaque) {
@@ -137,8 +130,9 @@ static uint32_t sdram_bcr (hwaddr ram_base, bcr =0x000C0000 ;break ;default : -printf ("%s: invalid RAM size " TARGET_FMT_plx"\n" , __func__, - ram_size); +qemu_log_mask (LOG_GUEST_ERROR , +"%s: invalid RAM size 0x%" HWADDR_PRIx"\n" , __func__, + ram_size);return 0x00000000 ; } bcr |= ram_base &0xFF800000 ;
@@ -171,10 +165,8 @@ static void sdram_set_bcr(ppc4xx_sdram_t *sdram, int i, {if (sdram->bcr[i] &0x00000001 ) {/* Unmap RAM */ -#ifdef DEBUG_SDRAM -printf ("%s: unmap RAM area " TARGET_FMT_plx" " TARGET_FMT_lx"\n" , - __func__,sdram_base (sdram->bcr[i]),sdram_size (sdram->bcr[i])); -#endif +trace_ppc4xx_sdram_unmap (sdram_base (sdram->bcr[i]), +sdram_size (sdram->bcr[i]));memory_region_del_subregion (get_system_memory (), &sdram->containers[i]); memory_region_del_subregion(&sdram->containers[i],
@@ -183,10 +175,7 @@ static void sdram_set_bcr(ppc4xx_sdram_t *sdram, int i, } sdram->bcr[i] = bcr &0xFFDEE001 ;if (enabled && (bcr &0x00000001 )) { -#ifdef DEBUG_SDRAM -printf ("%s: Map RAM area " TARGET_FMT_plx" " TARGET_FMT_lx"\n" , - __func__,sdram_base (bcr),sdram_size (bcr)); -#endif +trace_ppc4xx_sdram_unmap (sdram_base (bcr),sdram_size (bcr));memory_region_init (&sdram->containers[i],NULL ,"sdram-containers" ,sdram_size (bcr)); memory_region_add_subregion(&sdram->containers[i], 0,
@@ -216,10 +205,8 @@ static void sdram_unmap_bcr (ppc4xx_sdram_t *sdram)int i;for (i =0 ; i < sdram->nbanks; i++) { -#ifdef DEBUG_SDRAM -printf ("%s: Unmap RAM area " TARGET_FMT_plx" " TARGET_FMT_lx"\n" , - __func__,sdram_base (sdram->bcr[i]),sdram_size (sdram->bcr[i])); -#endif +trace_ppc4xx_sdram_unmap (sdram_base (sdram->bcr[i]), +sdram_size (sdram->bcr[i]));memory_region_del_subregion (get_system_memory (), &sdram->ram_memories[i]); }
@@ -316,16 +303,12 @@ static void dcr_write_sdram (void *opaque, int dcrn, uint32_t val)case 0x20 :/* SDRAM_CFG */ val &=0xFFE00000 ;if (!(sdram->cfg &0x80000000 ) && (val &0x80000000 )) { -#ifdef DEBUG_SDRAM -printf ("%s: enable SDRAM controller\n" , __func__); -#endif +trace_ppc4xx_sdram_enable ("enable" );/* validate all RAM mappings */ sdram_map_bcr (sdram); sdram->status &= ~0x80000000 ; }else if ((sdram->cfg &0x80000000 ) && !(val &0x80000000 )) { -#ifdef DEBUG_SDRAM -printf ("%s: disable SDRAM controller\n" , __func__); -#endif +trace_ppc4xx_sdram_enable ("disable" );/* invalidate all RAM mappings */ sdram_unmap_bcr (sdram); sdram->status |=0x80000000 ;
hw/ppc/ppc4xx_pci.c +7 -4
@@ -20,6 +20,7 @@* 4xx SoCs, such as the 440EP. */ #include "qemu/osdep.h" +#include "qemu/log.h" #include "hw/irq.h" #include "hw/ppc/ppc.h" #include "hw/ppc/ppc4xx.h"
@@ -152,8 +153,9 @@ static void ppc4xx_pci_reg_write4(void *opaque, hwaddr offset,break ;default : -printf ("%s: unhandled PCI internal register 0x%lx\n" , __func__, - (unsigned long )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"%s: unhandled PCI internal register 0x%" HWADDR_PRIx"\n" , + __func__, offset);break ; } }
@@ -218,8 +220,9 @@ static uint64_t ppc4xx_pci_reg_read4(void *opaque, hwaddr offset,break ;default : -printf ("%s: invalid PCI internal register 0x%lx\n" , __func__, - (unsigned long )offset); +qemu_log_mask (LOG_GUEST_ERROR , +"%s: invalid PCI internal register 0x%" HWADDR_PRIx"\n" , + __func__, offset); value =0 ; }
hw/ppc/trace-events +5 -0
@@ -164,3 +164,8 @@ ppc4xx_gpt_init(uint64_t addr) "offet 0x%" PRIx64 ppc405ep_clocks_compute(const char *param, uint32_t param2, uint32_t val) "%s 0x%1" PRIx32 " %d" ppc405ep_clocks_setup(const char *trace) "%s" + +# ppc4xx_devs.c +ppc4xx_sdram_enable(const char *trace) "%s SDRAM controller" +ppc4xx_sdram_unmap(uint64_t addr, uint64_t size) "Unmap RAM area 0x%" PRIx64 " size 0x%" PRIx64 +ppc4xx_sdram_map(uint64_t addr, uint64_t size) "Map RAM area 0x%" PRIx64 " size 0x%" PRIx64
Signature · 1 line
2.31.1
PATCH v2 5/9 ppc/ppc405: Restore TCR and STR write handlers
In reply to Cédric Le GoaterThe 405 timers were broken when booke support was added. Assumption was made that the register numbers were the same but it's not :
SPR_BOOKE_TSR (0x150)
SPR_BOOKE_TCR (0x154)
SPR_40x_TSR (0x3D8)
SPR_40x_TCR (0x3DA)Message-Id: <[email protected]>
--- target/ppc/cpu.h | 2 ++ target/ppc/helper.h | 2 ++ target/ppc/spr_tcg.h | 2 ++ hw/ppc/ppc.c | 25 +++++++++++++++++++++++++ target/ppc/cpu_init.c | 4 ++-- target/ppc/timebase_helper.c | 10 ++++++++++ target/ppc/translate.c | 12 ++++++++++++ hw/ppc/trace-events | 2 ++ 8 files changed, 57 insertions(+), 2 deletions(-)
target/ppc/cpu.h +2 -0
@@ -1399,6 +1399,8 @@ target_ulong load_40x_pit(CPUPPCState *env);void store_40x_pit (CPUPPCState *env,target_ulong val);void store_40x_dbcr0 (CPUPPCState *env,uint32_t val);void store_40x_sler (CPUPPCState *env,uint32_t val); +void store_40x_tcr (CPUPPCState *env,target_ulong val); +void store_40x_tsr (CPUPPCState *env,target_ulong val);void store_booke_tcr (CPUPPCState *env,target_ulong val);void store_booke_tsr (CPUPPCState *env,target_ulong val);void ppc_tlb_invalidate_all (CPUPPCState *env);
target/ppc/helper.h +2 -0
@@ -706,6 +706,8 @@ 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) +DEF_HELPER_FLAGS_2(store_40x_tsr, TCG_CALL_NO_RWG, void, env, tl) DEF_HELPER_2(store_40x_dbcr0, void, env, tl) DEF_HELPER_2(store_40x_sler, void, env, tl)DEF_HELPER_FLAGS_2 (store_booke_tcr,TCG_CALL_NO_RWG , void, env, tl)
target/ppc/spr_tcg.h +2 -0
@@ -87,6 +87,8 @@ void spr_read_40x_pit(DisasContext *ctx, int gprn, int sprn);void spr_write_40x_pit (DisasContext *ctx,int sprn,int gprn);void spr_write_40x_dbcr0 (DisasContext *ctx,int sprn,int gprn);void spr_write_40x_sler (DisasContext *ctx,int sprn,int gprn); +void spr_write_40x_tcr (DisasContext *ctx,int sprn,int gprn); +void spr_write_40x_tsr (DisasContext *ctx,int sprn,int gprn);void spr_write_booke_tcr (DisasContext *ctx,int sprn,int gprn);void spr_write_booke_tsr (DisasContext *ctx,int sprn,int gprn);void spr_read_403_pbr (DisasContext *ctx,int gprn,int sprn);
hw/ppc/ppc.c +25 -0
@@ -1300,6 +1300,31 @@ target_ulong load_40x_pit (CPUPPCState *env)return cpu_ppc_load_decr (env); } +void store_40x_tsr (CPUPPCState *env,target_ulong val) +{ +PowerPCCPU *cpu =env_archcpu (env); + +trace_ppc40x_store_tcr (val); + + env->spr[SPR_40x_TSR] &= ~(val &0xFC000000 ); +if (val &0x80000000 ) { +ppc_set_irq (cpu,PPC_INTERRUPT_PIT ,0 ); + } +} + +void store_40x_tcr (CPUPPCState *env,target_ulong val) +{ +PowerPCCPU *cpu =env_archcpu (env); +ppc_tb_t *tb_env; + +trace_ppc40x_store_tsr (val); + + tb_env = env->tb_env; + env->spr[SPR_40x_TCR] = val &0xFFC00000 ; +start_stop_pit (env, tb_env,1 ); +cpu_4xx_wdt_cb (cpu); +} +static void ppc_40x_set_tb_clk (void *opaque,uint32_t freq) {CPUPPCState *env = opaque;
target/ppc/cpu_init.c +2 -2
@@ -1440,11 +1440,11 @@ static void register_40x_sprs(CPUPPCState *env) 0x00000000);spr_register (env, SPR_40x_TCR,"TCR" ,SPR_NOACCESS ,SPR_NOACCESS , - &spr_read_generic, &spr_write_booke_tcr, + &spr_read_generic, &spr_write_40x_tcr,0x00000000 );spr_register (env, SPR_40x_TSR,"TSR" ,SPR_NOACCESS ,SPR_NOACCESS , - &spr_read_generic, &spr_write_booke_tsr, + &spr_read_generic, &spr_write_40x_tsr,0x00000000 ); }
target/ppc/timebase_helper.c +10 -0
@@ -144,6 +144,16 @@ void helper_store_40x_pit(CPUPPCState *env, target_ulong val)store_40x_pit (env, val); } +void helper_store_40x_tcr (CPUPPCState *env,target_ulong val) +{ +store_40x_tcr (env, val); +} + +void helper_store_40x_tsr (CPUPPCState *env,target_ulong val) +{ +store_40x_tsr (env, val); +} +void helper_store_booke_tcr (CPUPPCState *env,target_ulong val) {store_booke_tcr (env, val);
target/ppc/translate.c +12 -0
@@ -878,6 +878,18 @@ void spr_write_40x_sler(DisasContext *ctx, int sprn, int gprn)gen_helper_store_40x_sler (cpu_env, cpu_gpr[gprn]); } +void spr_write_40x_tcr (DisasContext *ctx,int sprn,int gprn) +{ +gen_icount_io_start (ctx); +gen_helper_store_40x_tcr (cpu_env, cpu_gpr[gprn]); +} + +void spr_write_40x_tsr (DisasContext *ctx,int sprn,int gprn) +{ +gen_icount_io_start (ctx); +gen_helper_store_40x_tsr (cpu_env, cpu_gpr[gprn]); +} +void spr_write_booke_tcr (DisasContext *ctx,int sprn,int gprn) {gen_icount_io_start (ctx);
hw/ppc/trace-events +2 -0
@@ -110,6 +110,8 @@ ppc4xx_pit_start(uint64_t reload) "PIT 0x%016" PRIx64 ppc4xx_pit(uint32_t ar, uint32_t ir, uint64_t tcr, uint64_t tsr, uint64_t reload) "ar %d ir %d TCR 0x%" PRIx64 " TSR 0x%" PRIx64 " PIT 0x%016" PRIx64 ppc4xx_wdt(uint64_t tcr, uint64_t tsr) "TCR 0x%" PRIx64 " TSR 0x%" PRIx64 ppc40x_store_pit(uint64_t value) "val 0x%" PRIx64 +ppc40x_store_tcr(uint64_t value) "val 0x%" PRIx64 +ppc40x_store_tsr(uint64_t value) "val 0x%" PRIx64 ppc40x_set_tb_clk(uint32_t value) "new frequency %" PRIu32 ppc40x_timers_init(uint32_t value) "frequency %" PRIu32
Signature · 1 line
2.31.1
Re: [PATCH v2 1/9] target/ppc: Remove static inline
In reply to Cédric Le GoaterQuoted 7 lines · Cédric Le Goater
The compiler should know better how to inline code if necessary.
Suggested-by Richard Henderson<[email protected]>Signed-off-by Cédric Le Goater<[email protected]>--- target/ppc/excp_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
r~
Re: [PATCH v2 4/9] ppc/ppc405: Activate MMU logs
In reply to Cédric Le GoaterQuoted 11 lines · Cédric Le Goater
There is no need to deactivate MMU logging at compile time. Remove all use of defines. Only keep
DUMP_PAGE_TABLESfor another series since page tables could be dumped from the monitor.Signed-off-by Cédric Le Goater<[email protected]>Message-Id:<[email protected]>
Signed-off-by Cédric Le Goater<[email protected]>--- target/ppc/mmu_common.c | 164 +++++++++++++++++++--------------------- target/ppc/mmu_helper.c | 97 +++++++++++------------- 2 files changed, 122 insertions(+), 139 deletions(-)
r~
Cédric Le Goater
AppliedQuoted 7 lines · Cédric Le Goater
Hello,
The series starts with a couple of cleanups helping debug. It then adds back support for 405 timers which was broken 10 years ago.
Thanks,
Quoted 7 lines
C.
Changes in v2:
- removed inlining from
powerpc_excp()routines
- fixed a compile breakage withCONFIG_USER_ONLY
- removed all DEBUG defines from MMU models
Applied in ppc-next.
Thanks,
C.