Add RX archtecture support
v32 cover Add RX archtecture support
Hello.
This patch series is added Renesas RX target emulation.
Changes for v31.
Squash minor changes.
Changes for v30.
Follow master changes.
Fix checkpatch error.
Changes for v29.
Add target description XML. It required gdb-9.1.
Follow git master changes.
Changes for v28.
Allow -m option.
With this option, 16 Mbytes or more can be specified. Add example for qemu-doc.
Fix build error on latest master.
Changes for v27.
Added RX section to qemu-doc.
Rebase for master
Changes for v26.
Rebase for 5.0
Update machine.json for 5.0
Changes for v25.
Update commit message.
Squashed qapi/machine.json changes.
Changes for v24.
Add note for qapi/machine.json.
Added Acked-by for 6/22.
git rebase master.
Changes for v23.
Follow master changes.
Changes for v22.
Added some include.
Changes for v21.
rebase latest master.
Remove unneeded hmp_info_tlb.
Chanegs for v20.
Reorderd patches.
Squashed v19 changes.
Changes for v19.
Follow tcg changes.
Cleanup cpu.c.
simplify rx_cpu_class_by_name and rx_load_image move to rx-virt.
My git repository is bellow.git://git.pf.osdn.net/gitroot/y/ys/ysato/qemu.git tags/rx-20200224
Testing binaries bellow.
u-boot
Download - https://osdn.net/users/ysato/pf/qemu/dl/u-boot.bin.gz
starting
$ gzip -d u-boot.bin.gz $ qemu-system-rx -bios u-boot.bin
linux and pico-root (only sash)
Download - https://osdn.net/users/ysato/pf/qemu/dl/zImage (kernel)
https://osdn.net/users/ysato/pf/qemu/dl/rx-virt.dtb (DeviceTree)
starting
$ qemu-system-rx -kernel zImage -dtb rx-virt.dtb -append "earlycon"
Philippe Mathieu-Daudé (3):
hw/registerfields.h: Add 8bit and 16bit register macros hw/rx: Restrict the RX62N microcontroller to the RX62N CPU core
BootLinuxConsoleTest: Test the RX-Virt machine
Richard Henderson (7):
target/rx: Disassemble rx_index_addr into a string target/rx: Replace operand with prt_ldmi in disassembler target/rx: Use prt_ldmi for XCHG_mr disassembly target/rx: Emit all disassembly in one prt() target/rx: Collect all bytes during disassembly target/rx: Dump bytes for each insn during disassembly hw/rx: Honor -accel qtest
Yoshinori Sato (12):
MAINTAINERS: Add RX
qemu/bitops.h: Add extract8 and extract16 target/rx: TCG translation
target/rx: TCG helper
target/rx: CPU definition
target/rx: RX disassembler
hw/intc: RX62N interrupt controller (ICUa) hw/timer: RX62N internal timer modules hw/char: RX62N serial communication interface (SCI) hw/rx: RX Target hardware definition
Add rx-softmmu
qemu-doc.texi: Add RX section.
qemu-doc.texi | 44 + configure | 11 +- default-configs/rx-softmmu.mak | 3 + qapi/machine.json | 2 +- include/disas/dis-asm.h | 5 + include/exec/poison.h | 1 + include/hw/char/renesas_sci.h | 45 + include/hw/intc/rx_icu.h | 56 + include/hw/registerfields.h | 32 +- include/hw/rx/rx.h | 7 + include/hw/rx/rx62n.h | 91 + include/hw/timer/renesas_cmt.h | 38 + include/hw/timer/renesas_tmr.h | 53 + include/qemu/bitops.h | 38 + include/sysemu/arch_init.h | 1 + target/rx/cpu-param.h | 31 + target/rx/cpu-qom.h | 42 + target/rx/cpu.h | 181 ++ target/rx/helper.h | 31 + target/rx/insns.decode | 621 ++++++ arch_init.c | 2 + hw/char/renesas_sci.c | 342 ++++ hw/intc/rx_icu.c | 379 ++++ hw/rx/rx-virt.c | 144 ++ hw/rx/rx62n.c | 247 +++ hw/timer/renesas_cmt.c | 278 +++ hw/timer/renesas_tmr.c | 458 +++++ target/rx/cpu.c | 218 +++ target/rx/disas.c | 1446 ++++++++++++++ target/rx/gdbstub.c | 112 ++ target/rx/helper.c | 149 ++ target/rx/op_helper.c | 470 +++++ target/rx/translate.c | 2432 ++++++++++++++++++++++++ tests/qtest/machine-none-test.c | 1 + MAINTAINERS | 19 + gdb-xml/rx-core.xml | 70 + hw/Kconfig | 1 + hw/char/Kconfig | 3 + hw/char/Makefile.objs | 1 + hw/intc/Kconfig | 3 + hw/intc/Makefile.objs | 1 + hw/rx/Kconfig | 14 + hw/rx/Makefile.objs | 2 + hw/timer/Kconfig | 6 + hw/timer/Makefile.objs | 3 + target/rx/Makefile.objs | 11 + tests/acceptance/boot_linux_console.py | 46 + 47 files changed, 8188 insertions(+), 3 deletions(-) create mode 100644 default-configs/rx-softmmu.mak create mode 100644 include/hw/char/renesas_sci.h create mode 100644 include/hw/intc/rx_icu.h create mode 100644 include/hw/rx/rx.h create mode 100644 include/hw/rx/rx62n.h create mode 100644 include/hw/timer/renesas_cmt.h create mode 100644 include/hw/timer/renesas_tmr.h create mode 100644 target/rx/cpu-param.h create mode 100644 target/rx/cpu-qom.h create mode 100644 target/rx/cpu.h create mode 100644 target/rx/helper.h create mode 100644 target/rx/insns.decode create mode 100644 hw/char/renesas_sci.c create mode 100644 hw/intc/rx_icu.c create mode 100644 hw/rx/rx-virt.c create mode 100644 hw/rx/rx62n.c create mode 100644 hw/timer/renesas_cmt.c create mode 100644 hw/timer/renesas_tmr.c create mode 100644 target/rx/cpu.c create mode 100644 target/rx/disas.c create mode 100644 target/rx/gdbstub.c create mode 100644 target/rx/helper.c create mode 100644 target/rx/op_helper.c create mode 100644 target/rx/translate.c create mode 100644 gdb-xml/rx-core.xml create mode 100644 hw/rx/Kconfig create mode 100644 hw/rx/Makefile.objs create mode 100644 target/rx/Makefile.objs
Signature · 1 line
2.20.1
PATCH v32 2/22 qemu/bitops.h: Add extract8 and extract16
Message-Id: <[email protected]>
--- include/qemu/bitops.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
include/qemu/bitops.h +38 -0
@@ -301,6 +301,44 @@ static inline uint32_t extract32(uint32_t value, int start, int length)return (value >> start) & (~0U >> (32 - length)); } +/** +* extract8: +* @value: the value to extract the bit field from +* @start: the lowest bit in the bit field (numbered from 0) +* @length: the length of the bit field +* +* Extract from the 8 bit input @value the bit field specified by the +* @start and @length parameters, and return it. The bit field must +* lie entirely within the 8 bit word. It is valid to request that +* all 8 bits are returned (ie @length 8 and @start 0). +* +* Returns: the value of the bit field extracted from the input value. +*/ +static inline uint8_t extract8 (uint8_t value,int start,int length) +{ +assert (start >=0 && length >0 && length <=8 - start); +return extract32 (value, start, length); +} + +/** +* extract16: +* @value: the value to extract the bit field from +* @start: the lowest bit in the bit field (numbered from 0) +* @length: the length of the bit field +* +* Extract from the 16 bit input @value the bit field specified by the +* @start and @length parameters, and return it. The bit field must +* lie entirely within the 16 bit word. It is valid to request that +* all 16 bits are returned (ie @length 16 and @start 0). +* +* Returns: the value of the bit field extracted from the input value. +*/ +static inline uint16_t extract16 (uint16_t value,int start,int length) +{ +assert (start >=0 && length >0 && length <=16 - start); +return extract32 (value, start, length); +} +/** * extract64: * @value: the value to extract the bit field from
Signature · 1 line
2.20.1
PATCH v32 1/22 MAINTAINERS: Add RX
In reply to Yoshinori SatoMessage-Id: <[email protected]>
--- MAINTAINERS | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
MAINTAINERS +19 -0
@@ -274,6 +274,13 @@ F: include/hw/riscv/ F: linux-user/host/riscv32/ F: linux-user/host/riscv64/ +RENESAS RX CPUs +M: Yoshinori Sato <[email protected]> +S: Maintained +F: target/rx/ +F: hw/rx/ +F: include/hw/rx/ + S390 TCG CPUs M: Richard Henderson <[email protected]> M: David Hildenbrand <[email protected]>
@@ -1167,6 +1174,18 @@ F: pc-bios/canyonlands.dt[sb] F: pc-bios/u-boot-sam460ex-20100605.bin F: roms/u-boot-sam460ex +RX Machines +----------- +rx-virt +M: Yoshinori Sato <[email protected]> +S: Maintained +F: hw/rx/rxqemu.c +F: hw/intc/rx_icu.c +F: hw/timer/renesas_*.c +F: hw/char/renesas_sci.c +F: include/hw/timer/renesas_*.h +F: include/hw/char/renesas_sci.h + SH4 Machines ------------ R2D
Signature · 1 line
2.20.1
PATCH v32 11/22 target/rx: Emit all disassembly in one prt()
In reply to Yoshinori SatoFrom: Richard Henderson <[email protected]>
Many of the multi-part prints have been eliminated by previous patches. Eliminate the rest of them.
Message-Id: <[email protected]>
--- target/rx/disas.c | 75 ++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 36 deletions(-)
target/rx/disas.c +39 -36
@@ -228,24 +228,21 @@ static bool trans_MOV_ra(DisasContext *ctx, arg_MOV_ra *a)/* mov.[bwl] rs,rd */ static bool trans_MOV_mm (DisasContext *ctx,arg_MOV_mm *a) { -char dspd[8 ], dsps[8 ]; +char dspd[8 ], dsps[8 ], szc = size[a->sz]; -prt ("mov.%c\t" , size[a->sz]);if (a->lds ==3 && a->ldd ==3 ) {/* mov.[bwl] rs,rd */ -prt ("r%d, r%d" , a->rs, a->rd); -return true; - } -if (a->lds ==3 ) { +prt ("mov.%c\tr%d, r%d" , szc, a->rs, a->rd); + }else if (a->lds ==3 ) {rx_index_addr (ctx, dspd, a->ldd, a->sz); -prt ("r%d, %s[r%d]" , a->rs, dspd, a->rd); +prt ("mov.%c\tr%d, %s[r%d]" , szc, a->rs, dspd, a->rd); }else if (a->ldd ==3 ) {rx_index_addr (ctx, dsps, a->lds, a->sz); -prt ("%s[r%d], r%d" , dsps, a->rs, a->rd); +prt ("mov.%c\t%s[r%d], r%d" , szc, dsps, a->rs, a->rd); }else {rx_index_addr (ctx, dsps, a->lds, a->sz);rx_index_addr (ctx, dspd, a->ldd, a->sz); -prt ("%s[r%d], %s[r%d]" , dsps, a->rs, dspd, a->rd); +prt ("mov.%c\t%s[r%d], %s[r%d]" , szc, dsps, a->rs, dspd, a->rd); }return true; }
@@ -254,8 +251,11 @@ static bool trans_MOV_mm(DisasContext *ctx, arg_MOV_mm *a)/* mov.[bwl] rs,[-rd] */ static bool trans_MOV_rp (DisasContext *ctx,arg_MOV_rp *a) { -prt ("mov.%c\tr%d, " , size[a->sz], a->rs); -prt ((a->ad ==0 ) ?"[r%d+]" :"[-r%d]" , a->rd); +if (a->ad) { +prt ("mov.%c\tr%d, [-r%d]" , size[a->sz], a->rs, a->rd); + }else { +prt ("mov.%c\tr%d, [r%d+]" , size[a->sz], a->rs, a->rd); + }return true; }
@@ -263,9 +263,11 @@ static bool trans_MOV_rp(DisasContext *ctx, arg_MOV_rp *a)/* mov.[bwl] [-rd],rs */ static bool trans_MOV_pr (DisasContext *ctx,arg_MOV_pr *a) { -prt ("mov.%c\t" , size[a->sz]); -prt ((a->ad ==0 ) ?"[r%d+]" :"[-r%d]" , a->rd); -prt (", r%d" , a->rs); +if (a->ad) { +prt ("mov.%c\t[-r%d], r%d" , size[a->sz], a->rd, a->rs); + }else { +prt ("mov.%c\t[r%d+], r%d" , size[a->sz], a->rd, a->rs); + }return true; }
@@ -299,9 +301,11 @@ static bool trans_MOVU_ar(DisasContext *ctx, arg_MOVU_ar *a)/* movu.[bw] [-rs],rd */ static bool trans_MOVU_pr (DisasContext *ctx,arg_MOVU_pr *a) { -prt ("movu.%c\t" , size[a->sz]); -prt ((a->ad ==0 ) ?"[r%d+]" :"[-r%d]" , a->rd); -prt (", r%d" , a->rs); +if (a->ad) { +prt ("movu.%c\t[-r%d], r%d" , size[a->sz], a->rd, a->rs); + }else { +prt ("movu.%c\t[r%d+], r%d" , size[a->sz], a->rd, a->rs); + }return true; }
@@ -478,11 +482,11 @@ static bool trans_TST_mr(DisasContext *ctx, arg_TST_mr *a)/* not rs, rd */ static bool trans_NOT_rr (DisasContext *ctx,arg_NOT_rr *a) { -prt ("not\t" );if (a->rs != a->rd) { -prt ("r%d, " , a->rs); +prt ("not\tr%d, r%d" , a->rs, a->rd); + }else { +prt ("not\tr%d" , a->rs); } -prt ("r%d" , a->rd);return true; }
@@ -490,11 +494,11 @@ static bool trans_NOT_rr(DisasContext *ctx, arg_NOT_rr *a)/* neg rs, rd */ static bool trans_NEG_rr (DisasContext *ctx,arg_NEG_rr *a) { -prt ("neg\t" );if (a->rs != a->rd) { -prt ("r%d, " , a->rs); +prt ("neg\tr%d, r%d" , a->rs, a->rd); + }else { +prt ("neg\tr%d" , a->rs); } -prt ("r%d" , a->rd);return true; }
@@ -606,11 +610,10 @@ static bool trans_SBB_mr(DisasContext *ctx, arg_SBB_mr *a)/* abs rs, rd */ static bool trans_ABS_rr (DisasContext *ctx,arg_ABS_rr *a) { -prt ("abs\t" ); -if (a->rs == a->rd) { -prt ("r%d" , a->rd); +if (a->rs != a->rd) { +prt ("abs\tr%d, r%d" , a->rs, a->rd); }else { -prt ("r%d, r%d" , a->rs, a->rd); +prt ("abs\tr%d" , a->rs); }return true; }
@@ -733,11 +736,11 @@ static bool trans_DIVU_mr(DisasContext *ctx, arg_DIVU_mr *a)/* shll #imm:5, rs, rd */ static bool trans_SHLL_irr (DisasContext *ctx,arg_SHLL_irr *a) { -prt ("shll\t#%d, " , a->imm);if (a->rs2 != a->rd) { -prt ("r%d, " , a->rs2); +prt ("shll\t#%d, r%d, r%d" , a->imm, a->rs2, a->rd); + }else { +prt ("shll\t#%d, r%d" , a->imm, a->rd); } -prt ("r%d" , a->rd);return true; }
@@ -752,11 +755,11 @@ static bool trans_SHLL_rr(DisasContext *ctx, arg_SHLL_rr *a)/* shar #imm:5, rs, rd */ static bool trans_SHAR_irr (DisasContext *ctx,arg_SHAR_irr *a) { -prt ("shar\t#%d," , a->imm);if (a->rs2 != a->rd) { -prt ("r%d, " , a->rs2); +prt ("shar\t#%d, r%d, r%d" , a->imm, a->rs2, a->rd); + }else { +prt ("shar\t#%d, r%d" , a->imm, a->rd); } -prt ("r%d" , a->rd);return true; }
@@ -771,11 +774,11 @@ static bool trans_SHAR_rr(DisasContext *ctx, arg_SHAR_rr *a)/* shlr #imm:5, rs, rd */ static bool trans_SHLR_irr (DisasContext *ctx,arg_SHLR_irr *a) { -prt ("shlr\t#%d, " , a->imm);if (a->rs2 != a->rd) { -prt ("r%d, " , a->rs2); +prt ("shlr\t#%d, r%d, r%d" , a->imm, a->rs2, a->rd); + }else { +prt ("shlr\t#%d, r%d" , a->imm, a->rd); } -prt ("r%d" , a->rd);return true; }
Signature · 1 line
2.20.1
PATCH v32 13/22 target/rx: Dump bytes for each insn during disassembly
In reply to Yoshinori SatoFrom: Richard Henderson <[email protected]>
There are so many different forms of each RX instruction that it will be very useful to be able to look at the bytes to see on which path a bug may lie.
Message-Id: <[email protected]>
--- target/rx/disas.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
target/rx/disas.c +15 -1
@@ -102,7 +102,21 @@ static int bdsp_s(DisasContext *ctx, int d)/* Include the auto-generated decoder. */ #include "decode.inc.c" -#define prt (...) (ctx->dis->fprintf_func)((ctx->dis->stream), __VA_ARGS__) +static void dump_bytes (DisasContext *ctx) +{ +int i, len = ctx->len; + +for (i =0 ; i < len; ++i) { + ctx->dis->fprintf_func (ctx->dis->stream,"%02x " , ctx->bytes[i]); + } + ctx->dis->fprintf_func (ctx->dis->stream,"%*c" , (8 - i) *3 ,'\t' ); +} + +#define prt (...) \ + do { \ + dump_bytes(ctx); \ + ctx->dis->fprintf_func(ctx->dis->stream, __VA_ARGS__); \ + } while (0)#define RX_MEMORY_BYTE 0#define RX_MEMORY_WORD 1
Signature · 1 line
2.20.1
PATCH v32 10/22 target/rx: Use prt_ldmi for XCHG_mr disassembly
In reply to Yoshinori SatoFrom: Richard Henderson <[email protected]>
Note that the ld == 3 case handled by prt_ldmi is decoded as XCHG_rr and cannot appear here.
Message-Id: <[email protected]>
--- target/rx/disas.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
target/rx/disas.c +1 -7
@@ -366,13 +366,7 @@ static bool trans_XCHG_rr(DisasContext *ctx, arg_XCHG_rr *a)/* xchg dsp[rs].<mi>,rd */ static bool trans_XCHG_mr (DisasContext *ctx,arg_XCHG_mr *a) { -static const char msize[][4 ] = { -"b" ,"w" ,"l" ,"ub" ,"uw" , - }; -char dsp[8 ]; - -rx_index_addr (ctx, dsp, a->ld, a->mi); -prt ("xchg\t%s[r%d].%s, r%d" , dsp, a->rs, msize[a->mi], a->rd); +prt_ldmi (ctx,"xchg" , a->ld, a->mi, a->rs, a->rd);return true; }
Signature · 1 line
2.20.1
PATCH v32 3/22 hw/registerfields.h: Add 8bit and 16bit register macros
In reply to Yoshinori SatoFrom: Philippe Mathieu-Daudé <[email protected]>
Some RX peripheral using 8bit and 16bit registers. Added 8bit and 16bit APIs.
Message-Id: <[email protected]>
--- include/hw/registerfields.h | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-)
include/hw/registerfields.h +31 -1
@@ -22,6 +22,14 @@ enum { A_ ## reg = (addr) }; \ enum { R_ ## reg = (addr) / 4 }; +#define REG8 (reg, addr) \ + enum { A_ ## reg = (addr) }; \ + enum { R_ ## reg = (addr) }; + +#define REG16 (reg, addr) \ + enum { A_ ## reg = (addr) }; \ + enum { R_ ## reg = (addr) / 2 }; +/* Define SHIFT, LENGTH and MASK constants for a field within a register */ /* This macro will define R_FOO_BAR_MASK, R_FOO_BAR_SHIFT and R_FOO_BAR_LENGTH
@@ -34,6 +42,12 @@ MAKE_64BIT_MASK(shift, length)};/* Extract a field from a register */ +#define FIELD_EX8 (storage, reg, field) \ + extract8((storage), R_ ## reg ## _ ## field ## _SHIFT, \ + R_ ## reg ## _ ## field ## _LENGTH) +#define FIELD_EX16 (storage, reg, field) \ + extract16((storage), R_ ## reg ## _ ## field ## _SHIFT, \ + R_ ## reg ## _ ## field ## _LENGTH)#define FIELD_EX32 (storage, reg, field) \ extract32((storage), R_ ## reg ## _ ## field ## _SHIFT, \ R_ ## reg ## _ ## field ## _LENGTH)
@@ -49,6 +63,22 @@* Assigning values larger then the target field will result in * compilation warnings. */ +#define FIELD_DP8 (storage, reg, field, val) ({ \ + struct { \ + unsigned int v:R_ ## reg ## _ ## field ## _LENGTH; \ + } v = { .v = val }; \ + uint8_t d; \ + d = deposit32((storage), R_ ## reg ## _ ## field ## _SHIFT, \ + R_ ## reg ## _ ## field ## _LENGTH, v.v); \ + d; }) +#define FIELD_DP16 (storage, reg, field, val) ({ \ + struct { \ + unsigned int v:R_ ## reg ## _ ## field ## _LENGTH; \ + } v = { .v = val }; \ + uint16_t d; \ + d = deposit32((storage), R_ ## reg ## _ ## field ## _SHIFT, \ + R_ ## reg ## _ ## field ## _LENGTH, v.v); \ + d; })#define FIELD_DP32 (storage, reg, field, val) ({ \ struct { \ unsigned int v:R_ ## reg ## _ ## field ## _LENGTH; \
@@ -57,7 +87,7 @@ d = deposit32((storage), R_ ## reg ## _ ## field ## _SHIFT, \ R_ ## reg ## _ ## field ## _LENGTH, v.v); \ d; }) -#define FIELD_DP64 (storage, reg, field, val) ({ \ +#define FIELD_DP64 (storage, reg, field, val) ({ \ struct { \ unsigned int v:R_ ## reg ## _ ## field ## _LENGTH; \ } v = { .v = val }; \
Signature · 1 line
2.20.1
PATCH v32 8/22 target/rx: Disassemble rx_index_addr into a string
In reply to Yoshinori SatoFrom: Richard Henderson <[email protected]>
We were eliding all zero indexes. It is only ld==0 that does not have an index in the instruction. This also allows us to avoid breaking the final print into multiple pieces.
Message-Id: <[email protected]>
--- target/rx/disas.c | 154 +++++++++++++++++----------------------------- 1 file changed, 55 insertions(+), 99 deletions(-)
target/rx/disas.c +55 -99
@@ -107,49 +107,42 @@ static const char psw[] = { 'i', 'u', 0, 0, 0, 0, 0, 0, }; -static uint32_t rx_index_addr (int ld,int size,DisasContext *ctx) +static void rx_index_addr (DisasContext *ctx,char out[8 ],int ld,int mi) { -bfd_byte buf[2 ]; +uint32_t addr = ctx->addr; +uint8_t buf[2 ]; +uint16_t dsp; +switch (ld) {case 0 : -return 0 ; +/* No index; return empty string. */ + out[0 ] ='\0' ; +return ;case 1 : - ctx->dis->read_memory_func (ctx->addr, buf,1 , ctx->dis); ctx->addr +=1 ; -return ((uint8_t )buf[0 ]) << size; + ctx->dis->read_memory_func (addr, buf,1 , ctx->dis); + dsp = buf[0 ]; +break ;case 2 : - ctx->dis->read_memory_func (ctx->addr, buf,2 , ctx->dis); ctx->addr +=2 ; -return lduw_le_p (buf) << size; + ctx->dis->read_memory_func (addr, buf,2 , ctx->dis); + dsp =lduw_le_p (buf); +break ; +default : +g_assert_not_reached (); } -g_assert_not_reached (); + +sprintf (out,"%u" , dsp << (mi <3 ? mi :4 - mi)); }static void operand (DisasContext *ctx,int ld,int mi,int rs,int rd) { -int dsp;static const char sizes[][4 ] = {".b" ,".w" ,".l" ,".uw" ,".ub" }; +char dsp[8 ]; +if (ld <3 ) { -switch (mi) { -case 4 : -/* dsp[rs].ub */ - dsp =rx_index_addr (ld,RX_MEMORY_BYTE , ctx); -break ; -case 3 : -/* dsp[rs].uw */ - dsp =rx_index_addr (ld,RX_MEMORY_WORD , ctx); -break ; -default : -/* dsp[rs].b */ -/* dsp[rs].w */ -/* dsp[rs].l */ - dsp =rx_index_addr (ld, mi, ctx); -break ; - } -if (dsp >0 ) { -prt ("%d" , dsp); - } -prt ("[r%d]%s" , rs, sizes[mi]); +rx_index_addr (ctx, dsp, ld, mi); +prt ("%s[r%d]%s" , dsp, rs, sizes[mi]); }else {prt ("r%d" , rs); }
@@ -235,7 +228,7 @@ static bool trans_MOV_ra(DisasContext *ctx, arg_MOV_ra *a)/* mov.[bwl] rs,rd */ static bool trans_MOV_mm (DisasContext *ctx,arg_MOV_mm *a) { -int dsp; +char dspd[8 ], dsps[8 ];prt ("mov.%c\t" , size[a->sz]);if (a->lds ==3 && a->ldd ==3 ) {
@@ -244,29 +237,15 @@ static bool trans_MOV_mm(DisasContext *ctx, arg_MOV_mm *a)return true; }if (a->lds ==3 ) { -prt ("r%d, " , a->rd); - dsp =rx_index_addr (a->ldd, a->sz, ctx); -if (dsp >0 ) { -prt ("%d" , dsp); - } -prt ("[r%d]" , a->rs); +rx_index_addr (ctx, dspd, a->ldd, a->sz); +prt ("r%d, %s[r%d]" , a->rs, dspd, a->rd); }else if (a->ldd ==3 ) { - dsp =rx_index_addr (a->lds, a->sz, ctx); -if (dsp >0 ) { -prt ("%d" , dsp); - } -prt ("[r%d], r%d" , a->rs, a->rd); +rx_index_addr (ctx, dsps, a->lds, a->sz); +prt ("%s[r%d], r%d" , dsps, a->rs, a->rd); }else { - dsp =rx_index_addr (a->lds, a->sz, ctx); -if (dsp >0 ) { -prt ("%d" , dsp); - } -prt ("[r%d], " , a->rs); - dsp =rx_index_addr (a->ldd, a->sz, ctx); -if (dsp >0 ) { -prt ("%d" , dsp); - } -prt ("[r%d]" , a->rd); +rx_index_addr (ctx, dsps, a->lds, a->sz); +rx_index_addr (ctx, dspd, a->ldd, a->sz); +prt ("%s[r%d], %s[r%d]" , dsps, a->rs, dspd, a->rd); }return true; }
@@ -357,12 +336,10 @@ static bool trans_PUSH_r(DisasContext *ctx, arg_PUSH_r *a)/* push dsp[rs] */ static bool trans_PUSH_m (DisasContext *ctx,arg_PUSH_m *a) { -prt ("push\t" ); -int dsp =rx_index_addr (a->ld, a->sz, ctx); -if (dsp >0 ) { -prt ("%d" , dsp); - } -prt ("[r%d]" , a->rs); +char dsp[8 ]; + +rx_index_addr (ctx, dsp, a->ld, a->sz); +prt ("push\t%s[r%d]" , dsp, a->rs);return true; }
@@ -389,17 +366,13 @@ static bool trans_XCHG_rr(DisasContext *ctx, arg_XCHG_rr *a)/* xchg dsp[rs].<mi>,rd */ static bool trans_XCHG_mr (DisasContext *ctx,arg_XCHG_mr *a) { -int dsp;static const char msize[][4 ] = {"b" ,"w" ,"l" ,"ub" ,"uw" , }; +char dsp[8 ]; -prt ("xchg\t" ); - dsp =rx_index_addr (a->ld, a->mi, ctx); -if (dsp >0 ) { -prt ("%d" , dsp); - } -prt ("[r%d].%s, r%d" , a->rs, msize[a->mi], a->rd); +rx_index_addr (ctx, dsp, a->ld, a->mi); +prt ("xchg\t%s[r%d].%s, r%d" , dsp, a->rs, msize[a->mi], a->rd);return true; }
@@ -552,13 +525,10 @@ static bool trans_ADC_rr(DisasContext *ctx, arg_ADC_rr *a)/* adc dsp[rs], rd */ static bool trans_ADC_mr (DisasContext *ctx,arg_ADC_mr *a) { -int dsp; -prt ("adc\t" ); - dsp =rx_index_addr (a->ld,2 , ctx); -if (dsp >0 ) { -prt ("%d" , dsp); - } -prt ("[r%d], r%d" , a->rs, a->rd); +char dsp[8 ]; + +rx_index_addr (ctx, dsp, a->ld,2 ); +prt ("adc\t%s[r%d], r%d" , dsp, a->rs, a->rd);return true; }
@@ -1217,25 +1187,17 @@ static bool trans_ITOF(DisasContext *ctx, arg_ITOF *a)#define BOP_IM (name, reg) \ do { \ - int dsp; \ - prt("b%s\t#%d, ", #name, a->imm); \ - dsp = rx_index_addr(a->ld, RX_MEMORY_BYTE, ctx); \ - if (dsp > 0) { \ - prt("%d", dsp); \ - } \ - prt("[r%d]", reg); \ + char dsp[8]; \ + rx_index_addr(ctx, dsp, a->ld, RX_MEMORY_BYTE); \ + prt("b%s\t#%d, %s[r%d]", #name, a->imm, dsp, reg); \ return true; \ } while (0)#define BOP_RM (name) \ do { \ - int dsp; \ - prt("b%s\tr%d, ", #name, a->rd); \ - dsp = rx_index_addr(a->ld, RX_MEMORY_BYTE, ctx); \ - if (dsp > 0) { \ - prt("%d", dsp); \ - } \ - prt("[r%d]", a->rs); \ + char dsp[8]; \ + rx_index_addr(ctx, dsp, a->ld, RX_MEMORY_BYTE); \ + prt("b%s\tr%d, %s[r%d]", #name, a->rd, dsp, a->rs); \ return true; \ } while (0)
@@ -1346,12 +1308,10 @@ static bool trans_BNOT_ir(DisasContext *ctx, arg_BNOT_ir *a)/* bmcond #imm, dsp[rd] */ static bool trans_BMCnd_im (DisasContext *ctx,arg_BMCnd_im *a) { -int dsp =rx_index_addr (a->ld,RX_MEMORY_BYTE , ctx); -prt ("bm%s\t#%d, " , cond[a->cd], a->imm); -if (dsp >0 ) { -prt ("%d" , dsp); - } -prt ("[%d]" , a->rd); +char dsp[8 ]; + +rx_index_addr (ctx, dsp, a->ld,RX_MEMORY_BYTE ); +prt ("bm%s\t#%d, %s[r%d]" , cond[a->cd], a->imm, dsp, a->rd);return true; }
@@ -1443,16 +1403,12 @@ static bool trans_WAIT(DisasContext *ctx, arg_WAIT *a)/* sccnd.[bwl] dsp:[rd] */ static bool trans_SCCnd (DisasContext *ctx,arg_SCCnd *a) { -int dsp; -prt ("sc%s.%c\t" , cond[a->cd], size[a->sz]);if (a->ld <3 ) { - dsp =rx_index_addr (a->sz, a->ld, ctx); -if (dsp >0 ) { -prt ("%d" , dsp); - } -prt ("[r%d]" , a->rd); +char dsp[8 ]; +rx_index_addr (ctx, dsp, a->sz, a->ld); +prt ("sc%s.%c\t%s[r%d]" , cond[a->cd], size[a->sz], dsp, a->rd); }else { -prt ("r%d" , a->rd); +prt ("sc%s.%c\tr%d" , cond[a->cd], size[a->sz], a->rd); }return true; }
Signature · 1 line
2.20.1
PATCH v32 12/22 target/rx: Collect all bytes during disassembly
In reply to Yoshinori SatoFrom: Richard Henderson <[email protected]>
Collected, to be used in the next patch.
Message-Id: <[email protected]>
--- target/rx/disas.c | 62 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 20 deletions(-)
target/rx/disas.c +42 -20
@@ -25,43 +25,59 @@ typedef struct DisasContext {disassemble_info *dis;uint32_t addr;uint32_t pc; +uint8_t len; +uint8_t bytes[8 ]; } DisasContext;static uint32_t decode_load_bytes (DisasContext *ctx,uint32_t insn, -int i,int n) +int i,int n) { -bfd_byte buf; +uint32_t addr = ctx->addr; + +g_assert (ctx->len == i); +g_assert (n <=ARRAY_SIZE (ctx->bytes)); +while (++i <= n) { - ctx->dis->read_memory_func (ctx->addr++, &buf,1 , ctx->dis); - insn |= buf << (32 - i *8 ); + ctx->dis->read_memory_func (addr++, &ctx->bytes[i -1 ],1 , ctx->dis); + insn |= ctx->bytes[i -1 ] << (32 - i *8 ); } + ctx->addr = addr; + ctx->len = n; +return insn; }static int32_t li (DisasContext *ctx,int sz) { -int32_t addr; -bfd_byte buf[4 ]; - addr = ctx->addr; +uint32_t addr = ctx->addr; +uintptr_t len = ctx->len;switch (sz) {case 1 : +g_assert (len +1 <=ARRAY_SIZE (ctx->bytes)); ctx->addr +=1 ; - ctx->dis->read_memory_func (addr, buf,1 , ctx->dis); -return (int8_t )buf[0 ]; + ctx->len +=1 ; + ctx->dis->read_memory_func (addr, ctx->bytes + len,1 , ctx->dis); +return (int8_t )ctx->bytes[len];case 2 : +g_assert (len +2 <=ARRAY_SIZE (ctx->bytes)); ctx->addr +=2 ; - ctx->dis->read_memory_func (addr, buf,2 , ctx->dis); -return ldsw_le_p (buf); + ctx->len +=2 ; + ctx->dis->read_memory_func (addr, ctx->bytes + len,2 , ctx->dis); +return ldsw_le_p (ctx->bytes + len);case 3 : +g_assert (len +3 <=ARRAY_SIZE (ctx->bytes)); ctx->addr +=3 ; - ctx->dis->read_memory_func (addr, buf,3 , ctx->dis); -return (int8_t )buf[2 ] <<16 |lduw_le_p (buf); + ctx->len +=3 ; + ctx->dis->read_memory_func (addr, ctx->bytes + len,3 , ctx->dis); +return (int8_t )ctx->bytes[len +2 ] <<16 |lduw_le_p (ctx->bytes + len);case 0 : +g_assert (len +4 <=ARRAY_SIZE (ctx->bytes)); ctx->addr +=4 ; - ctx->dis->read_memory_func (addr, buf,4 , ctx->dis); -return ldl_le_p (buf); + ctx->len +=4 ; + ctx->dis->read_memory_func (addr, ctx->bytes + len,4 , ctx->dis); +return ldl_le_p (ctx->bytes + len);default :g_assert_not_reached (); }
@@ -110,7 +126,7 @@ static const char psw[] = {static void rx_index_addr (DisasContext *ctx,char out[8 ],int ld,int mi) {uint32_t addr = ctx->addr; -uint8_t buf[2 ]; +uintptr_t len = ctx->len;uint16_t dsp;switch (ld) {
@@ -119,14 +135,18 @@ static void rx_index_addr(DisasContext *ctx, char out[8], int ld, int mi) out[0 ] ='\0' ;return ;case 1 : +g_assert (len +1 <=ARRAY_SIZE (ctx->bytes)); ctx->addr +=1 ; - ctx->dis->read_memory_func (addr, buf,1 , ctx->dis); - dsp = buf[0 ]; + ctx->len +=1 ; + ctx->dis->read_memory_func (addr, ctx->bytes + len,1 , ctx->dis); + dsp = ctx->bytes[len];break ;case 2 : +g_assert (len +2 <=ARRAY_SIZE (ctx->bytes)); ctx->addr +=2 ; - ctx->dis->read_memory_func (addr, buf,2 , ctx->dis); - dsp =lduw_le_p (buf); + ctx->len +=2 ; + ctx->dis->read_memory_func (addr, ctx->bytes + len,2 , ctx->dis); + dsp =lduw_le_p (ctx->bytes + len);break ;default :g_assert_not_reached ();
@@ -1392,8 +1412,10 @@ int print_insn_rx(bfd_vma addr, disassemble_info *dis)DisasContext ctx;uint32_t insn;int i; + ctx.dis = dis; ctx.pc = ctx.addr = addr; + ctx.len =0 ; insn =decode_load (&ctx);if (!decode (&ctx, insn)) {
Signature · 1 line
2.20.1
PATCH v32 6/22 target/rx: CPU definition
In reply to Yoshinori SatoMessage-Id: <[email protected]>
Message-Id: <[email protected]>
[PMD: Use newer QOM style, split cpu-qom.h, restrict access to
extable array, use rx_cpu_tlb_fill() extracted from patch of Yoshinori Sato 'Convert to CPUClass::tlb_fill']
--- target/rx/cpu-param.h | 31 ++++++ target/rx/cpu-qom.h | 42 ++++++++ target/rx/cpu.h | 181 +++++++++++++++++++++++++++++++++ target/rx/cpu.c | 218 ++++++++++++++++++++++++++++++++++++++++ target/rx/gdbstub.c | 112 +++++++++++++++++++++ gdb-xml/rx-core.xml | 70 +++++++++++++ target/rx/Makefile.objs | 1 - 7 files changed, 654 insertions(+), 1 deletion(-) create mode 100644 target/rx/cpu-param.h create mode 100644 target/rx/cpu-qom.h create mode 100644 target/rx/cpu.h create mode 100644 target/rx/cpu.c create mode 100644 target/rx/gdbstub.c create mode 100644 gdb-xml/rx-core.xml
target/rx/cpu-param.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* RX cpu parameters +* +* Copyright (c) 2019 Yoshinori Sato +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2 or later, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along with +* this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef RX_CPU_PARAM_H +#define RX_CPU_PARAM_H + +#define TARGET_LONG_BITS 32 +#define TARGET_PAGE_BITS 12 + +#define TARGET_PHYS_ADDR_SPACE_BITS 32 +#define TARGET_VIRT_ADDR_SPACE_BITS 32 + +#define NB_MMU_MODES 1 +#define MMU_MODE0_SUFFIX _all + +#endif
target/rx/cpu-qom.h new file +42 -0
42 lines not on this page · raw message
target/rx/cpu.h new file +181 -0
181 lines not on this page · raw message
target/rx/cpu.c new file +218 -0
218 lines not on this page · raw message
target/rx/gdbstub.c new file +112 -0
112 lines not on this page · raw message
gdb-xml/rx-core.xml new file +70 -0
70 lines not on this page · raw message
target/rx/Makefile.objs +0 -1
@@ -1,5 +1,4 @@ obj-y += translate.o op_helper.o helper.o cpu.o gdbstub.o disas.o -obj-$(CONFIG_SOFTMMU) += monitor.o DECODETREE = $(SRC_PATH)/scripts/decodetree.py
Signature · 1 line
2.20.1
PATCH v32 9/22 target/rx: Replace operand with prt_ldmi in disassembler
In reply to Yoshinori SatoFrom: Richard Henderson <[email protected]>
This has consistency with prt_ri(). It loads all data before beginning output. It uses exactly one call to prt() to emit the full instruction.
Message-Id: <[email protected]>
--- target/rx/disas.c | 77 +++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 50 deletions(-)
target/rx/disas.c +27 -50
@@ -135,18 +135,18 @@ static void rx_index_addr(DisasContext *ctx, char out[8], int ld, int mi)sprintf (out,"%u" , dsp << (mi <3 ? mi :4 - mi)); } -static void operand (DisasContext *ctx,int ld,int mi,int rs,int rd) +static void prt_ldmi (DisasContext *ctx,const char *insn, +int ld,int mi,int rs,int rd) {static const char sizes[][4 ] = {".b" ,".w" ,".l" ,".uw" ,".ub" };char dsp[8 ];if (ld <3 ) {rx_index_addr (ctx, dsp, ld, mi); -prt ("%s[r%d]%s" , dsp, rs, sizes[mi]); +prt ("%s\t%s[r%d]%s, r%d" , insn, dsp, rs, sizes[mi], rd); }else { -prt ("r%d" , rs); +prt ("%s\tr%d, r%d" , insn, rs, rd); } -prt (", r%d" , rd); }static void prt_ir (DisasContext *ctx,const char *insn,int imm,int rd)
@@ -416,8 +416,7 @@ static bool trans_AND_ir(DisasContext *ctx, arg_AND_ir *a)/* and rs,rd */ static bool trans_AND_mr (DisasContext *ctx,arg_AND_mr *a) { -prt ("and\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"and" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -440,8 +439,7 @@ static bool trans_OR_ir(DisasContext *ctx, arg_OR_ir *a)/* or rs,rd */ static bool trans_OR_mr (DisasContext *ctx,arg_OR_mr *a) { -prt ("or\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"or" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -463,8 +461,7 @@ static bool trans_XOR_ir(DisasContext *ctx, arg_XOR_ir *a)/* xor rs,rd */ static bool trans_XOR_mr (DisasContext *ctx,arg_XOR_mr *a) { -prt ("xor\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"xor" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -479,8 +476,7 @@ static bool trans_TST_ir(DisasContext *ctx, arg_TST_ir *a)/* tst rs, rd */ static bool trans_TST_mr (DisasContext *ctx,arg_TST_mr *a) { -prt ("tst\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"tst" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -548,8 +544,7 @@ static bool trans_ADD_irr(DisasContext *ctx, arg_ADD_irr *a)/* add dsp[rs], rd */ static bool trans_ADD_mr (DisasContext *ctx,arg_ADD_mr *a) { -prt ("add\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"add" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -573,8 +568,7 @@ static bool trans_CMP_ir(DisasContext *ctx, arg_CMP_ir *a)/* cmp dsp[rs], rs2 */ static bool trans_CMP_mr (DisasContext *ctx,arg_CMP_mr *a) { -prt ("cmp\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"cmp" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -589,8 +583,7 @@ static bool trans_SUB_ir(DisasContext *ctx, arg_SUB_ir *a)/* sub dsp[rs], rd */ static bool trans_SUB_mr (DisasContext *ctx,arg_SUB_mr *a) { -prt ("sub\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"sub" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -611,8 +604,7 @@ static bool trans_SBB_rr(DisasContext *ctx, arg_SBB_rr *a)/* sbb dsp[rs], rd */ static bool trans_SBB_mr (DisasContext *ctx,arg_SBB_mr *a) { -prt ("sbb\t" ); -operand (ctx, a->ld,RX_IM_LONG , a->rs, a->rd); +prt_ldmi (ctx,"sbb" , a->ld,RX_IM_LONG , a->rs, a->rd);return true; }
@@ -640,8 +632,7 @@ static bool trans_MAX_ir(DisasContext *ctx, arg_MAX_ir *a)/* max dsp[rs], rd */ static bool trans_MAX_mr (DisasContext *ctx,arg_MAX_mr *a) { -prt ("max\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"max" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -656,8 +647,7 @@ static bool trans_MIN_ir(DisasContext *ctx, arg_MIN_ir *a)/* min dsp[rs], rd */ static bool trans_MIN_mr (DisasContext *ctx,arg_MIN_mr *a) { -prt ("max\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"min" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -673,8 +663,7 @@ static bool trans_MUL_ir(DisasContext *ctx, arg_MUL_ir *a)/* mul dsp[rs], rd */ static bool trans_MUL_mr (DisasContext *ctx,arg_MUL_mr *a) { -prt ("mul\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"mul" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -696,8 +685,7 @@ static bool trans_EMUL_ir(DisasContext *ctx, arg_EMUL_ir *a)/* emul dsp[rs], rd */ static bool trans_EMUL_mr (DisasContext *ctx,arg_EMUL_mr *a) { -prt ("emul\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"emul" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -712,8 +700,7 @@ static bool trans_EMULU_ir(DisasContext *ctx, arg_EMULU_ir *a)/* emulu dsp[rs], rd */ static bool trans_EMULU_mr (DisasContext *ctx,arg_EMULU_mr *a) { -prt ("emulu\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"emulu" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -728,8 +715,7 @@ static bool trans_DIV_ir(DisasContext *ctx, arg_DIV_ir *a)/* div dsp[rs], rd */ static bool trans_DIV_mr (DisasContext *ctx,arg_DIV_mr *a) { -prt ("div\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"div" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -744,8 +730,7 @@ static bool trans_DIVU_ir(DisasContext *ctx, arg_DIVU_ir *a)/* divu dsp[rs], rd */ static bool trans_DIVU_mr (DisasContext *ctx,arg_DIVU_mr *a) { -prt ("divu\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"divu" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -1089,8 +1074,7 @@ static bool trans_FADD_ir(DisasContext *ctx, arg_FADD_ir *a)/* fadd rs, rd */ static bool trans_FADD_mr (DisasContext *ctx,arg_FADD_mr *a) { -prt ("fadd\t" ); -operand (ctx, a->ld,RX_IM_LONG , a->rs, a->rd); +prt_ldmi (ctx,"fadd" , a->ld,RX_IM_LONG , a->rs, a->rd);return true; }
@@ -1105,8 +1089,7 @@ static bool trans_FCMP_ir(DisasContext *ctx, arg_FCMP_ir *a)/* fcmp rs, rd */ static bool trans_FCMP_mr (DisasContext *ctx,arg_FCMP_mr *a) { -prt ("fcmp\t" ); -operand (ctx, a->ld,RX_IM_LONG , a->rs, a->rd); +prt_ldmi (ctx,"fcmp" , a->ld,RX_IM_LONG , a->rs, a->rd);return true; }
@@ -1121,8 +1104,7 @@ static bool trans_FSUB_ir(DisasContext *ctx, arg_FSUB_ir *a)/* fsub rs, rd */ static bool trans_FSUB_mr (DisasContext *ctx,arg_FSUB_mr *a) { -prt ("fsub\t" ); -operand (ctx, a->ld,RX_IM_LONG , a->rs, a->rd); +prt_ldmi (ctx,"fsub" , a->ld,RX_IM_LONG , a->rs, a->rd);return true; }
@@ -1130,8 +1112,7 @@ static bool trans_FSUB_mr(DisasContext *ctx, arg_FSUB_mr *a)/* ftoi rs, rd */ static bool trans_FTOI (DisasContext *ctx,arg_FTOI *a) { -prt ("ftoi\t" ); -operand (ctx, a->ld,RX_IM_LONG , a->rs, a->rd); +prt_ldmi (ctx,"ftoi" , a->ld,RX_IM_LONG , a->rs, a->rd);return true; }
@@ -1146,8 +1127,7 @@ static bool trans_FMUL_ir(DisasContext *ctx, arg_FMUL_ir *a)/* fmul rs, rd */ static bool trans_FMUL_mr (DisasContext *ctx,arg_FMUL_mr *a) { -prt ("fmul\t" ); -operand (ctx, a->ld,RX_IM_LONG , a->rs, a->rd); +prt_ldmi (ctx,"fmul" , a->ld,RX_IM_LONG , a->rs, a->rd);return true; }
@@ -1162,8 +1142,7 @@ static bool trans_FDIV_ir(DisasContext *ctx, arg_FDIV_ir *a)/* fdiv rs, rd */ static bool trans_FDIV_mr (DisasContext *ctx,arg_FDIV_mr *a) { -prt ("fdiv\t" ); -operand (ctx, a->ld,RX_IM_LONG , a->rs, a->rd); +prt_ldmi (ctx,"fdiv" , a->ld,RX_IM_LONG , a->rs, a->rd);return true; }
@@ -1171,8 +1150,7 @@ static bool trans_FDIV_mr(DisasContext *ctx, arg_FDIV_mr *a)/* round rs, rd */ static bool trans_ROUND (DisasContext *ctx,arg_ROUND *a) { -prt ("round\t" ); -operand (ctx, a->ld,RX_IM_LONG , a->rs, a->rd); +prt_ldmi (ctx,"round" , a->ld,RX_IM_LONG , a->rs, a->rd);return true; }
@@ -1180,8 +1158,7 @@ static bool trans_ROUND(DisasContext *ctx, arg_ROUND *a)/* itof dsp[rs], rd */ static bool trans_ITOF (DisasContext *ctx,arg_ITOF *a) { -prt ("itof\t" ); -operand (ctx, a->ld,RX_IM_LONG , a->rs, a->rd); +prt_ldmi (ctx,"itof" , a->ld,RX_IM_LONG , a->rs, a->rd);return true; }
Signature · 1 line
2.20.1
PATCH v32 21/22 BootLinuxConsoleTest: Test the RX-Virt machine
In reply to Yoshinori SatoFrom: Philippe Mathieu-Daudé <[email protected]>
Add two tests for the rx-virt machine, based on the recommended test setup from Yoshinori Sato:
https://lists.gnu.org/archive/html/qemu-devel/2019-05/msg03586.html
- U-Boot prompt
- Linux kernel with Sash shell
These are very quick tests:
$ avocado run -t arch:rx tests/acceptance/boot_linux_console.py JOB ID : 84a6ef01c0b87975ecbfcb31a920afd735753ace JOB LOG : /home/phil/avocado/job-results/job-2019-05-24T05.02-84a6ef0/job.log (1/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_rx_uboot: PASS (0.11 s) (2/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_rx_linux: PASS (0.45 s) RESULTS : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
Tests can also be run with:
$ avocado --show=console run -t arch:rx tests/acceptance/boot_linux_console.py console: U-Boot 2016.05-rc3-23705-ga1ef3c71cb-dirty (Feb 05 2019 - 21:56:06 +0900) console: Linux version 4.19.0+ (yo-satoh@yo-satoh-debian) (gcc version 9.0.0 20181105 (experimental) (GCC)) #137 Wed Feb 20 23:20:02 JST 2019 console: Built 1 zonelists, mobility grouping on. Total pages: 8128 ... console: SuperH (H)SCI(F) driver initialized console: 88240.serial: ttySC0 at MMIO 0x88240 (irq = 215, base_baud = 0) is a sci console: console [ttySC0] enabled console: 88248.serial: ttySC1 at MMIO 0x88248 (irq = 219, base_baud = 0) is a sci
Based-on: [email protected] "RX architecture support"
--- tests/acceptance/boot_linux_console.py | 46 ++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
tests/acceptance/boot_linux_console.py +46 -0
@@ -686,3 +686,49 @@ class BootLinuxConsole(Test): tar_hash = '49e88d9933742f0164b60839886c9739cb7a0d34' self.vm.add_args('-cpu', 'dc233c') self.do_test_advcal_2018('02', tar_hash, 'santas-sleigh-ride.elf') + + def test_rx_uboot(self): + """ + :avocado: tags=arch:rx + :avocado: tags=machine:rx-virt + :avocado: tags=endian:little + """ + uboot_url = ('https://acc.dl.osdn.jp/users/23/23888/u-boot.bin.gz') + uboot_hash = '9b78dbd43b40b2526848c0b1ce9de02c24f4dcdb' + uboot_path = self.fetch_asset(uboot_url, asset_hash=uboot_hash) + uboot_path = archive.uncompress(uboot_path, self.workdir) + + self.vm.set_machine('rx-virt') + self.vm.set_console() + self.vm.add_args('-bios', uboot_path, + '-no-reboot') + self.vm.launch() + uboot_version = 'U-Boot 2016.05-rc3-23705-ga1ef3c71cb-dirty' + self.wait_for_console_pattern(uboot_version) + gcc_version = 'rx-unknown-linux-gcc (GCC) 9.0.0 20181105 (experimental)' + # FIXME limit baudrate on chardev, else we type too fast + #self.exec_command_and_wait_for_pattern('version', gcc_version) + + def test_rx_linux(self): + """ + :avocado: tags=arch:rx + :avocado: tags=machine:rx-virt + :avocado: tags=endian:little + """ + dtb_url = ('https://acc.dl.osdn.jp/users/23/23887/rx-qemu.dtb') + dtb_hash = '7b4e4e2c71905da44e86ce47adee2210b026ac18' + dtb_path = self.fetch_asset(dtb_url, asset_hash=dtb_hash) + kernel_url = ('http://acc.dl.osdn.jp/users/23/23845/zImage') + kernel_hash = '39a81067f8d72faad90866ddfefa19165d68fc99' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + + self.vm.set_machine('rx-virt') + self.vm.set_console() + kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'earlycon' + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-no-reboot') + self.vm.launch() + self.wait_for_console_pattern('Sash command shell (version 1.1.1)') + self.exec_command_and_wait_for_pattern('printenv', + 'TERM=linux')
Signature · 1 line
2.20.1
PATCH v32 18/22 hw/rx: Honor -accel qtest
In reply to Yoshinori SatoFrom: Richard Henderson <[email protected]>
Issue an error if no kernel, no bios, and not qtest'ing. Fixes make check-qtest-rx: test/qom-test.
Message-Id: <[email protected]>
---
We could squash this with the previous patch
--- hw/rx/rx62n.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
hw/rx/rx62n.c +9 -1
@@ -21,12 +21,14 @@#include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/rx/rx62n.h" #include "hw/loader.h" #include "hw/sysbus.h" #include "hw/qdev-properties.h" #include "sysemu/sysemu.h" +#include "sysemu/qtest.h" #include "cpu.h" /*
@@ -191,8 +193,14 @@ static void rx62n_realize(DeviceState *dev, Error **errp)memory_region_init_rom (&s->c_flash,NULL ,"codeflash" ,RX62N_CFLASH_SIZE , errp);memory_region_add_subregion (s->sysmem,RX62N_CFLASH_BASE , &s->c_flash); +if (!s->kernel) { -rom_add_file_fixed (bios_name,RX62N_CFLASH_BASE ,0 ); +if (bios_name) { +rom_add_file_fixed (bios_name,RX62N_CFLASH_BASE ,0 ); + }else if (!qtest_enabled ()) { +error_report ("No bios or kernel specified" ); +exit (1 ); + } }/* Initialize CPU */
Signature · 1 line
2.20.1
PATCH v32 19/22 hw/rx: Restrict the RX62N microcontroller to the RX62N CPU core
In reply to Yoshinori SatoFrom: Philippe Mathieu-Daudé <[email protected]>
While the VIRT machine can use different microcontrollers, the RX62N microcontroller is tied to the RX62N CPU core.
--- hw/rx/rx-virt.c | 2 ++ 1 file changed, 2 insertions(+)
hw/rx/rx-virt.c +2 -0
@@ -17,6 +17,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h"
@@ -56,6 +57,7 @@ static void rx_load_image(RXCPU *cpu, const char *filename,static void rxvirt_init (MachineState *machine) { +MachineClass *mc =MACHINE_GET_CLASS (machine);RX62NState *s =g_new (RX62NState,1 );MemoryRegion *sysmem =get_system_memory ();MemoryRegion *sdram =g_new (MemoryRegion,1 );
Signature · 1 line
2.20.1
PATCH v32 20/22 Add rx-softmmu
In reply to Yoshinori SatoMessage-Id: <[email protected]>
pick ed65c02993 target/rx: Add RX to SysEmuTarget pick 01372568ae tests: Add rx to machine-none-test.c [PMD: Squashed patches from Richard Henderson modifying
qapi/common.json and tests/machine-none-test.c]
--- configure | 11 ++++++++++- default-configs/rx-softmmu.mak | 3 +++ qapi/machine.json | 2 +- include/exec/poison.h | 1 + include/sysemu/arch_init.h | 1 + arch_init.c | 2 ++ tests/qtest/machine-none-test.c | 1 + hw/Kconfig | 1 + 8 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 default-configs/rx-softmmu.mak
configure +10 -1
@@ -4142,7 +4142,7 @@ fi fdt_required=no for target in $target_list; do case $target in - aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu|riscv*-softmmu) + aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu|riscv*-softmmu|rx-softmmu) fdt_required=yes ;; esac
@@ -7832,6 +7832,12 @@ case "$target_name" in mttcg=yes gdb_xml_files="riscv-64bit-cpu.xml riscv-32bit-fpu.xml riscv-64bit-fpu.xml riscv-64bit-csr.xml riscv-64bit-virtual.xml" ;; + rx) + TARGET_ARCH=rx + bflt="yes" + target_compiler=$cross_cc_rx + gdb_xml_files="rx-core.xml" + ;; sh4|sh4eb) TARGET_ARCH=sh4 bflt="yes"
@@ -8013,6 +8019,9 @@ for i in $ARCH $TARGET_BASE_ARCH ; do riscv*) disas_config "RISCV" ;; + rx) + disas_config "RX" + ;; s390*) disas_config "S390" ;;
default-configs/rx-softmmu.mak new file +3 -0
@@ -0,0 +1,3 @@ +# Default configuration for rx-softmmu + +CONFIG_RX_VIRT=y
qapi/machine.json +1 -1
@@ -26,7 +26,7 @@ 'data' : [ 'aarch64', 'alpha', 'arm', 'cris', 'hppa', 'i386', 'lm32', 'm68k', 'microblaze', 'microblazeel', 'mips', 'mips64', 'mips64el', 'mipsel', 'moxie', 'nios2', 'or1k', 'ppc', - 'ppc64', 'riscv32', 'riscv64', 's390x', 'sh4', + 'ppc64', 'riscv32', 'riscv64', 'rx', 's390x', 'sh4', 'sh4eb', 'sparc', 'sparc64', 'tricore', 'unicore32', 'x86_64', 'xtensa', 'xtensaeb' ] }
include/exec/poison.h +1 -0
@@ -26,6 +26,7 @@#pragma GCC poison TARGET_PPC#pragma GCC poison TARGET_PPC64#pragma GCC poison TARGET_ABI32 +#pragma GCC poison TARGET_RX#pragma GCC poison TARGET_S390X#pragma GCC poison TARGET_SH4#pragma GCC poison TARGET_SPARC
include/sysemu/arch_init.h +1 -0
@@ -24,6 +24,7 @@ enum {QEMU_ARCH_NIOS2 = (1 <<17 ),QEMU_ARCH_HPPA = (1 <<18 ),QEMU_ARCH_RISCV = (1 <<19 ), + QEMU_ARCH_RX = (1 << 20), };extern const uint32_t arch_type;
arch_init.c +2 -0
@@ -77,6 +77,8 @@ int graphic_depth = 32;#define QEMU_ARCH QEMU_ARCH_PPC#elif defined(TARGET_RISCV )#define QEMU_ARCH QEMU_ARCH_RISCV +#elif defined(TARGET_RX ) +#define QEMU_ARCH QEMU_ARCH_RX#elif defined(TARGET_S390X )#define QEMU_ARCH QEMU_ARCH_S390X#elif defined(TARGET_SH4 )
tests/qtest/machine-none-test.c +1 -0
@@ -56,6 +56,7 @@ static struct arch2cpu cpus_map[] = { { "hppa", "hppa" }, { "riscv64", "rv64gcsu-v1.10.0" }, { "riscv32", "rv32gcsu-v1.9.1" }, + { "rx", "rx62n" }, };static const char *get_cpu_model_by_arch (const char *arch)
hw/Kconfig +1 -0
@@ -55,6 +55,7 @@ source nios2/Kconfig source openrisc/Kconfig source ppc/Kconfig source riscv/Kconfig +source rx/Kconfig source s390x/Kconfig source sh4/Kconfig source sparc/Kconfig
Signature · 1 line
2.20.1
PATCH v32 5/22 target/rx: TCG helper
In reply to Yoshinori SatoMessage-Id: <[email protected]>
Message-Id: <[email protected]>
[PMD: Removed tlb_fill, extracted from patch of Yoshinori Sato
'Convert to CPUClass::tlb_fill']
--- target/rx/helper.h | 31 +++ target/rx/helper.c | 149 +++++++++++++ target/rx/op_helper.c | 470 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 650 insertions(+) create mode 100644 target/rx/helper.h create mode 100644 target/rx/helper.c create mode 100644 target/rx/op_helper.c
target/rx/helper.h new file +31 -0
@@ -0,0 +1,31 @@ +DEF_HELPER_1(raise_illegal_instruction, noreturn, env) +DEF_HELPER_1(raise_access_fault, noreturn, env) +DEF_HELPER_1(raise_privilege_violation, noreturn, env) +DEF_HELPER_1(wait, noreturn, env) +DEF_HELPER_1(debug, noreturn, env) +DEF_HELPER_2(rxint, noreturn, env, i32) +DEF_HELPER_1(rxbrk, noreturn, env) +DEF_HELPER_FLAGS_3(fadd, TCG_CALL_NO_WG, f32, env, f32, f32) +DEF_HELPER_FLAGS_3(fsub, TCG_CALL_NO_WG, f32, env, f32, f32) +DEF_HELPER_FLAGS_3(fmul, TCG_CALL_NO_WG, f32, env, f32, f32) +DEF_HELPER_FLAGS_3(fdiv, TCG_CALL_NO_WG, f32, env, f32, f32) +DEF_HELPER_FLAGS_3(fcmp, TCG_CALL_NO_WG, void, env, f32, f32) +DEF_HELPER_FLAGS_2(ftoi, TCG_CALL_NO_WG, i32, env, f32) +DEF_HELPER_FLAGS_2(round, TCG_CALL_NO_WG, i32, env, f32) +DEF_HELPER_FLAGS_2(itof, TCG_CALL_NO_WG, f32, env, i32) +DEF_HELPER_2(set_fpsw, void, env, i32) +DEF_HELPER_FLAGS_2(racw, TCG_CALL_NO_WG, void, env, i32) +DEF_HELPER_FLAGS_2(set_psw_rte, TCG_CALL_NO_WG, void, env, i32) +DEF_HELPER_FLAGS_2(set_psw, TCG_CALL_NO_WG, void, env, i32) +DEF_HELPER_1(pack_psw, i32, env) +DEF_HELPER_FLAGS_3(div, TCG_CALL_NO_WG, i32, env, i32, i32) +DEF_HELPER_FLAGS_3(divu, TCG_CALL_NO_WG, i32, env, i32, i32) +DEF_HELPER_FLAGS_1(scmpu, TCG_CALL_NO_WG, void, env) +DEF_HELPER_1(smovu, void, env) +DEF_HELPER_1(smovf, void, env) +DEF_HELPER_1(smovb, void, env) +DEF_HELPER_2(sstr, void, env, i32) +DEF_HELPER_FLAGS_2(swhile, TCG_CALL_NO_WG, void, env, i32) +DEF_HELPER_FLAGS_2(suntil, TCG_CALL_NO_WG, void, env, i32) +DEF_HELPER_FLAGS_2(rmpa, TCG_CALL_NO_WG, void, env, i32) +DEF_HELPER_1 (satr, void, env)
target/rx/helper.c new file +149 -0
149 lines not on this page · raw message
target/rx/op_helper.c new file +470 -0
470 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v32 16/22 hw/char: RX62N serial communication interface (SCI)
In reply to Yoshinori SatoThis module supported only non FIFO type.
Hardware manual.
https://www.renesas.com/us/en/doc/products/mpumcu/doc/rx_family/r01uh0033ej0140_rx62n.pdf
Message-Id: <[email protected]>
--- include/hw/char/renesas_sci.h | 45 +++++ hw/char/renesas_sci.c | 342 ++++++++++++++++++++++++++++++++++ hw/char/Kconfig | 3 + hw/char/Makefile.objs | 1 + 4 files changed, 391 insertions(+) create mode 100644 include/hw/char/renesas_sci.h create mode 100644 hw/char/renesas_sci.c
include/hw/char/renesas_sci.h new file +45 -0
@@ -0,0 +1,45 @@ +/* +* Renesas Serial Communication Interface +* +* Copyright (c) 2018 Yoshinori Sato +* +* This code is licensed under the GPL version 2 or later. +* +*/ + +#include "chardev/char-fe.h" +#include "qemu/timer.h" +#include "hw/sysbus.h" + +#define TYPE_RENESAS_SCI "renesas-sci" +#define RSCI (obj) OBJECT_CHECK(RSCIState, (obj), TYPE_RENESAS_SCI) + +enum { +ERI =0 , +RXI =1 , +TXI =2 , +TEI =3 , +SCI_NR_IRQ =4 , +}; + +typedef struct { +SysBusDevice parent_obj; +MemoryRegion memory; + +uint8_t smr; +uint8_t brr; +uint8_t scr; +uint8_t tdr; +uint8_t ssr; +uint8_t rdr; +uint8_t scmr; +uint8_t semr; + +uint8_t read_ssr; +int64_t trtime; +int64_t rx_next; +QEMUTimer *timer; +CharBackend chr; +uint64_t input_freq; +qemu_irq irq[SCI_NR_IRQ ]; +}RSCIState ;
hw/char/renesas_sci.c new file +342 -0
342 lines not on this page · raw message
hw/char/Kconfig +3 -0
@@ -46,3 +46,6 @@ config SCLPCONSOLE config TERMINAL3270 bool + +config RENESAS_SCI + bool
hw/char/Makefile.objs +1 -0
@@ -20,6 +20,7 @@ common-obj-$(CONFIG_SH4) += sh_serial.o common-obj-$(CONFIG_DIGIC) += digic-uart.o common-obj-$(CONFIG_STM32F2XX_USART) += stm32f2xx_usart.o common-obj-$(CONFIG_RASPI) += bcm2835_aux.o +common-obj-$(CONFIG_RENESAS_SCI) += renesas_sci.o common-obj-$(CONFIG_CMSDK_APB_UART) += cmsdk-apb-uart.o common-obj-$(CONFIG_ETRAXFS) += etraxfs_ser.o
Signature · 1 line
2.20.1
PATCH v32 7/22 target/rx: RX disassembler
In reply to Yoshinori SatoMessage-Id: <[email protected]>
--- include/disas/dis-asm.h | 5 + target/rx/disas.c | 1480 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 1485 insertions(+) create mode 100644 target/rx/disas.c
include/disas/dis-asm.h +5 -0
@@ -226,6 +226,10 @@ enum bfd_architecture#define bfd_mach_nios2r2 2 bfd_arch_lm32, /* Lattice Mico32 */#define bfd_mach_lm32 1 + bfd_arch_rx, /* Renesas RX */ +#define bfd_mach_rx 0x75 +#define bfd_mach_rx_v2 0x76 +#define bfd_mach_rx_v3 0x77 bfd_arch_last };#define bfd_mach_s390_31 31
@@ -436,6 +440,7 @@ int print_insn_little_nios2 (bfd_vma, disassemble_info*);int print_insn_xtensa (bfd_vma ,disassemble_info *);int print_insn_riscv32 (bfd_vma ,disassemble_info *);int print_insn_riscv64 (bfd_vma ,disassemble_info *); +int print_insn_rx (bfd_vma ,disassemble_info *);#if 0 /* Fetch the disassembler for a given BFD, if that support is available. */
target/rx/disas.c new file +1480 -0
1,480 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v32 14/22 hw/intc: RX62N interrupt controller (ICUa)
In reply to Yoshinori SatoThis implementation supported only ICUa.
Hardware manual.
https://www.renesas.com/us/en/doc/products/mpumcu/doc/rx_family/r01uh0033ej0140_rx62n.pdf
Message-Id: <[email protected]>
--- include/hw/intc/rx_icu.h | 56 ++++++ hw/intc/rx_icu.c | 379 +++++++++++++++++++++++++++++++++++++++ hw/intc/Kconfig | 3 + hw/intc/Makefile.objs | 1 + 4 files changed, 439 insertions(+) create mode 100644 include/hw/intc/rx_icu.h create mode 100644 hw/intc/rx_icu.c
include/hw/intc/rx_icu.h new file +56 -0
@@ -0,0 +1,56 @@ +#ifndef RX_ICU_H +#define RX_ICU_H + +#include "qemu-common.h" +#include "hw/irq.h" + +enum TRG_MODE { +TRG_LEVEL =0 , +TRG_NEDGE =1 ,/* Falling */ +TRG_PEDGE =2 ,/* Raising */ +TRG_BEDGE =3 ,/* Both */ +}; + +struct IRQSource { +enum TRG_MODE sense; +int level; +}; + +enum { +/* Software interrupt request */ +SWI =27 , +NR_IRQS =256 , +}; + +struct RXICUState { +SysBusDevice parent_obj; + +MemoryRegion memory; +struct IRQSource src[NR_IRQS ]; +char *icutype; +uint32_t nr_irqs; +uint32_t *map; +uint32_t nr_sense; +uint32_t *init_sense; + +uint8_t ir[NR_IRQS ]; +uint8_t dtcer[NR_IRQS ]; +uint8_t ier[NR_IRQS /8 ]; +uint8_t ipr[142 ]; +uint8_t dmasr[4 ]; +uint16_t fir; +uint8_t nmisr; +uint8_t nmier; +uint8_t nmiclr; +uint8_t nmicr; +int req_irq; +qemu_irq _irq; +qemu_irq _fir; +qemu_irq _swi; +}; +typedef struct RXICUState RXICUState ; + +#define TYPE_RXICU "rx-icu" +#define RXICU (obj) OBJECT_CHECK(RXICUState, (obj), TYPE_RXICU) + +#endif /* RX_ICU_H */
hw/intc/rx_icu.c new file +379 -0
379 lines not on this page · raw message
hw/intc/Kconfig +3 -0
@@ -61,3 +61,6 @@ config S390_FLIC_KVM config OMPIC bool + +config RX_ICU + bool
hw/intc/Makefile.objs +1 -0
@@ -49,3 +49,4 @@ obj-$(CONFIG_ARM_GIC) += arm_gicv3_cpuif.o obj-$(CONFIG_MIPS_CPS) += mips_gic.o obj-$(CONFIG_NIOS2) += nios2_iic.o obj-$(CONFIG_OMPIC) += ompic.o +obj-$(CONFIG_RX) += rx_icu.o
Signature · 1 line
2.20.1
PATCH v32 17/22 hw/rx: RX Target hardware definition
In reply to Yoshinori Satorx62n - RX62N cpu.
rx-virt - RX QEMU virtual target.
Message-Id: <[email protected]>
Message-Id: <[email protected]>
[PMD: Use TYPE_RX62N_CPU, use #define for RX62N_NR_TMR/CMT/SCI,
renamed CPU -> MCU, device -> microcontroller]
---
v23 changes.
Add missing includes.
v21 changes.rx_load_image move to rx-virt.c
v19: Fixed typo (Peter Maydell)
--- include/hw/rx/rx.h | 7 ++ include/hw/rx/rx62n.h | 91 ++++++++++++++++ hw/rx/rx-virt.c | 142 +++++++++++++++++++++++++ hw/rx/rx62n.c | 239 ++++++++++++++++++++++++++++++++++++++++++ hw/rx/Kconfig | 14 +++ hw/rx/Makefile.objs | 2 + 6 files changed, 495 insertions(+) create mode 100644 include/hw/rx/rx.h create mode 100644 include/hw/rx/rx62n.h create mode 100644 hw/rx/rx-virt.c create mode 100644 hw/rx/rx62n.c create mode 100644 hw/rx/Kconfig create mode 100644 hw/rx/Makefile.objs
include/hw/rx/rx.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef QEMU_RX_H +#define QEMU_RX_H +/* Definitions for RX board emulation. */ + +#include "target/rx/cpu-qom.h" + +#endif
include/hw/rx/rx62n.h new file +91 -0
91 lines not on this page · raw message
hw/rx/rx-virt.c new file +142 -0
142 lines not on this page · raw message
hw/rx/rx62n.c new file +239 -0
239 lines not on this page · raw message
hw/rx/Kconfig new file +14 -0
@@ -0,0 +1,14 @@ +config RX + bool + +config RX62N + bool + select RX + select RX_ICU + select RENESAS_TMR8 + select RENESAS_CMT + select RENESAS_SCI + +config RX_VIRT + bool + select RX62N
hw/rx/Makefile.objs new file +2 -0
@@ -0,0 +1,2 @@ +obj-$(CONFIG_RX62N) += rx62n.o +obj-$(CONFIG_RX_VIRT) += rx-virt.o
Signature · 1 line
2.20.1
PATCH v32 15/22 hw/timer: RX62N internal timer modules
In reply to Yoshinori Satorenesas_tmr: 8bit timer modules.renesas_cmt: 16bit compare match timer modules.
This part use many renesas's CPU.
Hardware manual.
https://www.renesas.com/us/en/doc/products/mpumcu/doc/rx_family/r01uh0033ej0140_rx62n.pdf
Message-Id: <[email protected]>
--- include/hw/timer/renesas_cmt.h | 38 +++ include/hw/timer/renesas_tmr.h | 53 ++++ hw/timer/renesas_cmt.c | 278 ++++++++++++++++++++ hw/timer/renesas_tmr.c | 458 +++++++++++++++++++++++++++++++++ hw/timer/Kconfig | 6 + hw/timer/Makefile.objs | 3 + 6 files changed, 836 insertions(+) create mode 100644 include/hw/timer/renesas_cmt.h create mode 100644 include/hw/timer/renesas_tmr.h create mode 100644 hw/timer/renesas_cmt.c create mode 100644 hw/timer/renesas_tmr.c
include/hw/timer/renesas_cmt.h new file +38 -0
@@ -0,0 +1,38 @@ +/* +* Renesas Compare-match timer Object +* +* Copyright (c) 2019 Yoshinori Sato +* +* This code is licensed under the GPL version 2 or later. +* +*/ + +#ifndef HW_RENESAS_CMT_H +#define HW_RENESAS_CMT_H + +#include "hw/sysbus.h" + +#define TYPE_RENESAS_CMT "renesas-cmt" +#define RCMT (obj) OBJECT_CHECK(RCMTState, (obj), TYPE_RENESAS_CMT) + +enum { +CMT_CH =2 , +CMT_NR_IRQ =1 *CMT_CH , +}; + +typedef struct RCMTState { +SysBusDevice parent_obj; + +uint64_t input_freq; +MemoryRegion memory; + +uint16_t cmstr; +uint16_t cmcr[CMT_CH ]; +uint16_t cmcnt[CMT_CH ]; +uint16_t cmcor[CMT_CH ]; +int64_t tick[CMT_CH ]; +qemu_irq cmi[CMT_CH ]; +QEMUTimer *timer[CMT_CH ]; +}RCMTState ; + +#endif
include/hw/timer/renesas_tmr.h new file +53 -0
53 lines not on this page · raw message
hw/timer/renesas_cmt.c new file +278 -0
278 lines not on this page · raw message
hw/timer/renesas_tmr.c new file +458 -0
458 lines not on this page · raw message
hw/timer/Kconfig +6 -0
@@ -35,3 +35,9 @@ config CMSDK_APB_TIMER config CMSDK_APB_DUALTIMER bool select PTIMER + +config RENESAS_TMR8 + bool + +config RENESAS_CMT + bool
hw/timer/Makefile.objs +3 -0
@@ -28,6 +28,9 @@ common-obj-$(CONFIG_MIPS_CPS) += mips_gictimer.o common-obj-$(CONFIG_ALLWINNER_A10_PIT) += allwinner-a10-pit.o +obj-$(CONFIG_RENESAS_TMR8) += renesas_tmr.o +obj-$(CONFIG_RENESAS_CMT) += renesas_cmt.o + common-obj-$(CONFIG_STM32F2XX_TIMER) += stm32f2xx_timer.o common-obj-$(CONFIG_ASPEED_SOC) += aspeed_timer.o
Signature · 1 line
2.20.1
PATCH v32 22/22 qemu-doc.texi: Add RX section.
In reply to Yoshinori SatoDescribe emulated target specification. And two examples.
--- qemu-doc.texi | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
qemu-doc.texi +44 -0
@@ -1719,6 +1719,7 @@ differences are mentioned in the following sections. * Microblaze System emulator:: * SH4 System emulator:: * Xtensa System emulator:: +* RX System emulator:: @end menu @node PowerPC System emulator
@@ -2487,6 +2488,49 @@ so should only be used with trusted guest OS. @c man end +@node RX System emulator +@section RX System emulator +@cindex system emulation (RX) + +Use the executable @file{qemu-system-rx} to simulate a Virtual RX target. +This target emulated following devices. + +@itemize @minus +@item +R5F562N8 MCU +@item +On-chip memory (ROM 512KB, RAM 96KB) +@item +Interrupt Control Unit (ICUa) +@item +8Bit Timer x 1CH (TMR0,1) +@item +Compare Match Timer x 2CH (CMT0,1) +@item +Serial Communication Interface x 1CH (SCI0) +@item +External memory 16MByte +@end itemize + +Example of @file{qemu-system-rx} usage for rx is shown below: + +Download @code{u-boot_image} from @url{https://osdn.net/users/ysato/pf/qemu/dl/u-boot.bin.gz} + +Start emulation of rx-virt: +@example +qemu-system-rx -bios @code{u-boot_image} +@end example + +Download @code{kernel_image} from @url{https://osdn.net/users/ysato/pf/qemu/dl/zImage} + +Download @code{device_tree_blob} from @url{https://osdn.net/users/ysato/pf/qemu/dl/rx-virt.dtb} + +Start emulation of rx-virt: +@example +qemu-system-rx -kernel @code{kernel_image} -dtb @code{device_tree_blob} \ + -append "earlycon" +@end example + @node QEMU User space emulator @chapter QEMU User space emulator
Signature · 1 line
2.20.1
PATCH v32 4/22 target/rx: TCG translation
In reply to Yoshinori SatoThis part only supported RXv1 instructions.
Instruction manual.
https://www.renesas.com/us/en/doc/products/mpumcu/doc/rx_family/r01us0032ej0120_rxsm.pdf
Message-Id: <[email protected]>
--- target/rx/insns.decode | 621 ++++++++++ target/rx/translate.c | 2432 +++++++++++++++++++++++++++++++++++++++ target/rx/Makefile.objs | 12 + 3 files changed, 3065 insertions(+) create mode 100644 target/rx/insns.decode create mode 100644 target/rx/translate.c create mode 100644 target/rx/Makefile.objs
target/rx/insns.decode new file +621 -0
@@ -0,0 +1,621 @@ +# +# Renesas RX instruction decode definitions. +# +# Copyright (c) 2019 Richard Henderson <[email protected]> +# Copyright (c) 2019 Yoshinori Sato <[email protected]> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, see <http://www.gnu.org/licenses/>. +# + +&bcnd cd dsp sz +&jdsp dsp sz +&jreg rs +&rr rd rs +&ri rd imm +&rrr rd rs rs2 +&rri rd imm rs2 +&rm rd rs ld mi +&mi rs ld mi imm +&mr rs ld mi rs2 +&mcnd ld sz rd cd +######## +%b1_bdsp 24:3 !function=bdsp_s + +@b1_bcnd_s .... cd:1 ... &bcnd dsp=%b1_bdsp sz=1 +@b1_bra_s .... .... &jdsp dsp=%b1_bdsp sz=1 + +%b2_r_0 16:4 +%b2_li_2 18:2 !function=li +%b2_li_8 24:2 !function=li +%b2_dsp5_3 23:4 19:1 + +@b2_rds .... .... .... rd:4 &rr rs=%b2_r_0 +@b2_rds_li .... .... .... rd:4 &rri rs2=%b2_r_0 imm=%b2_li_8 +@b2_rds_uimm4 .... .... imm:4 rd:4 &rri rs2=%b2_r_0 +@b2_rs2_uimm4 .... .... imm:4 rs2:4 &rri rd=0 +@b2_rds_imm5 .... ... imm:5 rd:4 &rri rs2=%b2_r_0 +@b2_rd_rs_li .... .... rs2:4 rd:4 &rri imm=%b2_li_8 +@b2_rd_ld_ub .... .. ld:2 rs:4 rd:4 &rm mi=4 +@b2_ld_imm3 .... .. ld:2 rs:4 . imm:3 &mi mi=4 +@b2_bcnd_b .... cd:4 dsp:s8 &bcnd sz=2 +@b2_bra_b .... .... dsp:s8 &jdsp sz=2 + +######## + +%b3_r_0 8:4 +%b3_li_10 18:2 !function=li +%b3_dsp5_8 23:1 16:4 +%b3_bdsp 8:s8 16:8 + +@b3_rd_rs .... .... .... .... rs:4 rd:4 &rr +@b3_rs_rd .... .... .... .... rd:4 rs:4 &rr +@b3_rd_li .... .... .... .... .... rd:4 \ + &rri rs2=%b3_r_0 imm=%b3_li_10 +@b3_rd_ld .... .... mi:2 .... ld:2 rs:4 rd:4 &rm +@b3_rd_ld_ub .... .... .... .. ld:2 rs:4 rd:4 &rm mi=4 +@b3_rd_ld_ul .... .... .... .. ld:2 rs:4 rd:4 &rm mi=2 +@b3_rd_rs_rs2 .... .... .... rd:4 rs:4 rs2:4 &rrr +@b3_rds_imm5 .... .... ....... imm:5 rd:4 &rri rs2=%b3_r_0 +@b3_rd_rs_imm5 .... .... ... imm:5 rs2:4 rd:4 &rri +@b3_bcnd_w .... ... cd:1 .... .... .... .... &bcnd dsp=%b3_bdsp sz=3 +@b3_bra_w .... .... .... .... .... .... &jdsp dsp=%b3_bdsp sz=3 +@b3_ld_rd_rs .... .... .... .. ld:2 rs:4 rd:4 &rm mi=0 +@b3_sz_ld_rd_cd .... .... .... sz:2 ld:2 rd:4 cd:4 &mcnd + +######## + +%b4_li_18 18:2 !function=li +%b4_dsp_16 0:s8 8:8 +%b4_bdsp 0:s8 8:8 16:8 + +@b4_rd_ldmi .... .... mi:2 .... ld:2 .... .... rs:4 rd:4 &rm +@b4_bra_a .... .... .... .... .... .... .... .... \ + &jdsp dsp=%b4_bdsp sz=4 +######## +# ABS rd +ABS_rr 0111 1110 0010 .... @b2_rds +# ABS rs, rd +ABS_rr 1111 1100 0000 1111 .... .... @b3_rd_rs + +# ADC #imm, rd +ADC_ir 1111 1101 0111 ..00 0010 .... @b3_rd_li +# ADC rs, rd +ADC_rr 1111 1100 0000 1011 .... .... @b3_rd_rs +# ADC dsp[rs].l, rd +# Note only mi==2 allowed. +ADC_mr 0000 0110 ..10 00.. 0000 0010 .... .... @b4_rd_ldmi + +# ADD #uimm4, rd +ADD_irr 0110 0010 .... .... @b2_rds_uimm4 +# ADD #imm, rs, rd +ADD_irr 0111 00.. .... .... @b2_rd_rs_li +# ADD dsp[rs].ub, rd +# ADD rs, rd +ADD_mr 0100 10.. .... .... @b2_rd_ld_ub +# ADD dsp[rs], rd +ADD_mr 0000 0110 ..00 10.. .... .... @b3_rd_ld +# ADD rs, rs2, rd +ADD_rrr 1111 1111 0010 .... .... .... @b3_rd_rs_rs2 + +# AND #uimm4, rd +AND_ir 0110 0100 .... .... @b2_rds_uimm4 +# AND #imm, rd +AND_ir 0111 01.. 0010 .... @b2_rds_li +# AND dsp[rs].ub, rd +# AND rs, rd +AND_mr 0101 00.. .... .... @b2_rd_ld_ub +# AND dsp[rs], rd +AND_mr 0000 0110 ..01 00.. .... .... @b3_rd_ld +# AND rs, rs2, rd +AND_rrr 1111 1111 0100 .... .... .... @b3_rd_rs_rs2 + +# BCLR #imm, dsp[rd] +BCLR_im 1111 00.. .... 1... @b2_ld_imm3 +# BCLR #imm, rs +BCLR_ir 0111 101. .... .... @b2_rds_imm5 +# BCLR rs, rd +# BCLR rs, dsp[rd] +{ + BCLR_rr 1111 1100 0110 0111 .... .... @b3_rs_rd + BCLR_rm 1111 1100 0110 01.. .... .... @b3_rd_ld_ub +} + +# BCnd.s dsp +BCnd 0001 .... @b1_bcnd_s +# BRA.b dsp +# BCnd.b dsp +{ + BRA 0010 1110 .... .... @b2_bra_b + BCnd 0010 .... .... .... @b2_bcnd_b +} + +# BCnd.w dsp +BCnd 0011 101 . .... .... .... .... @b3_bcnd_w + +# BNOT #imm, dsp[rd] +# BMCnd #imm, dsp[rd] +{ + BNOT_im 1111 1100 111 imm:3 ld:2 rs:4 1111 + BMCnd_im 1111 1100 111 imm:3 ld:2 rd:4 cd:4 +} + +# BNOT #imm, rd +# BMCnd #imm, rd +{ + BNOT_ir 1111 1101 111 imm:5 1111 rd:4 + BMCnd_ir 1111 1101 111 imm:5 cd:4 rd:4 +} + +# BNOT rs, rd +# BNOT rs, dsp[rd] +{ + BNOT_rr 1111 1100 0110 1111 .... .... @b3_rs_rd + BNOT_rm 1111 1100 0110 11.. .... .... @b3_rd_ld_ub +} + +# BRA.s dsp +BRA 0000 1 ... @b1_bra_s +# BRA.w dsp +BRA 0011 1000 .... .... .... .... @b3_bra_w +# BRA.a dsp +BRA 0000 0100 .... .... .... .... .... .... @b4_bra_a +# BRA.l rs +BRA_l 0111 1111 0100 rd:4 + +BRK 0000 0000 + +# BSET #imm, dsp[rd] +BSET_im 1111 00.. .... 0... @b2_ld_imm3 +# BSET #imm, rd +BSET_ir 0111 100. .... .... @b2_rds_imm5 +# BSET rs, rd +# BSET rs, dsp[rd] +{ + BSET_rr 1111 1100 0110 0011 .... .... @b3_rs_rd + BSET_rm 1111 1100 0110 00.. .... .... @b3_rd_ld_ub +} + +# BSR.w dsp +BSR 0011 1001 .... .... .... .... @b3_bra_w +# BSR.a dsp +BSR 0000 0101 .... .... .... .... .... .... @b4_bra_a +# BSR.l rs +BSR_l 0111 1111 0101 rd:4 + +# BSET #imm, dsp[rd] +BTST_im 1111 01.. .... 0... @b2_ld_imm3 +# BSET #imm, rd +BTST_ir 0111 110. .... .... @b2_rds_imm5 +# BSET rs, rd +# BSET rs, dsp[rd] +{ + BTST_rr 1111 1100 0110 1011 .... .... @b3_rs_rd + BTST_rm 1111 1100 0110 10.. .... .... @b3_rd_ld_ub +} + +# CLRSPW psw +CLRPSW 0111 1111 1011 cb:4 + +# CMP #uimm4, rs2 +CMP_ir 0110 0001 .... .... @b2_rs2_uimm4 +# CMP #uimm8, rs2 +CMP_ir 0111 0101 0101 rs2:4 imm:8 &rri rd=0 +# CMP #imm, rs2 +CMP_ir 0111 01.. 0000 rs2:4 &rri imm=%b2_li_8 rd=0 +# CMP dsp[rs].ub, rs2 +# CMP rs, rs2 +CMP_mr 0100 01.. .... .... @b2_rd_ld_ub +# CMP dsp[rs], rs2 +CMP_mr 0000 0110 ..00 01.. .... .... @b3_rd_ld + +# DIV #imm, rd +DIV_ir 1111 1101 0111 ..00 1000 .... @b3_rd_li +# DIV dsp[rs].ub, rd +# DIV rs, rd +DIV_mr 1111 1100 0010 00.. .... .... @b3_rd_ld_ub +# DIV dsp[rs], rd +DIV_mr 0000 0110 ..10 00.. 0000 1000 .... .... @b4_rd_ldmi + +# DIVU #imm, rd +DIVU_ir 1111 1101 0111 ..00 1001 .... @b3_rd_li +# DIVU dsp[rs].ub, rd +# DIVU rs, rd +DIVU_mr 1111 1100 0010 01.. .... .... @b3_rd_ld_ub +# DIVU dsp[rs], rd +DIVU_mr 0000 0110 ..10 00.. 0000 1001 .... .... @b4_rd_ldmi + +# EMUL #imm, rd +EMUL_ir 1111 1101 0111 ..00 0110 .... @b3_rd_li +# EMUL dsp[rs].ub, rd +# EMUL rs, rd +EMUL_mr 1111 1100 0001 10.. .... .... @b3_rd_ld_ub +# EMUL dsp[rs], rd +EMUL_mr 0000 0110 ..10 00.. 0000 0110 .... .... @b4_rd_ldmi + +# EMULU #imm, rd +EMULU_ir 1111 1101 0111 ..00 0111 .... @b3_rd_li +# EMULU dsp[rs].ub, rd +# EMULU rs, rd +EMULU_mr 1111 1100 0001 11.. .... .... @b3_rd_ld_ub +# EMULU dsp[rs], rd +EMULU_mr 0000 0110 ..10 00.. 0000 0111 .... .... @b4_rd_ldmi + +# FADD #imm, rd +FADD_ir 1111 1101 0111 0010 0010 rd:4 +# FADD rs, rd +# FADD dsp[rs], rd +FADD_mr 1111 1100 1000 10.. .... .... @b3_rd_ld_ul + +# FCMP #imm, rd +FCMP_ir 1111 1101 0111 0010 0001 rd:4 +# FCMP rs, rd +# FCMP dsp[rs], rd +FCMP_mr 1111 1100 1000 01.. .... .... @b3_rd_ld_ul + +# FDIV #imm, rd +FDIV_ir 1111 1101 0111 0010 0100 rd:4 +# FDIV rs, rd +# FDIV dsp[rs], rd +FDIV_mr 1111 1100 1001 00.. .... .... @b3_rd_ld_ul + +# FMUL #imm, rd +FMUL_ir 1111 1101 0111 0010 0011 rd:4 +# FMUL rs, rd +# FMUL dsp[rs], rd +FMUL_mr 1111 1100 1000 11.. .... .... @b3_rd_ld_ul + +# FSUB #imm, rd +FSUB_ir 1111 1101 0111 0010 0000 rd:4 +# FSUB rs, rd +# FSUB dsp[rs], rd +FSUB_mr 1111 1100 1000 00.. .... .... @b3_rd_ld_ul + +# FTOI rs, rd +# FTOI dsp[rs], rd +FTOI 1111 1100 1001 01.. .... .... @b3_rd_ld_ul + +# INT #uimm8 +INT 0111 0101 0110 0000 imm:8 + +# ITOF dsp[rs].ub, rd +# ITOF rs, rd +ITOF 1111 1100 0100 01.. .... .... @b3_rd_ld_ub +# ITOF dsp[rs], rd +ITOF 0000 0110 ..10 00.. 0001 0001 .... .... @b4_rd_ldmi + +# JMP rs +JMP 0111 1111 0000 rs:4 &jreg +# JSR rs +JSR 0111 1111 0001 rs:4 &jreg + +# MACHI rs, rs2 +MACHI 1111 1101 0000 0100 rs:4 rs2:4 +# MACLO rs, rs2 +MACLO 1111 1101 0000 0101 rs:4 rs2:4 + +# MAX #imm, rd +MAX_ir 1111 1101 0111 ..00 0100 .... @b3_rd_li +# MAX dsp[rs].ub, rd +# MAX rs, rd +MAX_mr 1111 1100 0001 00.. .... .... @b3_rd_ld_ub +# MAX dsp[rs], rd +MAX_mr 0000 0110 ..10 00.. 0000 0100 .... .... @b4_rd_ldmi + +# MIN #imm, rd +MIN_ir 1111 1101 0111 ..00 0101 .... @b3_rd_li +# MIN dsp[rs].ub, rd +# MIN rs, rd +MIN_mr 1111 1100 0001 01.. .... .... @b3_rd_ld_ub +# MIN dsp[rs], rd +MIN_mr 0000 0110 ..10 00.. 0000 0101 .... .... @b4_rd_ldmi + +# MOV.b rs, dsp5[rd] +MOV_rm 1000 0 .... rd:3 . rs:3 dsp=%b2_dsp5_3 sz=0 +# MOV.w rs, dsp5[rd] +MOV_rm 1001 0 .... rd:3 . rs:3 dsp=%b2_dsp5_3 sz=1 +# MOV.l rs, dsp5[rd] +MOV_rm 1010 0 .... rd:3 . rs:3 dsp=%b2_dsp5_3 sz=2 +# MOV.b dsp5[rs], rd +MOV_mr 1000 1 .... rs:3 . rd:3 dsp=%b2_dsp5_3 sz=0 +# MOV.w dsp5[rs], rd +MOV_mr 1001 1 .... rs:3 . rd:3 dsp=%b2_dsp5_3 sz=1 +# MOV.l dsp5[rs], rd +MOV_mr 1010 1 .... rs:3 . rd:3 dsp=%b2_dsp5_3 sz=2 +# MOV.l #uimm4, rd +MOV_ir 0110 0110 imm:4 rd:4 +# MOV.b #imm8, dsp5[rd] +MOV_im 0011 1100 . rd:3 .... imm:8 sz=0 dsp=%b3_dsp5_8 +# MOV.w #imm8, dsp5[rd] +MOV_im 0011 1101 . rd:3 .... imm:8 sz=1 dsp=%b3_dsp5_8 +# MOV.l #imm8, dsp5[rd] +MOV_im 0011 1110 . rd:3 .... imm:8 sz=2 dsp=%b3_dsp5_8 +# MOV.l #imm8, rd +MOV_ir 0111 0101 0100 rd:4 imm:8 +# MOV.l #mm8, rd +MOV_ir 1111 1011 rd:4 .. 10 imm=%b2_li_2 +# MOV.<bwl> #imm, [rd] +MOV_im 1111 1000 rd:4 .. sz:2 dsp=0 imm=%b2_li_2 +# MOV.<bwl> #imm, dsp8[rd] +MOV_im 1111 1001 rd:4 .. sz:2 dsp:8 imm=%b3_li_10 +# MOV.<bwl> #imm, dsp16[rd] +MOV_im 1111 1010 rd:4 .. sz:2 .... .... .... .... \ + imm=%b4_li_18 dsp=%b4_dsp_16 +# MOV.<bwl> [ri,rb], rd +MOV_ar 1111 1110 01 sz:2 ri:4 rb:4 rd:4 +# MOV.<bwl> rs, [ri,rb] +MOV_ra 1111 1110 00 sz:2 ri:4 rb:4 rs:4 +# Note ldd=3 and lds=3 indicate register src or dst +# MOV.b rs, rd +# MOV.b rs, dsp[rd] +# MOV.b dsp[rs], rd +# MOV.b dsp[rs], dsp[rd] +MOV_mm 1100 ldd:2 lds:2 rs:4 rd:4 sz=0 +# MOV.w rs, rd +# MOV.w rs, dsp[rd] +# MOV.w dsp[rs], rd +# MOV.w dsp[rs], dsp[rd] +MOV_mm 1101 ldd:2 lds:2 rs:4 rd:4 sz=1 +# MOV.l rs, rd +# MOV.l rs, dsp[rd] +# MOV.l dsp[rs], rd +# MOV.l dsp[rs], dsp[rd] +MOV_mm 1110 ldd:2 lds:2 rs:4 rd:4 sz=2 +# MOV.l rs, [rd+] +# MOV.l rs, [-rd] +MOV_rp 1111 1101 0010 0 ad:1 sz:2 rd:4 rs:4 +# MOV.l [rs+], rd +# MOV.l [-rs], rd +MOV_pr 1111 1101 0010 1 ad:1 sz:2 rd:4 rs:4 + +# MOVU.<bw> dsp5[rs], rd +MOVU_mr 1011 sz:1 ... . rs:3 . rd:3 dsp=%b2_dsp5_3 +# MOVU.<bw> [rs], rd +MOVU_mr 0101 1 sz:1 00 rs:4 rd:4 dsp=0 +# MOVU.<bw> dsp8[rs], rd +MOVU_mr 0101 1 sz:1 01 rs:4 rd:4 dsp:8 +# MOVU.<bw> dsp16[rs], rd +MOVU_mr 0101 1 sz:1 10 rs:4 rd:4 .... .... .... .... dsp=%b4_dsp_16 +# MOVU.<bw> rs, rd +MOVU_rr 0101 1 sz:1 11 rs:4 rd:4 +# MOVU.<bw> [ri, rb], rd +MOVU_ar 1111 1110 110 sz:1 ri:4 rb:4 rd:4 +# MOVU.<bw> [rs+], rd +MOVU_pr 1111 1101 0011 1 ad:1 0 sz:1 rd:4 rs:4 + +# MUL #uimm4, rd +MUL_ir 0110 0011 .... .... @b2_rds_uimm4 +# MUL #imm4, rd +MUL_ir 0111 01.. 0001 .... @b2_rds_li +# MUL dsp[rs].ub, rd +# MUL rs, rd +MUL_mr 0100 11.. .... .... @b2_rd_ld_ub +# MUL dsp[rs], rd +MUL_mr 0000 0110 ..00 11.. .... .... @b3_rd_ld +# MOV rs, rs2, rd +MUL_rrr 1111 1111 0011 .... .... .... @b3_rd_rs_rs2 + +# MULHI rs, rs2 +MULHI 1111 1101 0000 0000 rs:4 rs2:4 +# MULLO rs, rs2 +MULLO 1111 1101 0000 0001 rs:4 rs2:4 + +# MVFACHI rd +MVFACHI 1111 1101 0001 1111 0000 rd:4 +# MVFACMI rd +MVFACMI 1111 1101 0001 1111 0010 rd:4 + +# MVFC cr, rd +MVFC 1111 1101 0110 1010 cr:4 rd:4 + +# MVTACHI rs +MVTACHI 1111 1101 0001 0111 0000 rs:4 +# MVTACLO rs +MVTACLO 1111 1101 0001 0111 0001 rs:4 + +# MVTC #imm, cr +MVTC_i 1111 1101 0111 ..11 0000 cr:4 imm=%b3_li_10 +# MVTC rs, cr +MVTC_r 1111 1101 0110 1000 rs:4 cr:4 + +# MVTIPL #imm +MVTIPL 0111 0101 0111 0000 0000 imm:4 + +# NEG rd +NEG_rr 0111 1110 0001 .... @b2_rds +# NEG rs, rd +NEG_rr 1111 1100 0000 0111 .... .... @b3_rd_rs + +NOP 0000 0011 + +# NOT rd +NOT_rr 0111 1110 0000 .... @b2_rds +# NOT rs, rd +NOT_rr 1111 1100 0011 1011 .... .... @b3_rd_rs + +# OR #uimm4, rd +OR_ir 0110 0101 .... .... @b2_rds_uimm4 +# OR #imm, rd +OR_ir 0111 01.. 0011 .... @b2_rds_li +# OR dsp[rs].ub, rd +# OR rs, rd +OR_mr 0101 01.. .... .... @b2_rd_ld_ub +# OR dsp[rs], rd +OR_mr 0000 0110 .. 0101 .. .... .... @b3_rd_ld +# OR rs, rs2, rd +OR_rrr 1111 1111 0101 .... .... .... @b3_rd_rs_rs2 + +# POP cr +POPC 0111 1110 1110 cr:4 +# POP rd-rd2 +POPM 0110 1111 rd:4 rd2:4 + +# POP rd +# PUSH.<bwl> rs +{ + POP 0111 1110 1011 rd:4 + PUSH_r 0111 1110 10 sz:2 rs:4 +} +# PUSH.<bwl> dsp[rs] +PUSH_m 1111 01 ld:2 rs:4 10 sz:2 +# PUSH cr +PUSHC 0111 1110 1100 cr:4 +# PUSHM rs-rs2 +PUSHM 0110 1110 rs:4 rs2:4 + +# RACW #imm +RACW 1111 1101 0001 1000 000 imm:1 0000 + +# REVL rs,rd +REVL 1111 1101 0110 0111 .... .... @b3_rd_rs +# REVW rs,rd +REVW 1111 1101 0110 0101 .... .... @b3_rd_rs + +# SMOVF +# RPMA.<bwl> +{ + SMOVF 0111 1111 1000 1111 + RMPA 0111 1111 1000 11 sz:2 +} + +# ROLC rd +ROLC 0111 1110 0101 .... @b2_rds +# RORC rd +RORC 0111 1110 0100 .... @b2_rds + +# ROTL #imm, rd +ROTL_ir 1111 1101 0110 111. .... .... @b3_rds_imm5 +# ROTL rs, rd +ROTL_rr 1111 1101 0110 0110 .... .... @b3_rd_rs + +# ROTR #imm, rd +ROTR_ir 1111 1101 0110 110. .... .... @b3_rds_imm5 +# ROTR #imm, rd +ROTR_rr 1111 1101 0110 0100 .... .... @b3_rd_rs + +# ROUND rs,rd +# ROUND dsp[rs],rd +ROUND 1111 1100 1001 10 .. .... .... @b3_ld_rd_rs + +RTE 0111 1111 1001 0101 + +RTFI 0111 1111 1001 0100 + +RTS 0000 0010 + +# RTSD #imm +RTSD_i 0110 0111 imm:8 +# RTSD #imm, rd-rd2 +RTSD_irr 0011 1111 rd:4 rd2:4 imm:8 + +# SAT rd +SAT 0111 1110 0011 .... @b2_rds +# SATR +SATR 0111 1111 1001 0011 + +# SBB rs, rd +SBB_rr 1111 1100 0000 0011 .... .... @b3_rd_rs +# SBB dsp[rs].l, rd +# Note only mi==2 allowed. +SBB_mr 0000 0110 ..10 00.. 0000 0000 .... .... @b4_rd_ldmi + +# SCCnd dsp[rd] +# SCCnd rd +SCCnd 1111 1100 1101 .... .... .... @b3_sz_ld_rd_cd + +# SETPSW psw +SETPSW 0111 1111 1010 cb:4 + +# SHAR #imm, rd +SHAR_irr 0110 101. .... .... @b2_rds_imm5 +# SHAR #imm, rs, rd +SHAR_irr 1111 1101 101. .... .... .... @b3_rd_rs_imm5 +# SHAR rs, rd +SHAR_rr 1111 1101 0110 0001 .... .... @b3_rd_rs + +# SHLL #imm, rd +SHLL_irr 0110 110. .... .... @b2_rds_imm5 +# SHLL #imm, rs, rd +SHLL_irr 1111 1101 110. .... .... .... @b3_rd_rs_imm5 +# SHLL rs, rd +SHLL_rr 1111 1101 0110 0010 .... .... @b3_rd_rs + +# SHLR #imm, rd +SHLR_irr 0110 100. .... .... @b2_rds_imm5 +# SHLR #imm, rs, rd +SHLR_irr 1111 1101 100. .... .... .... @b3_rd_rs_imm5 +# SHLR rs, rd +SHLR_rr 1111 1101 0110 0000 .... .... @b3_rd_rs + +# SMOVB +# SSTR.<bwl> +{ + SMOVB 0111 1111 1000 1011 + SSTR 0111 1111 1000 10 sz:2 +} + +# STNZ #imm, rd +STNZ 1111 1101 0111 ..00 1111 .... @b3_rd_li +# STZ #imm, rd +STZ 1111 1101 0111 ..00 1110 .... @b3_rd_li + +# SUB #uimm4, rd +SUB_ir 0110 0000 .... .... @b2_rds_uimm4 +# SUB dsp[rs].ub, rd +# SUB rs, rd +SUB_mr 0100 00.. .... .... @b2_rd_ld_ub +# SUB dsp[rs], rd +SUB_mr 0000 0110 ..00 00.. .... .... @b3_rd_ld +# SUB rs, rs2, rd +SUB_rrr 1111 1111 0000 .... .... .... @b3_rd_rs_rs2 + +# SCMPU +# SUNTIL.<bwl> +{ + SCMPU 0111 1111 1000 0011 + SUNTIL 0111 1111 1000 00 sz:2 +} + +# SMOVU +# SWHILE.<bwl> +{ + SMOVU 0111 1111 1000 0111 + SWHILE 0111 1111 1000 01 sz:2 +} + +# TST #imm, rd +TST_ir 1111 1101 0111 ..00 1100 .... @b3_rd_li +# TST dsp[rs].ub, rd +# TST rs, rd +TST_mr 1111 1100 0011 00.. .... .... @b3_rd_ld_ub +# TST dsp[rs], rd +TST_mr 0000 0110 ..10 00.. 0000 1100 .... .... @b4_rd_ldmi + +WAIT 0111 1111 1001 0110 + +# XCHG rs, rd +# XCHG dsp[rs].ub, rd +{ + XCHG_rr 1111 1100 0100 0011 .... .... @b3_rd_rs + XCHG_mr 1111 1100 0100 00.. .... .... @b3_rd_ld_ub +} +# XCHG dsp[rs], rd +XCHG_mr 0000 0110 ..10 00.. 0001 0000 .... .... @b4_rd_ldmi + +# XOR #imm, rd +XOR_ir 1111 1101 0111 ..00 1101 .... @b3_rd_li +# XOR dsp[rs].ub, rd +# XOR rs, rd +XOR_mr 1111 1100 0011 01.. .... .... @b3_rd_ld_ub +# XOR dsp[rs], rd +XOR_mr 0000 0110 ..10 00.. 0000 1101 .... .... @b4_rd_ldmi
target/rx/translate.c new file +2432 -0
2,379 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.20.1
Part of the diff is not shown here. View the raw message.
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Subject: [PATCH v32 00/22] Add RX archtecture support
Message-id: [email protected]
Type: series
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
0ae38e6 qemu-doc.texi: Add RX section.
8b9073f BootLinuxConsoleTest: Test the RX-Virt machine f8d0650 Add rx-softmmu
cf1381e hw/rx: Restrict the RX62N microcontroller to the RX62N CPU core 5d5c1a5 hw/rx: Honor -accel qtest
728f2eb hw/rx: RX Target hardware definition
8481bf0 hw/char: RX62N serial communication interface (SCI) ee762ab hw/timer: RX62N internal timer modules
03d1012 hw/intc: RX62N interrupt controller (ICUa)
2e07be8 target/rx: Dump bytes for each insn during disassembly 2d4a25a target/rx: Collect all bytes during disassembly 2dba217 target/rx: Emit all disassembly in one prt()
98b7b5b target/rx: Use prt_ldmi for XCHG_mr disassembly b790530 target/rx: Replace operand with prt_ldmi in disassembler f89f8e8 target/rx: Disassemble rx_index_addr into a string 14e70b3 target/rx: RX disassembler
1ab8ca5 target/rx: CPU definition
07ea8aa target/rx: TCG helper
1870105 target/rx: TCG translation
2289e63 hw/registerfields.h: Add 8bit and 16bit register macros d2e0f20 qemu/bitops.h: Add extract8 and extract16
149843e MAINTAINERS: Add RX
=== OUTPUT BEGIN ===
1/22 Checking commit 149843e67d9b (MAINTAINERS: Add RX)
2/22 Checking commit d2e0f20da263 (qemu/bitops.h: Add extract8 and extract16) 3/22 Checking commit 2289e638d473 (hw/registerfields.h: Add 8bit and 16bit register macros) Use of uninitialized value in concatenation (.) or string at ./scripts/checkpatch.pl line 2495.
ERROR: Macros with multiple statements should be enclosed in a do - while loop #27: FILE: include/hw/registerfields.h:25:
+#define REG8(reg, addr) \
+ enum { A_ ## reg = (addr) }; \
+ enum { R_ ## reg = (addr) };
ERROR: Macros with multiple statements should be enclosed in a do - while loop #31: FILE: include/hw/registerfields.h:29:
+#define REG16(reg, addr) \
+ enum { A_ ## reg = (addr) }; \
+ enum { R_ ## reg = (addr) / 2 };
total: 2 errors, 0 warnings, 56 lines checked
Patch 3/22 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
4/22 Checking commit 1870105f2530 (target/rx: TCG translation)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #20:
new file mode 100644
total: 0 errors, 1 warnings, 3065 lines checked
Patch 4/22 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
5/22 Checking commit 07ea8aad4e81 (target/rx: TCG helper)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #21:
new file mode 100644
total: 0 errors, 1 warnings, 650 lines checked
Patch 5/22 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
6/22 Checking commit 1ab8ca5e5939 (target/rx: CPU definition)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #22:
new file mode 100644
total: 0 errors, 1 warnings, 659 lines checked
Patch 6/22 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
7/22 Checking commit 14e70b35628e (target/rx: RX disassembler)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #38:
new file mode 100644
total: 0 errors, 1 warnings, 1497 lines checked
Patch 7/22 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
8/22 Checking commit f89f8e880852 (target/rx: Disassemble rx_index_addr into a string) 9/22 Checking commit b790530f3a0a (target/rx: Replace operand with prt_ldmi in disassembler) 10/22 Checking commit 98b7b5b0142e (target/rx: Use prt_ldmi for XCHG_mr disassembly) 11/22 Checking commit 2dba2171e47d (target/rx: Emit all disassembly in one prt()) 12/22 Checking commit 2d4a25af9dda (target/rx: Collect all bytes during disassembly) 13/22 Checking commit 2e07be8ada02 (target/rx: Dump bytes for each insn during disassembly) 14/22 Checking commit 03d1012bb8ef (hw/intc: RX62N interrupt controller (ICUa))
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #40:
new file mode 100644
total: 0 errors, 1 warnings, 445 lines checked
Patch 14/22 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
15/22 Checking commit ee762abd1996 (hw/timer: RX62N internal timer modules)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #50:
new file mode 100644
total: 0 errors, 1 warnings, 845 lines checked
Patch 15/22 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
16/22 Checking commit 8481bf0d7b4e (hw/char: RX62N serial communication interface (SCI))
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #43:
new file mode 100644
total: 0 errors, 1 warnings, 400 lines checked
Patch 16/22 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
17/22 Checking commit 728f2eb4ffa4 (hw/rx: RX Target hardware definition)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #23:
new file mode 100644
total: 0 errors, 1 warnings, 495 lines checked
Patch 17/22 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
18/22 Checking commit 5d5c1a55093c (hw/rx: Honor -accel qtest)
19/22 Checking commit cf1381e74ca5 (hw/rx: Restrict the RX62N microcontroller to the RX62N CPU core) 20/22 Checking commit f8d0650630be (Add rx-softmmu)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#69:
new file mode 100644
total: 0 errors, 1 warnings, 76 lines checked
Patch 20/22 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
21/22 Checking commit 8b9073f76d50 (BootLinuxConsoleTest: Test the RX-Virt machine) 22/22 Checking commit 0ae38e67b041 (qemu-doc.texi: Add RX section.) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Re: [PATCH v32 20/22] Add rx-softmmu
In reply to Yoshinori SatoQuoted 14 lines · Yoshinori Sato
Reviewed-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Yoshinori Sato <[email protected]>Message-Id: <[email protected]>
Signed-off-by Richard Henderson <[email protected]>pick
ed65c02993target/rx: Add RX to SysEmuTarget pick01372568aetests: Add rx tomachine-none-test.c[PMD: Squashed patches from Richard Henderson modifying
qapi/common.jsonandtests/machine-none-test.c]Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
+++
b/qapi/machine.json
qapi/machine.json line 29
Quoted 5 lines
qapi/machine.json +1
-1@@ -26,7 +26,7 @@ 'data' : [ 'aarch64', 'alpha', 'arm', 'cris', 'hppa', 'i386', 'lm32', 'm68k', 'microblaze', 'microblazeel', 'mips', 'mips64', 'mips64el', 'mipsel', 'moxie', 'nios2', 'or1k', 'ppc', - 'ppc64', 'riscv32', 'riscv64', 's390x', 'sh4', + 'ppc64', 'riscv32', 'riscv64', 'rx', 's390x', 'sh4',
Missing documentation of the new member, including that it was added in 5.0.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [PATCH v32 22/22] qemu-doc.texi: Add RX section.
In reply to Yoshinori SatoHi,
Quoted 60 lines · Yoshinori Sato
Describe emulated target specification. And two examples.
Signed-off-by Yoshinori Sato <[email protected]>--- qemu-doc.texi | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)qemu-doc.texi +37
-0@@ -1719,6 +1719,7 @@ differences are mentioned in the following sections. * Microblaze System emulator:: * SH4 System emulator:: * Xtensa System emulator:: +* RX System emulator:: @end menu @node PowerPC System emulator@@ -2487,6 +2488,49 @@ so should only be used with trusted guest OS. @c man end +@node RX System emulator +@section RX System emulator +@cindex system emulation (RX) + +Use the executable @file{qemu-system-rx} to simulate a Virtual RX target. +This target emulated following devices. + +@itemize @minus +@item +R5F562N8 MCU +@item +On-chip memory (ROM 512KB, RAM 96KB) +@item +Interrupt Control Unit (ICUa) +@item +8Bit Timer x 1CH (TMR0,1) +@item +Compare Match Timer x 2CH (CMT0,1) +@item +Serial Communication Interface x 1CH (SCI0) +@item +External memory 16MByte +@end itemize + +Example of @file{qemu-system-rx} usage for rx is shown below: + +Download @code{u-boot_image} from @url{https://osdn.net/users/ysato/pf/qemu/dl/u-boot.bin.gz} + +Start emulation of rx-virt: +@example +qemu-system-rx -bios @code{u-boot_image} +@end example + +Download @code{kernel_image} from @url{https://osdn.net/users/ysato/pf/qemu/dl/zImage} + +Download @code{device_tree_blob} from @url{https://osdn.net/users/ysato/pf/qemu/dl/rx-virt.dtb}
qemu-doc.texi so should only be used with trusted guest OS. · line 2536
Quoted 10 lines
qemu-doc.texi +7
-0+ +Start emulation of rx-virt: +@example +qemu-system-rx -kernel @code{kernel_image} -dtb @code{device_tree_blob} \ + -append "earlycon" +@end example + @node QEMU User space emulator @chapter QEMU User space emulator
In commit 3a8273b1ab3 the this file has been removed (due to the conversion to the rST format).
Can you send a single patch (not the rest) with your documentation in rST format please?
Re: [PATCH v32 22/22] qemu-doc.texi: Add RX section.
Quoted 74 lines · Philippe Mathieu-Daudé
Hi,
Quoted 56 lines · Yoshinori Sato
Describe emulated target specification. And two examples.
Signed-off-by Yoshinori Sato <[email protected]>--- qemu-doc.texi | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)qemu-doc.texi +36
-0@@ -1719,6 +1719,7 @@ differences are mentioned in the following sections. * Microblaze System emulator:: * SH4 System emulator:: * Xtensa System emulator:: +* RX System emulator:: @end menu @node PowerPC System emulator@@ -2487,6 +2488,49 @@ so should only be used with trusted guest OS. @c man end +@node RX System emulator +@section RX System emulator +@cindex system emulation (RX) + +Use the executable @file{qemu-system-rx} to simulate a Virtual RX target. +This target emulated following devices. + +@itemize @minus +@item +R5F562N8 MCU +@item +On-chip memory (ROM 512KB, RAM 96KB) +@item +Interrupt Control Unit (ICUa) +@item +8Bit Timer x 1CH (TMR0,1) +@item +Compare Match Timer x 2CH (CMT0,1) +@item +Serial Communication Interface x 1CH (SCI0) +@item +External memory 16MByte +@end itemize + +Example of @file{qemu-system-rx} usage for rx is shown below: + +Download @code{u-boot_image} from @url{https://osdn.net/users/ysato/pf/qemu/dl/u-boot.bin.gz} + +Start emulation of rx-virt: +@example +qemu-system-rx -bios @code{u-boot_image} +@end example + +Download @code{kernel_image} from @url{https://osdn.net/users/ysato/pf/qemu/dl/zImage} + +Download @code{device_tree_blob} from @url{https://osdn.net/users/ysato/pf/qemu/dl/rx-virt.dtb}qemu-doc.texi so should only be used with trusted guest OS. · line 2534
Quoted 10 lines
qemu-doc.texi +7
-0+ +Start emulation of rx-virt: +@example +qemu-system-rx -kernel @code{kernel_image} -dtb @code{device_tree_blob} \ + -append "earlycon" +@end example + @node QEMU User space emulator @chapter QEMU User space emulatorIn commit
3a8273b1ab3the this file has been removed (due to the conversion to the rST format).
Quoted 3 lines
Can you send a single patch (not the rest) with your documentation in rST format please?
OK. I will snet later.
---
Yoshinori Sato
Re: [PATCH v32 16/22] hw/char: RX62N serial communication interface (SCI)
In reply to Yoshinori SatoHi Yoshinori,
Quoted 76 lines · Yoshinori Sato
This module supported only non FIFO type.
Hardware manual.
https://www.renesas.com/us/en/doc/products/mpumcu/doc/rx_family/r01uh0033ej0140_rx62n.pdfSigned-off-by Yoshinori Sato <[email protected]>Reviewed-by Alex Bennée <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Message-Id: <[email protected]>
Signed-off-by Richard Henderson <[email protected]>--- include/hw/char/renesas_sci.h | 45 +++++ hw/char/renesas_sci.c | 342 ++++++++++++++++++++++++++++++++++ hw/char/Kconfig | 3 + hw/char/Makefile.objs | 1 + 4 files changed, 391 insertions(+)create mode 100644
include/hw/char/renesas_sci.hcreate mode 100644hw/char/renesas_sci.cinclude/hw/char/renesas_sci.h new file +45
-0@@ -0,0 +1,45 @@ +/* +* Renesas Serial Communication Interface +* +* Copyright (c) 2018 Yoshinori Sato +* +* This code is licensed under the GPL version 2 or later. +* +*/ + +#include "chardev/char-fe.h" +#include "qemu/timer.h" +#include "hw/sysbus.h" + +#define TYPE_RENESAS_SCI "renesas-sci" +#define RSCI (obj) OBJECT_CHECK(RSCIState, (obj), TYPE_RENESAS_SCI) + +enum { +ERI =0 , +RXI =1 , +TXI =2 , +TEI =3 , +SCI_NR_IRQ =4 , +}; + +typedef struct { +SysBusDevice parent_obj; +MemoryRegion memory; + +uint8_t smr; +uint8_t brr; +uint8_t scr; +uint8_t tdr; +uint8_t ssr; +uint8_t rdr; +uint8_t scmr; +uint8_t semr; + +uint8_t read_ssr; +int64_t trtime; +int64_t rx_next; +QEMUTimer *timer; +CharBackend chr; +uint64_t input_freq; +qemu_irq irq[SCI_NR_IRQ ]; +}RSCIState ;hw/char/renesas_sci.c new file +0
-0
hw/char/renesas_sci.c line 2
Quoted 2 lines
hw/char/renesas_sci.c new file +2
-0@@ -0,0 +1,342 @@ +/* +* Renesas Serial Communication Interface
Looking at this again, have you looked at the SH model (hw/char/sh_serial.c)? This seems the same. (Similarly your timer model with hw/timer/sh_timer.c).
Quoted 98 lines
hw/char/renesas_sci.c new file +98
-0+* +* Datasheet: RX62N Group, RX621 Group User's Manual: Hardware +* (Rev.1.40 R01UH0033EJ0140) +* +* Copyright (c) 2019 Yoshinori Sato +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2 or later, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along with +* this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "qemu/osdep.h" +#include "qemu/log.h" +#include "qapi/error.h" +#include "qemu-common.h" +#include "hw/hw.h" +#include "hw/irq.h" +#include "hw/sysbus.h" +#include "hw/registerfields.h" +#include "hw/qdev-properties.h" +#include "hw/char/renesas_sci.h" +#include "migration/vmstate.h" +#include "qemu/error-report.h" + +/* SCI register map */ +REG8(SMR, 0) + FIELD(SMR, CKS, 0, 2) + FIELD(SMR, MP, 2, 1) + FIELD(SMR, STOP, 3, 1) + FIELD(SMR, PM, 4, 1) + FIELD(SMR, PE, 5, 1) + FIELD(SMR, CHR, 6, 1) + FIELD(SMR, CM, 7, 1) +REG8(BRR, 1) +REG8(SCR, 2) + FIELD(SCR, CKE, 0, 2) + FIELD(SCR, TEIE, 2, 1) + FIELD(SCR, MPIE, 3, 1) + FIELD(SCR, RE, 4, 1) + FIELD(SCR, TE, 5, 1) + FIELD(SCR, RIE, 6, 1) + FIELD(SCR, TIE, 7, 1) +REG8(TDR, 3) +REG8(SSR, 4) + FIELD(SSR, MPBT, 0, 1) + FIELD(SSR, MPB, 1, 1) + FIELD(SSR, TEND, 2, 1) + FIELD(SSR, ERR, 3, 3) + FIELD(SSR, PER, 3, 1) + FIELD(SSR, FER, 4, 1) + FIELD(SSR, ORER, 5, 1) + FIELD(SSR, RDRF, 6, 1) + FIELD(SSR, TDRE, 7, 1) +REG8(RDR, 5) +REG8(SCMR, 6) + FIELD(SCMR, SMIF, 0, 1) + FIELD(SCMR, SINV, 2, 1) + FIELD(SCMR, SDIR, 3, 1) + FIELD(SCMR, BCP2, 7, 1) +REG8(SEMR, 7) + FIELD(SEMR, ACS0, 0, 1) + FIELD(SEMR, ABCS, 4, 1) + +static int can_receive (void *opaque) +{ +RSCIState *sci =RSCI (opaque); +if (sci->rx_next >qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL )) { +return 0 ; + }else { +return FIELD_EX8 (sci->scr,SCR ,RE ); + } +} + +static void receive (void *opaque,const uint8_t *buf,int size) +{ +RSCIState *sci =RSCI (opaque); + sci->rx_next =qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + sci->trtime; +if (FIELD_EX8 (sci->ssr,SSR ,RDRF ) || size >1 ) { + sci->ssr =FIELD_DP8 (sci->ssr,SSR ,ORER ,1 ); +if (FIELD_EX8 (sci->scr,SCR ,RIE )) { +qemu_set_irq (sci->irq[ERI ],1 ); + } + }else { + sci->rdr = buf[0 ]; + sci->ssr =FIELD_DP8 (sci->ssr,SSR ,RDRF ,1 ); +if (FIELD_EX8 (sci->scr,SCR ,RIE )) { +qemu_irq_pulse (sci->irq[RXI ]); + } + } +}
[...]
Re: [PATCH v32 21/22] BootLinuxConsoleTest: Test the RX-Virt machine
In reply to Yoshinori SatoQuoted 66 lines · Yoshinori Sato
From: Philippe Mathieu-Daudé <[email protected]>
Add two tests for the rx-virt machine, based on the recommended test setup from Yoshinori Sato:
https://lists.gnu.org/archive/html/qemu-devel/2019-05/msg03586.html- U-Boot prompt
- Linux kernel with Sash shellThese are very quick tests:
$ avocado run -t arch:rx tests/acceptance/boot_linux_console.py JOB ID : 84a6ef01c0b87975ecbfcb31a920afd735753ace JOB LOG : /home/phil/avocado/job-results/job-2019-05-24T05.02-84a6ef0/job.log (1/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_rx_uboot: PASS (0.11 s) (2/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_rx_linux: PASS (0.45 s) RESULTS : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0Tests can also be run with:
$ avocado --show=console run -t arch:rx tests/acceptance/boot_linux_console.py console: U-Boot 2016.05-rc3-23705-ga1ef3c71cb-dirty (Feb 05 2019 - 21:56:06 +0900) console: Linux version 4.19.0+ (yo-satoh@yo-satoh-debian) (gcc version 9.0.0 20181105 (experimental) (GCC)) #137 Wed Feb 20 23:20:02 JST 2019 console: Built 1 zonelists, mobility grouping on. Total pages: 8128 ... console: SuperH (H)SCI(F) driver initialized console: 88240.serial: ttySC0 at MMIO 0x88240 (irq = 215, base_baud = 0) is a sci console: console [ttySC0] enabled console: 88248.serial: ttySC1 at MMIO 0x88248 (irq = 219, base_baud = 0) is a sciSigned-off-by Philippe Mathieu-Daudé <[email protected]>Based-on: [email protected] "RX architecture support"
Signed-off-by Yoshinori Sato <[email protected]>--- tests/acceptance/boot_linux_console.py | 46 ++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)tests/acceptance/boot_linux_console.py +20
-0@@ -686,3 +686,49 @@ class BootLinuxConsole(Test): tar_hash = '49e88d9933742f0164b60839886c9739cb7a0d34' self.vm.add_args('-cpu', 'dc233c') self.do_test_advcal_2018('02', tar_hash, 'santas-sleigh-ride.elf') + + def test_rx_uboot(self): + """ + :avocado: tags=arch:rx + :avocado: tags=machine:rx-virt + :avocado: tags=endian:little + """ + uboot_url = ('https://acc.dl.osdn.jp/users/23/23888/u-boot.bin.gz') + uboot_hash = '9b78dbd43b40b2526848c0b1ce9de02c24f4dcdb' + uboot_path = self.fetch_asset(uboot_url, asset_hash=uboot_hash) + uboot_path = archive.uncompress(uboot_path, self.workdir) + + self.vm.set_machine('rx-virt') + self.vm.set_console() + self.vm.add_args('-bios', uboot_path, + '-no-reboot') + self.vm.launch() + uboot_version = 'U-Boot 2016.05-rc3-23705-ga1ef3c71cb-dirty' + self.wait_for_console_pattern(uboot_version) + gcc_version = 'rx-unknown-linux-gcc (GCC) 9.0.0 20181105 (experimental)'
tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 718
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ # FIXME limit baudrate on chardev, else we type too fast + #self.exec_command_and_wait_for_pattern('version', gcc_version) + + def test_rx_linux(self): + """ + :avocado: tags=arch:rx + :avocado: tags=machine:rx-virt + :avocado: tags=endian:little + """ + dtb_url = ('https://acc.dl.osdn.jp/users/23/23887/rx-qemu.dtb')
Sourceforge URL are not very stable, I'm now getting:
HTTP request sent, awaiting response... 302 Found
Location: https://osdn.dl.osdn.net/users/23/23887/rx-qemu.dtb [following] --2020-03-08 17:17:31-- https://osdn.dl.osdn.net/users/23/23887/rx-qemu.dtb
Resolving osdn.dl.osdn.net (osdn.dl.osdn.net)... 202.221.179.23 Connecting to osdn.dl.osdn.net (osdn.dl.osdn.net)|202.221.179.23|:443... connected. HTTP request sent, awaiting response... 404 Not Found
2020-03-08 17:17:32 ERROR 404: Not Found.
Quoted 17 lines
tests/acceptance/boot_linux_console.py +16
-0+ dtb_hash = '7b4e4e2c71905da44e86ce47adee2210b026ac18' + dtb_path = self.fetch_asset(dtb_url, asset_hash=dtb_hash) + kernel_url = ('http://acc.dl.osdn.jp/users/23/23845/zImage') + kernel_hash = '39a81067f8d72faad90866ddfefa19165d68fc99' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + + self.vm.set_machine('rx-virt') + self.vm.set_console() + kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'earlycon' + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-no-reboot') + self.vm.launch() + self.wait_for_console_pattern('Sash command shell (version 1.1.1)') + self.exec_command_and_wait_for_pattern('printenv', + 'TERM=linux')
Re: [PATCH v32 16/22] hw/char: RX62N serial communication interface (SCI)
In reply to Philippe Mathieu-DaudéQuoted 78 lines · Philippe Mathieu-Daudé
Hi Yoshinori,
Quoted 74 lines · Yoshinori Sato
This module supported only non FIFO type.
Hardware manual.
https://www.renesas.com/us/en/doc/products/mpumcu/doc/rx_family/r01uh0033ej0140_rx62n.pdfSigned-off-by Yoshinori Sato <[email protected]>Reviewed-by Alex Bennée <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Message-Id: <[email protected]>
Signed-off-by Richard Henderson <[email protected]>--- include/hw/char/renesas_sci.h | 45 +++++ hw/char/renesas_sci.c | 342 ++++++++++++++++++++++++++++++++++ hw/char/Kconfig | 3 + hw/char/Makefile.objs | 1 + 4 files changed, 391 insertions(+)create mode 100644
include/hw/char/renesas_sci.hcreate mode 100644hw/char/renesas_sci.cinclude/hw/char/renesas_sci.h new file +45
-0@@ -0,0 +1,45 @@ +/* +* Renesas Serial Communication Interface +* +* Copyright (c) 2018 Yoshinori Sato +* +* This code is licensed under the GPL version 2 or later. +* +*/ + +#include "chardev/char-fe.h" +#include "qemu/timer.h" +#include "hw/sysbus.h" + +#define TYPE_RENESAS_SCI "renesas-sci" +#define RSCI (obj) OBJECT_CHECK(RSCIState, (obj), TYPE_RENESAS_SCI) + +enum { +ERI =0 , +RXI =1 , +TXI =2 , +TEI =3 , +SCI_NR_IRQ =4 , +}; + +typedef struct { +SysBusDevice parent_obj; +MemoryRegion memory; + +uint8_t smr; +uint8_t brr; +uint8_t scr; +uint8_t tdr; +uint8_t ssr; +uint8_t rdr; +uint8_t scmr; +uint8_t semr; + +uint8_t read_ssr; +int64_t trtime; +int64_t rx_next; +QEMUTimer *timer; +CharBackend chr; +uint64_t input_freq; +qemu_irq irq[SCI_NR_IRQ ]; +}RSCIState ;hw/char/renesas_sci.c new file +0
-1--- /dev/null
Quoted 9 lines
hw/char/renesas_sci.c line 2
Quoted 4 lines
+++
b/hw/char/renesas_sci.chw/char/renesas_sci.c new file +2
-0@@ -0,0 +1,342 @@ +/* +* Renesas Serial Communication Interface Looking at this again, have you looked at the SH model (
hw/char/sh_serial.c)? This seems the same. (Similarly your timer model withhw/timer/sh_timer.c).
sh_serial has FIFO.renesas_sci has no FIFO.
These are relationships like 8250 and 16550. sh_serial is old,so I think it's better to implement and integrate FIFO into renesas_sci.
Quoted 101 lines
Quoted 98 lines
hw/char/renesas_sci.c new file +98
-0+* +* Datasheet: RX62N Group, RX621 Group User's Manual: Hardware +* (Rev.1.40 R01UH0033EJ0140) +* +* Copyright (c) 2019 Yoshinori Sato +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2 or later, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along with +* this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "qemu/osdep.h" +#include "qemu/log.h" +#include "qapi/error.h" +#include "qemu-common.h" +#include "hw/hw.h" +#include "hw/irq.h" +#include "hw/sysbus.h" +#include "hw/registerfields.h" +#include "hw/qdev-properties.h" +#include "hw/char/renesas_sci.h" +#include "migration/vmstate.h" +#include "qemu/error-report.h" + +/* SCI register map */ +REG8(SMR, 0) + FIELD(SMR, CKS, 0, 2) + FIELD(SMR, MP, 2, 1) + FIELD(SMR, STOP, 3, 1) + FIELD(SMR, PM, 4, 1) + FIELD(SMR, PE, 5, 1) + FIELD(SMR, CHR, 6, 1) + FIELD(SMR, CM, 7, 1) +REG8(BRR, 1) +REG8(SCR, 2) + FIELD(SCR, CKE, 0, 2) + FIELD(SCR, TEIE, 2, 1) + FIELD(SCR, MPIE, 3, 1) + FIELD(SCR, RE, 4, 1) + FIELD(SCR, TE, 5, 1) + FIELD(SCR, RIE, 6, 1) + FIELD(SCR, TIE, 7, 1) +REG8(TDR, 3) +REG8(SSR, 4) + FIELD(SSR, MPBT, 0, 1) + FIELD(SSR, MPB, 1, 1) + FIELD(SSR, TEND, 2, 1) + FIELD(SSR, ERR, 3, 3) + FIELD(SSR, PER, 3, 1) + FIELD(SSR, FER, 4, 1) + FIELD(SSR, ORER, 5, 1) + FIELD(SSR, RDRF, 6, 1) + FIELD(SSR, TDRE, 7, 1) +REG8(RDR, 5) +REG8(SCMR, 6) + FIELD(SCMR, SMIF, 0, 1) + FIELD(SCMR, SINV, 2, 1) + FIELD(SCMR, SDIR, 3, 1) + FIELD(SCMR, BCP2, 7, 1) +REG8(SEMR, 7) + FIELD(SEMR, ACS0, 0, 1) + FIELD(SEMR, ABCS, 4, 1) + +static int can_receive (void *opaque) +{ +RSCIState *sci =RSCI (opaque); +if (sci->rx_next >qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL )) { +return 0 ; + }else { +return FIELD_EX8 (sci->scr,SCR ,RE ); + } +} + +static void receive (void *opaque,const uint8_t *buf,int size) +{ +RSCIState *sci =RSCI (opaque); + sci->rx_next =qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + sci->trtime; +if (FIELD_EX8 (sci->ssr,SSR ,RDRF ) || size >1 ) { + sci->ssr =FIELD_DP8 (sci->ssr,SSR ,ORER ,1 ); +if (FIELD_EX8 (sci->scr,SCR ,RIE )) { +qemu_set_irq (sci->irq[ERI ],1 ); + } + }else { + sci->rdr = buf[0 ]; + sci->ssr =FIELD_DP8 (sci->ssr,SSR ,RDRF ,1 ); +if (FIELD_EX8 (sci->scr,SCR ,RIE )) { +qemu_irq_pulse (sci->irq[RXI ]); + } + } +}[...]
Signature · 1 line
Yosinori Sato
Re: [PATCH v32 21/22] BootLinuxConsoleTest: Test the RX-Virt machine
In reply to Philippe Mathieu-DaudéQuoted 81 lines · Philippe Mathieu-Daudé
Quoted 66 lines · Yoshinori Sato
From: Philippe Mathieu-Daudé <[email protected]>
Add two tests for the rx-virt machine, based on the recommended test setup from Yoshinori Sato:
https://lists.gnu.org/archive/html/qemu-devel/2019-05/msg03586.html- U-Boot prompt
- Linux kernel with Sash shellThese are very quick tests:
$ avocado run -t arch:rx tests/acceptance/boot_linux_console.py JOB ID : 84a6ef01c0b87975ecbfcb31a920afd735753ace JOB LOG : /home/phil/avocado/job-results/job-2019-05-24T05.02-84a6ef0/job.log (1/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_rx_uboot: PASS (0.11 s) (2/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_rx_linux: PASS (0.45 s) RESULTS : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0Tests can also be run with:
$ avocado --show=console run -t arch:rx tests/acceptance/boot_linux_console.py console: U-Boot 2016.05-rc3-23705-ga1ef3c71cb-dirty (Feb 05 2019 - 21:56:06 +0900) console: Linux version 4.19.0+ (yo-satoh@yo-satoh-debian) (gcc version 9.0.0 20181105 (experimental) (GCC)) #137 Wed Feb 20 23:20:02 JST 2019 console: Built 1 zonelists, mobility grouping on. Total pages: 8128 ... console: SuperH (H)SCI(F) driver initialized console: 88240.serial: ttySC0 at MMIO 0x88240 (irq = 215, base_baud = 0) is a sci console: console [ttySC0] enabled console: 88248.serial: ttySC1 at MMIO 0x88248 (irq = 219, base_baud = 0) is a sciSigned-off-by Philippe Mathieu-Daudé <[email protected]>Based-on: [email protected] "RX architecture support"
Signed-off-by Yoshinori Sato <[email protected]>--- tests/acceptance/boot_linux_console.py | 46 ++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)tests/acceptance/boot_linux_console.py +20
-0@@ -686,3 +686,49 @@ class BootLinuxConsole(Test): tar_hash = '49e88d9933742f0164b60839886c9739cb7a0d34' self.vm.add_args('-cpu', 'dc233c') self.do_test_advcal_2018('02', tar_hash, 'santas-sleigh-ride.elf') + + def test_rx_uboot(self): + """ + :avocado: tags=arch:rx + :avocado: tags=machine:rx-virt + :avocado: tags=endian:little + """ + uboot_url = ('https://acc.dl.osdn.jp/users/23/23888/u-boot.bin.gz') + uboot_hash = '9b78dbd43b40b2526848c0b1ce9de02c24f4dcdb' + uboot_path = self.fetch_asset(uboot_url, asset_hash=uboot_hash) + uboot_path = archive.uncompress(uboot_path, self.workdir) + + self.vm.set_machine('rx-virt') + self.vm.set_console() + self.vm.add_args('-bios', uboot_path, + '-no-reboot') + self.vm.launch() + uboot_version = 'U-Boot 2016.05-rc3-23705-ga1ef3c71cb-dirty' + self.wait_for_console_pattern(uboot_version) + gcc_version = 'rx-unknown-linux-gcc (GCC) 9.0.0 20181105 (experimental)'tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 718
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ # FIXME limit baudrate on chardev, else we type too fast + #self.exec_command_and_wait_for_pattern('version', gcc_version) + + def test_rx_linux(self): + """ + :avocado: tags=arch:rx + :avocado: tags=machine:rx-virt + :avocado: tags=endian:little + """ + dtb_url = ('https://acc.dl.osdn.jp/users/23/23887/rx-qemu.dtb')Sourceforge URL are not very stable, I'm now getting:
Quoted 8 lines
HTTP request sent, awaiting response... 302 Found
Location: https://osdn.dl.osdn.net/users/23/23887/rx-qemu.dtb [following] --2020-03-08 17:17:31-- https://osdn.dl.osdn.net/users/23/23887/rx-qemu.dtb
Resolving osdn.dl.osdn.net (osdn.dl.osdn.net)... 202.221.179.23 Connecting to osdn.dl.osdn.net (osdn.dl.osdn.net)|202.221.179.23|:443... connected.
HTTP request sent, awaiting response... 404 Not Found2020-03-08 17:17:32 ERROR 404: Not Found.
Permernet link is bellow.
https://osdn.net/users/ysato/pf/qemu/dl/u-boot.bin.gz
https://osdn.net/users/ysato/pf/qemu/dl/rx-virt.dtb
https://osdn.net/users/ysato/pf/qemu/dl/zImage
I was misunderstanding. sorry.
Quoted 19 lines
Quoted 17 lines
tests/acceptance/boot_linux_console.py +16
-0+ dtb_hash = '7b4e4e2c71905da44e86ce47adee2210b026ac18' + dtb_path = self.fetch_asset(dtb_url, asset_hash=dtb_hash) + kernel_url = ('http://acc.dl.osdn.jp/users/23/23845/zImage') + kernel_hash = '39a81067f8d72faad90866ddfefa19165d68fc99' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + + self.vm.set_machine('rx-virt') + self.vm.set_console() + kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'earlycon' + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-no-reboot') + self.vm.launch() + self.wait_for_console_pattern('Sash command shell (version 1.1.1)') + self.exec_command_and_wait_for_pattern('printenv', + 'TERM=linux')
Signature · 1 line
Yosinori Sato
Re: [PATCH v32 21/22] BootLinuxConsoleTest: Test the RX-Virt machine
Quoted 92 lines · Yoshinori Sato
Quoted 81 lines · Philippe Mathieu-Daudé
Quoted 66 lines · Yoshinori Sato
From: Philippe Mathieu-Daudé <[email protected]>
Add two tests for the rx-virt machine, based on the recommended test setup from Yoshinori Sato:
https://lists.gnu.org/archive/html/qemu-devel/2019-05/msg03586.html- U-Boot prompt
- Linux kernel with Sash shellThese are very quick tests:
$ avocado run -t arch:rx tests/acceptance/boot_linux_console.py JOB ID : 84a6ef01c0b87975ecbfcb31a920afd735753ace JOB LOG : /home/phil/avocado/job-results/job-2019-05-24T05.02-84a6ef0/job.log (1/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_rx_uboot: PASS (0.11 s) (2/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_rx_linux: PASS (0.45 s) RESULTS : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0Tests can also be run with:
$ avocado --show=console run -t arch:rx tests/acceptance/boot_linux_console.py console: U-Boot 2016.05-rc3-23705-ga1ef3c71cb-dirty (Feb 05 2019 - 21:56:06 +0900) console: Linux version 4.19.0+ (yo-satoh@yo-satoh-debian) (gcc version 9.0.0 20181105 (experimental) (GCC)) #137 Wed Feb 20 23:20:02 JST 2019 console: Built 1 zonelists, mobility grouping on. Total pages: 8128 ... console: SuperH (H)SCI(F) driver initialized console: 88240.serial: ttySC0 at MMIO 0x88240 (irq = 215, base_baud = 0) is a sci console: console [ttySC0] enabled console: 88248.serial: ttySC1 at MMIO 0x88248 (irq = 219, base_baud = 0) is a sciSigned-off-by Philippe Mathieu-Daudé <[email protected]>Based-on: [email protected] "RX architecture support"
Signed-off-by Yoshinori Sato <[email protected]>--- tests/acceptance/boot_linux_console.py | 46 ++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)tests/acceptance/boot_linux_console.py +20
-0@@ -686,3 +686,49 @@ class BootLinuxConsole(Test): tar_hash = '49e88d9933742f0164b60839886c9739cb7a0d34' self.vm.add_args('-cpu', 'dc233c') self.do_test_advcal_2018('02', tar_hash, 'santas-sleigh-ride.elf') + + def test_rx_uboot(self): + """ + :avocado: tags=arch:rx + :avocado: tags=machine:rx-virt + :avocado: tags=endian:little + """ + uboot_url = ('https://acc.dl.osdn.jp/users/23/23888/u-boot.bin.gz') + uboot_hash = '9b78dbd43b40b2526848c0b1ce9de02c24f4dcdb' + uboot_path = self.fetch_asset(uboot_url, asset_hash=uboot_hash) + uboot_path = archive.uncompress(uboot_path, self.workdir) + + self.vm.set_machine('rx-virt') + self.vm.set_console() + self.vm.add_args('-bios', uboot_path, + '-no-reboot') + self.vm.launch() + uboot_version = 'U-Boot 2016.05-rc3-23705-ga1ef3c71cb-dirty' + self.wait_for_console_pattern(uboot_version) + gcc_version = 'rx-unknown-linux-gcc (GCC) 9.0.0 20181105 (experimental)'tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 718
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ # FIXME limit baudrate on chardev, else we type too fast + #self.exec_command_and_wait_for_pattern('version', gcc_version) + + def test_rx_linux(self): + """ + :avocado: tags=arch:rx + :avocado: tags=machine:rx-virt + :avocado: tags=endian:little + """ + dtb_url = ('https://acc.dl.osdn.jp/users/23/23887/rx-qemu.dtb')Sourceforge URL are not very stable, I'm now getting:
Quoted 8 lines
HTTP request sent, awaiting response... 302 Found
Location: https://osdn.dl.osdn.net/users/23/23887/rx-qemu.dtb [following] --2020-03-08 17:17:31-- https://osdn.dl.osdn.net/users/23/23887/rx-qemu.dtb
Resolving osdn.dl.osdn.net (osdn.dl.osdn.net)... 202.221.179.23 Connecting to osdn.dl.osdn.net (osdn.dl.osdn.net)|202.221.179.23|:443... connected.
HTTP request sent, awaiting response... 404 Not Found2020-03-08 17:17:32 ERROR 404: Not Found.
Quoted 4 lines
Permernet link is bellow.
https://osdn.net/users/ysato/pf/qemu/dl/u-boot.bin.gz
https://osdn.net/users/ysato/pf/qemu/dl/rx-virt.dtb
https://osdn.net/users/ysato/pf/qemu/dl/zImage
Acceptance tests assert that "something that used to work in the past is still working today". The artifact hash is here to verify the file has not been modified (for security reasons or replaced by something else) so we keep testing the same.
If you upgrade these files, we should keep testing the older version, and eventually add a new test (or entry in the same test) to test the new files.
Quoted 23 lines
I was misunderstanding. sorry.
Quoted 19 lines
Quoted 17 lines
tests/acceptance/boot_linux_console.py +16
-0+ dtb_hash = '7b4e4e2c71905da44e86ce47adee2210b026ac18' + dtb_path = self.fetch_asset(dtb_url, asset_hash=dtb_hash) + kernel_url = ('http://acc.dl.osdn.jp/users/23/23845/zImage') + kernel_hash = '39a81067f8d72faad90866ddfefa19165d68fc99' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + + self.vm.set_machine('rx-virt') + self.vm.set_console() + kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'earlycon' + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-no-reboot') + self.vm.launch() + self.wait_for_console_pattern('Sash command shell (version 1.1.1)') + self.exec_command_and_wait_for_pattern('printenv', + 'TERM=linux')
Re: [PATCH v32 21/22] BootLinuxConsoleTest: Test the RX-Virt machine
Quoted 99 lines · Philippe Mathieu-Daudé
Quoted 92 lines · Yoshinori Sato
Quoted 81 lines · Philippe Mathieu-Daudé
Quoted 66 lines · Yoshinori Sato
From: Philippe Mathieu-Daudé <[email protected]>
Add two tests for the rx-virt machine, based on the recommended test setup from Yoshinori Sato:
https://lists.gnu.org/archive/html/qemu-devel/2019-05/msg03586.html- U-Boot prompt
- Linux kernel with Sash shellThese are very quick tests:
$ avocado run -t arch:rx tests/acceptance/boot_linux_console.py JOB ID : 84a6ef01c0b87975ecbfcb31a920afd735753ace JOB LOG : /home/phil/avocado/job-results/job-2019-05-24T05.02-84a6ef0/job.log (1/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_rx_uboot: PASS (0.11 s) (2/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_rx_linux: PASS (0.45 s) RESULTS : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0Tests can also be run with:
$ avocado --show=console run -t arch:rx tests/acceptance/boot_linux_console.py console: U-Boot 2016.05-rc3-23705-ga1ef3c71cb-dirty (Feb 05 2019 - 21:56:06 +0900) console: Linux version 4.19.0+ (yo-satoh@yo-satoh-debian) (gcc version 9.0.0 20181105 (experimental) (GCC)) #137 Wed Feb 20 23:20:02 JST 2019 console: Built 1 zonelists, mobility grouping on. Total pages: 8128 ... console: SuperH (H)SCI(F) driver initialized console: 88240.serial: ttySC0 at MMIO 0x88240 (irq = 215, base_baud = 0) is a sci console: console [ttySC0] enabled console: 88248.serial: ttySC1 at MMIO 0x88248 (irq = 219, base_baud = 0) is a sciSigned-off-by Philippe Mathieu-Daudé <[email protected]>Based-on: [email protected] "RX architecture support"
Signed-off-by Yoshinori Sato <[email protected]>--- tests/acceptance/boot_linux_console.py | 46 ++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)tests/acceptance/boot_linux_console.py +20
-0@@ -686,3 +686,49 @@ class BootLinuxConsole(Test): tar_hash = '49e88d9933742f0164b60839886c9739cb7a0d34' self.vm.add_args('-cpu', 'dc233c') self.do_test_advcal_2018('02', tar_hash, 'santas-sleigh-ride.elf') + + def test_rx_uboot(self): + """ + :avocado: tags=arch:rx + :avocado: tags=machine:rx-virt + :avocado: tags=endian:little + """ + uboot_url = ('https://acc.dl.osdn.jp/users/23/23888/u-boot.bin.gz') + uboot_hash = '9b78dbd43b40b2526848c0b1ce9de02c24f4dcdb' + uboot_path = self.fetch_asset(uboot_url, asset_hash=uboot_hash) + uboot_path = archive.uncompress(uboot_path, self.workdir) + + self.vm.set_machine('rx-virt') + self.vm.set_console() + self.vm.add_args('-bios', uboot_path, + '-no-reboot') + self.vm.launch() + uboot_version = 'U-Boot 2016.05-rc3-23705-ga1ef3c71cb-dirty' + self.wait_for_console_pattern(uboot_version) + gcc_version = 'rx-unknown-linux-gcc (GCC) 9.0.0 20181105 (experimental)'tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 718
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ # FIXME limit baudrate on chardev, else we type too fast + #self.exec_command_and_wait_for_pattern('version', gcc_version) + + def test_rx_linux(self): + """ + :avocado: tags=arch:rx + :avocado: tags=machine:rx-virt + :avocado: tags=endian:little + """ + dtb_url = ('https://acc.dl.osdn.jp/users/23/23887/rx-qemu.dtb')Sourceforge URL are not very stable, I'm now getting:
Quoted 8 lines
HTTP request sent, awaiting response... 302 Found
Location: https://osdn.dl.osdn.net/users/23/23887/rx-qemu.dtb [following] --2020-03-08 17:17:31-- https://osdn.dl.osdn.net/users/23/23887/rx-qemu.dtb
Resolving osdn.dl.osdn.net (osdn.dl.osdn.net)... 202.221.179.23 Connecting to osdn.dl.osdn.net (osdn.dl.osdn.net)|202.221.179.23|:443... connected.
HTTP request sent, awaiting response... 404 Not Found2020-03-08 17:17:32 ERROR 404: Not Found.Quoted 4 lines
Permernet link is bellow.
https://osdn.net/users/ysato/pf/qemu/dl/u-boot.bin.gz
https://osdn.net/users/ysato/pf/qemu/dl/rx-virt.dtb
https://osdn.net/users/ysato/pf/qemu/dl/zImage
Quoted 8 lines
Acceptance tests assert that "something that used to work in the past is still working today". The artifact hash is here to verify the file has not been modified (for security reasons or replaced by something else) so we keep testing the same.
If you upgrade these files, we should keep testing the older version, and eventually add a new test (or entry in the same test) to test the new files.
OK.
The binary was prepared for qemu testing, so keep it as it is.
Quoted 24 lines
Quoted 23 lines
I was misunderstanding. sorry.
Quoted 19 lines
Quoted 17 lines
tests/acceptance/boot_linux_console.py +16
-0+ dtb_hash = '7b4e4e2c71905da44e86ce47adee2210b026ac18' + dtb_path = self.fetch_asset(dtb_url, asset_hash=dtb_hash) + kernel_url = ('http://acc.dl.osdn.jp/users/23/23845/zImage') + kernel_hash = '39a81067f8d72faad90866ddfefa19165d68fc99' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + + self.vm.set_machine('rx-virt') + self.vm.set_console() + kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'earlycon' + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-no-reboot') + self.vm.launch() + self.wait_for_console_pattern('Sash command shell (version 1.1.1)') + self.exec_command_and_wait_for_pattern('printenv', + 'TERM=linux')
Signature · 1 line
Yosinori Sato