target-mips queue
Hi,
First target-mips pull request for 2.5 consisting of patches sent during 2.4 freeze.
Thanks,
Leon
The following changes since commit ca0e5d8b0d065a95d0f9042f71b2ace45b015596:
Open 2.5 development tree (2015-08-11 23:15:55 +0100)
are available in the git repository at:
git://github.com/lalrae/qemu.git tags/mips-20150813
for you to fetch changes up to c85570163bdf1ba29cb52a63f22ff1c48f1b9398:
target-mips: Use CPU_LOG_INT for logging related to interrupts (2015-08-13 16:22:53 +0100)
----------------------------------------------------------------
MIPS patches 2015-08-13
Changes:
* mips32r5-generic CPU updated and renamed to P5600
* improvements in LWL/LDL, logging and fulong2e
----------------------------------------------------------------
Aurelien Jarno (1):
target-mips: simplify LWL/LDL mask generation
Peter Maydell (1):
hw/pci-host/bonito: Avoid buffer overrun for bad LDMA/COP accesses
Richard Henderson (1):
target-mips: Use CPU_LOG_INT for logging related to interrupts
Yongbok Kim (1):
target-mips: update mips32r5-generic into P5600
hw/pci-host/bonito.c | 16 +++++++++++++ target-mips/cpu.h | 2 +- target-mips/helper.c | 30 +++++++++---------------- target-mips/op_helper.c | 3 ++- target-mips/translate.c | 14 +++++------- target-mips/translate_init.c | 53 ++++++++++++++++++++++++-------------------- 6 files changed, 65 insertions(+), 53 deletions(-)
[Qemu-devel] [PULL 1/4] target-mips: update mips32r5-generic into P5600
From: Yongbok Kim <[email protected]>
As full specification of P5600 is available, mips32r5-generic should be renamed to P5600 and corrected as its intention. Correct PRid and detail of configuration.
Features which are not currently supported are described as FIXME.
Fix Config.MM bit location
--- target-mips/cpu.h | 2 +- target-mips/translate_init.c | 53 ++++++++++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 25 deletions(-)
target-mips/cpu.h +1 -1
@@ -395,7 +395,7 @@ struct CPUMIPSState {#define CP0C0_K23 28#define CP0C0_KU 25#define CP0C0_MDU 20 -#define CP0C0_MM 17 +#define CP0C0_MM 18#define CP0C0_BM 16#define CP0C0_BE 15#define CP0C0_AT 13
target-mips/translate_init.c +29 -24
68 lines not on this page · raw message
Signature · 1 line
2.1.0
[Qemu-devel] [PULL 2/4] target-mips: simplify LWL/LDL mask generation
In reply to Leon AlraeFrom: Aurelien Jarno <[email protected]>
The LWL/LDL instructions mask the GPR with a mask depending on the address alignement. It is currently computed by doing:
mask = 0x7fffffffffffffffull >> (t1 ^ 63)
It's simpler to generate it by doing:
mask = ~(-1 << t1)
It uses one TCG instruction less, and it avoids a 32/64-bit constant loading which can take a few instructions on RISC hosts.
--- target-mips/translate.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
target-mips/translate.c +6 -8
@@ -2153,11 +2153,10 @@ static void gen_ld(DisasContext *ctx, uint32_t opc,tcg_gen_andi_tl (t0, t0, ~7 );tcg_gen_qemu_ld_tl (t0, t0, ctx->mem_idx,MO_TEQ );tcg_gen_shl_tl (t0, t0, t1); -tcg_gen_xori_tl (t1, t1,63 ); - t2 =tcg_const_tl (0x7fffffffffffffffull ); -tcg_gen_shr_tl (t2, t2, t1); + t2 =tcg_const_tl (-1 ); +tcg_gen_shl_tl (t2, t2, t1);gen_load_gpr (t1, rt); -tcg_gen_and_tl (t1, t1, t2); +tcg_gen_andc_tl (t1, t1, t2);tcg_temp_free (t2);tcg_gen_or_tl (t0, t0, t1);tcg_temp_free (t1);
@@ -2246,11 +2245,10 @@ static void gen_ld(DisasContext *ctx, uint32_t opc,tcg_gen_andi_tl (t0, t0, ~3 );tcg_gen_qemu_ld_tl (t0, t0, ctx->mem_idx,MO_TEUL );tcg_gen_shl_tl (t0, t0, t1); -tcg_gen_xori_tl (t1, t1,31 ); - t2 =tcg_const_tl (0x7fffffffull ); -tcg_gen_shr_tl (t2, t2, t1); + t2 =tcg_const_tl (-1 ); +tcg_gen_shl_tl (t2, t2, t1);gen_load_gpr (t1, rt); -tcg_gen_and_tl (t1, t1, t2); +tcg_gen_andc_tl (t1, t1, t2);tcg_temp_free (t2);tcg_gen_or_tl (t0, t0, t1);tcg_temp_free (t1);
Signature · 1 line
2.1.0
[Qemu-devel] [PULL 3/4] hw/pci-host/bonito: Avoid buffer overrun for bad LDMA/COP accesses
In reply to Leon AlraeFrom: Peter Maydell <[email protected]>
The LDMA and COP memory regions represent four 32 bit registers each, but the memory regions themselves are 0x100 bytes large. Add guards to the read and write accessors so that bogus accesses beyond the four defined registers don't just run off the end of the bonldma and boncop structs and into whatever lies beyond.
--- hw/pci-host/bonito.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
hw/pci-host/bonito.c +16 -0
@@ -355,6 +355,10 @@ static uint64_t bonito_ldma_readl(void *opaque, hwaddr addr,uint32_t val;PCIBonitoState *s = opaque; +if (addr >=sizeof (s->bonldma)) { +return 0 ; + } + val = ((uint32_t *)(&s->bonldma))[addr/sizeof (uint32_t )];return val;
@@ -365,6 +369,10 @@ static void bonito_ldma_writel(void *opaque, hwaddr addr, {PCIBonitoState *s = opaque; +if (addr >=sizeof (s->bonldma)) { +return ; + } + ((uint32_t *)(&s->bonldma))[addr/sizeof (uint32_t )] = val &0xffffffff ; }
@@ -384,6 +392,10 @@ static uint64_t bonito_cop_readl(void *opaque, hwaddr addr,uint32_t val;PCIBonitoState *s = opaque; +if (addr >=sizeof (s->boncop)) { +return 0 ; + } + val = ((uint32_t *)(&s->boncop))[addr/sizeof (uint32_t )];return val;
@@ -394,6 +406,10 @@ static void bonito_cop_writel(void *opaque, hwaddr addr, {PCIBonitoState *s = opaque; +if (addr >=sizeof (s->boncop)) { +return ; + } + ((uint32_t *)(&s->boncop))[addr/sizeof (uint32_t )] = val &0xffffffff ; }
Signature · 1 line
2.1.0
[Qemu-devel] [PULL 4/4] target-mips: Use CPU_LOG_INT for logging related to interrupts
In reply to Leon AlraeFrom: Richard Henderson <[email protected]>
There are now no unconditional uses of qemu_log in the subdirectory.
--- target-mips/helper.c | 30 +++++++++++------------------- target-mips/op_helper.c | 3 ++- 2 files changed, 13 insertions(+), 20 deletions(-)
target-mips/helper.c +11 -19
@@ -127,10 +127,6 @@ static int get_physical_address (CPUMIPSState *env, hwaddr *physical,/* effective address (modified for KVM T&E kernel segments) */ target_ulong address = real_address; -#if 0 -qemu_log ("user mode %d h %08x\n" , user_mode, env->hflags); -#endif -#define USEG_LIMIT 0x7FFFFFFFUL#define KSEG0_BASE 0x80000000UL#define KSEG1_BASE 0xA0000000UL
@@ -227,11 +223,6 @@ static int get_physical_address (CPUMIPSState *env, hwaddr *physical, ret = TLBRET_BADADDR; } } -#if 0 -qemu_log (TARGET_FMT_lx" %d %d => %" HWADDR_PRIx" %d (%d)\n" , - address, rw, access_type, *physical, *prot, ret); -#endif -return ret; }#endif
@@ -487,14 +478,16 @@ void mips_cpu_do_interrupt(CPUState *cs)int cause =-1 ;const char *name; -if (qemu_log_enabled () && cs->exception_index !=EXCP_EXT_INTERRUPT ) { +if (qemu_loglevel_mask (CPU_LOG_INT ) + && cs->exception_index !=EXCP_EXT_INTERRUPT ) {if (cs->exception_index <0 || cs->exception_index >EXCP_LAST ) { name ="unknown" ; }else { name = excp_names[cs->exception_index]; } -qemu_log ("%s enter: PC " TARGET_FMT_lx" EPC " TARGET_FMT_lx" %s exception\n" , +qemu_log ("%s enter: PC " TARGET_FMT_lx" EPC " TARGET_FMT_lx +" %s exception\n" , __func__, env->active_tc.PC, env->CP0_EPC, name); } if (cs->exception_index == EXCP_EXT_INTERRUPT &&
@@ -747,16 +740,15 @@ void mips_cpu_do_interrupt(CPUState *cs) env->CP0_Cause = (env->CP0_Cause & ~(0x1f << CP0Ca_EC)) | (cause << CP0Ca_EC);break ;default : -qemu_log ("Invalid MIPS exception %d. Exiting\n" , cs->exception_index); -printf ("Invalid MIPS exception %d. Exiting\n" , cs->exception_index); - exit(1); + abort(); } -if (qemu_log_enabled () && cs->exception_index !=EXCP_EXT_INTERRUPT ) { +if (qemu_loglevel_mask (CPU_LOG_INT ) + && cs->exception_index !=EXCP_EXT_INTERRUPT ) {qemu_log ("%s: PC " TARGET_FMT_lx" EPC " TARGET_FMT_lx" cause %d\n" -" S %08x C %08x A " TARGET_FMT_lx" D " TARGET_FMT_lx"\n" , - __func__, env->active_tc.PC, env->CP0_EPC, cause, - env->CP0_Status, env->CP0_Cause, env->CP0_BadVAddr, - env->CP0_DEPC); +" S %08x C %08x A " TARGET_FMT_lx" D " TARGET_FMT_lx"\n" , + __func__, env->active_tc.PC, env->CP0_EPC, cause, + env->CP0_Status, env->CP0_Cause, env->CP0_BadVAddr, + env->CP0_DEPC); }#endif cs->exception_index =EXCP_NONE ;
target-mips/op_helper.c +2 -1
@@ -38,7 +38,8 @@ static inline void QEMU_NORETURN do_raise_exception_err(CPUMIPSState *env,CPUState *cs =CPU (mips_env_get_cpu (env));if (exception <EXCP_SC ) { -qemu_log ("%s: %d %d\n" , __func__, exception, error_code); +qemu_log_mask (CPU_LOG_INT ,"%s: %d %d\n" , + __func__, exception, error_code); } cs->exception_index = exception; env->error_code = error_code;
Signature · 1 line
2.1.0
Peter Maydell
AppliedQuoted 21 lines · Leon Alrae
Hi,
First target-mips pull request for 2.5 consisting of patches sent during 2.4 freeze.
Thanks,
LeonCc Peter Maydell <[email protected]>Cc Aurelien Jarno <[email protected]>The following changes since commit
ca0e5d8b0d065a95d0f9042f71b2ace45b015596:Open 2.5 development tree (2015-08-11 23:15:55 +0100)
are available in the git repository at:
git://github.com/lalrae/qemu.gittags/mips-20150813for you to fetch changes up to
c85570163bdf1ba29cb52a63f22ff1c48f1b9398:
Quoted 8 lines
target-mips: Use
CPU_LOG_INTfor logging related to interrupts (2015-08-13 16:22:53 +0100)----------------------------------------------------------------
MIPS patches 2015-08-13Changes:
* mips32r5-generic CPU updated and renamed to P5600
* improvements in LWL/LDL, logging and fulong2e
Applied, thanks.
-- PMM