Skip to contentSkip to conversation

Renesas hardware patches for 2020-06-22

GIT PULL Applied Philippe Mathieu-Daudé 2 participants 6 messages Jun 22, 2020 – Oct 1, 2020

lore
Share & tools
lore
#0 lore raw

The following changes since commit 171199f56f5f9bdf1e5d670d09ef1351d8f01bae:

Merge remote-tracking branch 'remotes/alistair/tags/pull-riscv-to-apply-202=
00619-3' into staging (2020-06-22 14:45:25 +0100)

are available in the Git repository at:

https://gitlab.com/philmd/qemu.git tags/renesas-hw-20200622

for you to fetch changes up to 4adbfa45cc3793fa85157a4813306618f6009f52:

docs: Document the RX target (2020-06-22 18:37:12 +0200)

Since v1:
- Fixed format-string issue on 32-bit platforms

----------------------------------------------------------------
- Add a common entry for Renesas hardware in MAINTAINERS
- Trivial SH4 cleanups
- Add RX GDB simulator from Yoshinori Sato

The Renesas RX target emulation was added in commit c8c35e5f51, these patches complete the target by adding the hardware emulation.

Thank you Yoshinori for adding this code to QEMU, and your patience during the review process. Now your port is fully integrated.

CI results:
. https://cirrus-ci.com/build/6140199509950464
. https://travis-ci.org/github/philmd/qemu/builds/700954881
. https://app.shippable.com/github/philmd/qemu/runs/812/summary/console
----------------------------------------------------------------

$ git backport-diff -u renesas-hw-20200621
Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch
[down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

001/15:[----] [--] 'MAINTAINERS: Cover sh_intc files in the R2D/Shix machine sections' 002/15:[----] [--] 'MAINTAINERS: Add an entry for common Renesas peripherals' 003/15:[----] [--] 'hw/sh4: Use MemoryRegion typedef'
004/15:[----] [--] 'hw/sh4: Extract timer definitions to 'hw/timer/tmu012.h'' 005/15:[----] [--] 'hw/timer/sh_timer: Remove unused 'qemu/timer.h' include' 006/15:[----] [--] 'hw/intc: RX62N interrupt controller (ICUa)' 007/15:[----] [--] 'hw/timer: RX62N 8-Bit timer (TMR)'
008/15:[----] [--] 'hw/timer: RX62N compare match timer (CMT)' 009/15:[----] [--] 'hw/char: RX62N serial communication interface (SCI)' 010/15:[----] [--] 'hw/rx: RX62N microcontroller (MCU)'
011/15:[----] [--] 'hw/rx: Honor -accel qtest'
012/15:[----] [--] 'hw/rx: Register R5F562N7 and R5F562N8 MCUs' 013/15:[0006] [FC] 'hw/rx: Add RX GDB simulator'
014/15:[----] [--] 'BootLinuxConsoleTest: Test the RX GDB simulator' 015/15:[----] [--] 'docs: Document the RX target'

Philippe Mathieu-Daud=C3=A9 (7):
MAINTAINERS: Cover sh_intc files in the R2D/Shix machine sections
MAINTAINERS: Add an entry for common Renesas peripherals hw/sh4: Use MemoryRegion typedef
hw/sh4: Extract timer definitions to 'hw/timer/tmu012.h' hw/timer/sh_timer: Remove unused 'qemu/timer.h' include hw/rx: Register R5F562N7 and R5F562N8 MCUs
BootLinuxConsoleTest: Test the RX GDB simulator

Richard Henderson (1):
hw/rx: Honor -accel qtest

Yoshinori Sato (7):
hw/intc: RX62N interrupt controller (ICUa) hw/timer: RX62N 8-Bit timer (TMR)
hw/timer: RX62N compare match timer (CMT) hw/char: RX62N serial communication interface (SCI) hw/rx: RX62N microcontroller (MCU)
hw/rx: Add RX GDB simulator
docs: Document the RX target

 docs/system/target-rx.rst             |  36 ++
 docs/system/targets.rst               |   1 +
 default-configs/rx-softmmu.mak        |   1 +
 include/hw/char/renesas_sci.h         |  51 +++
 include/hw/intc/rx_icu.h              |  76 ++++
 include/hw/rx/rx62n.h                 |  76 ++++
 include/hw/sh4/sh.h                   |  12 +-
 include/hw/timer/renesas_cmt.h        |  40 +++
 include/hw/timer/renesas_tmr.h        |  55 +++
 include/hw/timer/tmu012.h             |  23 ++
 hw/char/renesas_sci.c                 | 350 +++++++++++++++++++
 hw/intc/rx_icu.c                      | 397 +++++++++++++++++++++
 hw/rx/rx-gdbsim.c                     | 198 +++++++++++
 hw/rx/rx62n.c                         | 323 +++++++++++++++++
 hw/sh4/sh7750.c                       |   1 +
 hw/timer/renesas_cmt.c                | 283 +++++++++++++++
 hw/timer/renesas_tmr.c                | 477 ++++++++++++++++++++++++++
 hw/timer/sh_timer.c                   |   3 +-
 MAINTAINERS                           |  33 +-
 hw/Kconfig                            |   1 +
 hw/char/Kconfig                       |   3 +
 hw/char/Makefile.objs                 |   1 +
 hw/intc/Kconfig                       |   3 +
 hw/intc/Makefile.objs                 |   1 +
 hw/rx/Kconfig                         |  10 +
 hw/rx/Makefile.objs                   |   2 +
 hw/timer/Kconfig                      |   6 +
 hw/timer/Makefile.objs                |   2 +
 tests/acceptance/machine_rx_gdbsim.py |  68 ++++
 29 files changed, 2520 insertions(+), 13 deletions(-)
 create mode 100644 docs/system/target-rx.rst
 create mode 100644 include/hw/char/renesas_sci.h
 create mode 100644 include/hw/intc/rx_icu.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 include/hw/timer/tmu012.h
 create mode 100644 hw/char/renesas_sci.c
 create mode 100644 hw/intc/rx_icu.c
 create mode 100644 hw/rx/rx-gdbsim.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 hw/rx/Kconfig
 create mode 100644 hw/rx/Makefile.objs
 create mode 100644 tests/acceptance/machine_rx_gdbsim.py

--=20
2.21.3

#1 lore raw

[PULL v2 13/15] hw/rx: Add RX GDB simulator

From: Yoshinori Sato <[email protected]>

Add the RX machine internally simulated in GDB.

[PMD: Use TYPE_RX62N_CPU, use #define for RX62N_NR_TMR/CMT/SCI,
renamed CPU -> MCU, device -> microcontroller]

Message-Id: <[email protected]>

[PMD: Split of MCU, rename gdbsim, Add gdbsim-r5f562n7/r5f562n8]
---
 default-configs/rx-softmmu.mak |   1 +
 include/hw/rx/rx62n.h          |   4 +
 hw/rx/rx-gdbsim.c              | 198 +++++++++++++++++++++++++++++++++
 MAINTAINERS                    |   7 ++
 hw/rx/Kconfig                  |   4 +
 hw/rx/Makefile.objs            |   1 +
 6 files changed, 215 insertions(+)
 create mode 100644 hw/rx/rx-gdbsim.c
default-configs/rx-softmmu.mak +1 -0
index 7c4eb2c1a0..df2b4e4f42 100644
@@ -1,2 +1,3 @@
 # Default configuration for rx-softmmu
 
+CONFIG_RX_GDBSIM=y
include/hw/rx/rx62n.h +4 -0
index 1d3e6a5cad..aa94758c27 100644
@@ -37,6 +37,10 @@
 #define TYPE_R5F562N7_MCU "r5f562n7-mcu"
 #define TYPE_R5F562N8_MCU "r5f562n8-mcu"
 
+#define EXT_CS_BASE         0x01000000
+#define VECTOR_TABLE_BASE   0xffffff80
+#define RX62N_CFLASH_BASE   0xfff80000
+
 #define RX62N_NR_TMR    2
 #define RX62N_NR_CMT    2
 #define RX62N_NR_SCI    6
hw/rx/rx-gdbsim.c new file +198 -0

198 lines not on this page · raw message

MAINTAINERS +7 -0
index 570807936c..dc0203784a 100644
@@ -1256,6 +1256,13 @@ F: include/hw/riscv/opentitan.h
 F: include/hw/char/ibex_uart.h
 F: include/hw/intc/ibex_plic.h
 
+RX Machines
+-----------
+rx-gdbsim
+M: Yoshinori Sato <[email protected]>
+S: Maintained
+F: hw/rx/rx-gdbsim.c
+
 SH4 Machines
 ------------
 R2D
hw/rx/Kconfig +4 -0
index e7b1c59516..2b297c5a6a 100644
@@ -4,3 +4,7 @@ config RX62N_MCU
     select RENESAS_TMR
     select RENESAS_CMT
     select RENESAS_SCI
+
+config RX_GDBSIM
+    bool
+    select RX62N_MCU
hw/rx/Makefile.objs +1 -0
index fe19ee7984..4ef6b9e5b1 100644
@@ -1 +1,2 @@
 obj-$(CONFIG_RX62N_MCU) += rx62n.o
+obj-$(CONFIG_RX_GDBSIM) += rx-gdbsim.o
Signature · 1 line
2.21.3
#2 lore raw

Re: [PULL v2 13/15] hw/rx: Add RX GDB simulator

Quoted 4 lines · Philippe Mathieu-Daudé

From: Yoshinori Sato <[email protected]>

Add the RX machine internally simulated in GDB.

Hi; Coverity points out a memory leak (CID 1432307) in this function:

hw/rx/rx-gdbsim.c line 128

Quoted 9 lines
hw/rx/rx-gdbsim.c new file +8 -0
+static void rx_gdbsim_init(MachineState *machine)
+{
 
+        if (dtb_filename) {
+            ram_addr_t dtb_offset;
+            int dtb_size;
+            void *dtb;
+
+            dtb = load_device_tree(dtb_filename, &dtb_size);

This allocates memory...

Quoted 4 lines
hw/rx/rx-gdbsim.c new file +4 -0
+            if (dtb == NULL) {
+                error_report("Couldn't open dtb file %s", dtb_filename);
+                exit(1);
+            }

hw/rx/rx-gdbsim.c line 142

Quoted 10 lines
hw/rx/rx-gdbsim.c new file +10 -0
+            if (machine->kernel_cmdline &&
+                qemu_fdt_setprop_string(dtb, "/chosen", "bootargs",
+                                        machine->kernel_cmdline) < 0) {
+                error_report("Couldn't set /chosen/bootargs");
+                exit(1);
+            }
+            /* DTB is located at the end of SDRAM space. */
+            dtb_offset = machine->ram_size - dtb_size;
+            rom_add_blob_fixed("dtb", dtb, dtb_size,
+                               SDRAM_BASE + dtb_offset);

...and rom_add_blob_fixed() copies that memory, it doesn't take ownership of it, so after we've called it we need to

    g_free(fdt);

hw/rx/rx-gdbsim.c line 146

Quoted 4 lines
hw/rx/rx-gdbsim.c new file +4 -0
+            /* Set dtb address to R1 */
+            RXCPU(first_cpu)->env.regs[1] = SDRAM_BASE + dtb_offset;
+        }
+    }

thanks
-- PMM

#3 lore raw

Re: [PULL v2 13/15] hw/rx: Add RX GDB simulator

Hi Yoshinori,

Quoted 35 lines · Peter Maydell
Quoted 4 lines · Philippe Mathieu-Daudé

From: Yoshinori Sato <[email protected]>

Add the RX machine internally simulated in GDB.

Hi; Coverity points out a memory leak (CID 1432307) in this function:

hw/rx/rx-gdbsim.c line 128

Quoted 9 lines
hw/rx/rx-gdbsim.c new file +8 -0
+static void rx_gdbsim_init(MachineState *machine)
+{
 
+        if (dtb_filename) {
+            ram_addr_t dtb_offset;
+            int dtb_size;
+            void *dtb;
+
+            dtb = load_device_tree(dtb_filename, &dtb_size);

This allocates memory...

Quoted 4 lines
hw/rx/rx-gdbsim.c new file +4 -0
+            if (dtb == NULL) {
+                error_report("Couldn't open dtb file %s", dtb_filename);
+                exit(1);
+            }

hw/rx/rx-gdbsim.c line 142

Quoted 10 lines
hw/rx/rx-gdbsim.c new file +10 -0
+            if (machine->kernel_cmdline &&
+                qemu_fdt_setprop_string(dtb, "/chosen", "bootargs",
+                                        machine->kernel_cmdline) < 0) {
+                error_report("Couldn't set /chosen/bootargs");
+                exit(1);
+            }
+            /* DTB is located at the end of SDRAM space. */
+            dtb_offset = machine->ram_size - dtb_size;
+            rom_add_blob_fixed("dtb", dtb, dtb_size,
+                               SDRAM_BASE + dtb_offset);
Quoted 3 lines

...and rom_add_blob_fixed() copies that memory, it doesn't take ownership of it, so after we've called it we need to

    g_free(fdt);

Can you send a patch to fix this please?

Quoted 9 lines

hw/rx/rx-gdbsim.c line 146

Quoted 5 lines
hw/rx/rx-gdbsim.c new file +4 -0
+            /* Set dtb address to R1 */
+            RXCPU(first_cpu)->env.regs[1] = SDRAM_BASE + dtb_offset;
+        }
+    }

thanks
-- PMM

#4 lore raw

Re: [PULL v2 13/15] hw/rx: Add RX GDB simulator

Quoted 38 lines · Philippe Mathieu-Daudé

Hi Yoshinori,

Quoted 35 lines · Peter Maydell
Quoted 4 lines · Philippe Mathieu-Daudé

From: Yoshinori Sato <[email protected]>

Add the RX machine internally simulated in GDB.

Hi; Coverity points out a memory leak (CID 1432307) in this function:

hw/rx/rx-gdbsim.c line 128

Quoted 9 lines
hw/rx/rx-gdbsim.c new file +8 -0
+static void rx_gdbsim_init(MachineState *machine)
+{
 
+        if (dtb_filename) {
+            ram_addr_t dtb_offset;
+            int dtb_size;
+            void *dtb;
+
+            dtb = load_device_tree(dtb_filename, &dtb_size);

This allocates memory...

Quoted 14 lines
hw/rx/rx-gdbsim.c new file +14 -0
+            if (dtb == NULL) {
+                error_report("Couldn't open dtb file %s", dtb_filename);
+                exit(1);
+            }
+            if (machine->kernel_cmdline &&
+                qemu_fdt_setprop_string(dtb, "/chosen", "bootargs",
+                                        machine->kernel_cmdline) < 0) {
+                error_report("Couldn't set /chosen/bootargs");
+                exit(1);
+            }
+            /* DTB is located at the end of SDRAM space. */
+            dtb_offset = machine->ram_size - dtb_size;
+            rom_add_blob_fixed("dtb", dtb, dtb_size,
+                               SDRAM_BASE + dtb_offset);
Quoted 5 lines
Quoted 3 lines

...and rom_add_blob_fixed() copies that memory, it doesn't take ownership of it, so after we've called it we need to

    g_free(fdt);

Can you send a patch to fix this please?

ping?

Quoted 11 lines
Quoted 10 lines

hw/rx/rx-gdbsim.c line 146

Quoted 6 lines
hw/rx/rx-gdbsim.c new file +4 -0
+            /* Set dtb address to R1 */
+            RXCPU(first_cpu)->env.regs[1] = SDRAM_BASE + dtb_offset;
+        }
+    }

thanks
-- PMM

#5 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 25 lines · Philippe Mathieu-Daudé

The following changes since commit 171199f56f5f9bdf1e5d670d09ef1351d8f01bae:

Merge remote-tracking branch 'remotes/alistair/tags/pull-riscv-to-apply-202=
00619-3' into staging (2020-06-22 14:45:25 +0100)

are available in the Git repository at:

https://gitlab.com/philmd/qemu.git tags/renesas-hw-20200622

for you to fetch changes up to 4adbfa45cc3793fa85157a4813306618f6009f52:

docs: Document the RX target (2020-06-22 18:37:12 +0200)

Since v1:
- Fixed format-string issue on 32-bit platforms

----------------------------------------------------------------
- Add a common entry for Renesas hardware in MAINTAINERS
- Trivial SH4 cleanups
- Add RX GDB simulator from Yoshinori Sato

The Renesas RX target emulation was added in commit c8c35e5f51, these patches complete the target by adding the hardware emulation.

Quoted 8 lines

Thank you Yoshinori for adding this code to QEMU, and your patience during the review process. Now your port is fully integrated.

CI results:
. https://cirrus-ci.com/build/6140199509950464
. https://travis-ci.org/github/philmd/qemu/builds/700954881
. https://app.shippable.com/github/philmd/qemu/runs/812/summary/console
----------------------------------------------------------------

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.1
for any user-visible changes.

-- PMM