Skip to contentSkip to conversation

sh4: Add 'Renesas peripherals' entry in MAINTAINERS + trivial fixes

PATCH In review Philippe Mathieu-Daudé 3 participants 12 messages Jun 11, 2020 – Jun 20, 2020

lore
Share & tools
lore
#0 lore raw

v4 cover sh4: Add 'Renesas peripherals' entry in MAINTAINERS + trivial fixes

Hi,

This series include trivial fixes, and add a new 'Renesas peripherals' section in MAINTAINERS.

Since v3:
- Rebased on Aleksandar's "Resolution of sh4 maintainership"
https://lists.gnu.org/archive/html/qemu-devel/2020-06/msg03183.html

Since v2:
- Keep Magnus as maintainer:
https://www.mail-archive.com/[email protected]/msg710320.html
Addressed Aleksandar review comments:
- Split the MAINTAINER patch in various atomic units
https://www.mail-archive.com/[email protected]/msg710947.html
- Add Yoshinori Sato as maintainer of SH4/RX peripherals
https://www.mail-archive.com/[email protected]/msg711008.html

Maybe patches 6 & 7 can go via acceptance-next queue, and the rest via qemu-trivial@?

Regards,

Phil.

CI report:
https://travis-ci.org/github/philmd/qemu/builds/692828388

Supersedes: <[email protected]>
Based-on: <[email protected]>

Philippe Mathieu-Daudé (5):
MAINTAINERS: Cover 'hw/sh4/sh_intc.h' with the R2D machine
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

Thomas Huth (2):
tests/acceptance: Add boot tests for sh4 QEMU advent calendar image .travis.yml: Test SH4 QEMU advent calendar image

 include/hw/sh4/sh.h                    | 12 +-----------
 include/hw/timer/tmu012.h              | 23 +++++++++++++++++++++++
 hw/sh4/sh7750.c                        |  1 +
 hw/timer/sh_timer.c                    |  3 ++-
 .travis.yml                            |  2 +-
 MAINTAINERS                            | 10 +++++++++-
 tests/acceptance/boot_linux_console.py | 13 +++++++++++--
 7 files changed, 48 insertions(+), 16 deletions(-)
 create mode 100644 include/hw/timer/tmu012.h
Signature · 1 line
2.21.3
#1 lore raw

PATCH v4 1/7 MAINTAINERS: Cover 'hw/sh4/sh_intc.h' with the R2D machine

Commit 81527b94ad added hw/intc/sh_intc.c, complete by adding its corresponding header.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 13711aafe8..87ceca7ff1 100644
@@ -1257,6 +1257,7 @@ S: Maintained
 F: hw/sh4/r2d.c
 F: hw/intc/sh_intc.c
 F: hw/timer/sh_timer.c
+F: include/hw/sh4/sh_intc.h
 
 Shix
 M: Yoshinori Sato <[email protected]>
Signature · 1 line
2.21.3
#2 lore raw

Re: [PATCH v4 1/7] MAINTAINERS: Cover 'hw/sh4/sh_intc.h' with the R2D machine

Quoted 13 lines · Philippe Mathieu-Daudé

Commit 81527b94ad added hw/intc/sh_intc.c, complete by adding its corresponding header.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index 13711aafe8..87ceca7ff1 100644

MAINTAINERS S: Maintained · line 1263

Quoted 7 lines
MAINTAINERS +1 -0
@@ -1257,6 +1257,7 @@ S: Maintained
 F: hw/sh4/r2d.c
 F: hw/intc/sh_intc.c
 F: hw/timer/sh_timer.c
+F: include/hw/sh4/sh_intc.h
 
 Shix
 M: Yoshinori Sato <[email protected]>

Hmm, sh_intc.h is used by sh7750_init() in sh7750.c ... and that function is used by both, r2d and shix machines ... so should that maybe rather be part of both machines or a generic entry?

Thomas

#3 lore raw

Re: [PATCH v4 1/7] MAINTAINERS: Cover 'hw/sh4/sh_intc.h' with the R2D machine

Quoted 19 lines · Thomas Huth
Quoted 18 lines · Philippe Mathieu-Daudé

Commit 81527b94ad added hw/intc/sh_intc.c, complete by adding its corresponding header.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 13711aafe8..87ceca7ff1 100644
@@ -1257,6 +1257,7 @@ S: Maintained
 F: hw/sh4/r2d.c
 F: hw/intc/sh_intc.c
 F: hw/timer/sh_timer.c
+F: include/hw/sh4/sh_intc.h
 
Quoted 6 lines

MAINTAINERS S: Maintained · line 1263

Quoted 2 lines
MAINTAINERS +0 -0
 Shix
 M: Yoshinori Sato <[email protected]>

Hmm, sh_intc.h is used by sh7750_init() in sh7750.c ... and that function is used by both, r2d and shix machines ... so should that maybe rather be part of both machines or a generic entry?

I'll add it to both machines. The maintainers can reorder the sections later.

Thanks for the review!

Quoted 4 lines

Thomas

Reviewed-by
#4 lore raw

Re: [PATCH v4 1/7] MAINTAINERS: Cover 'hw/sh4/sh_intc.h' with the R2D machine

Quoted 27 lines · Philippe Mathieu-Daudé
Quoted 19 lines · Thomas Huth
Quoted 18 lines · Philippe Mathieu-Daudé

Commit 81527b94ad added hw/intc/sh_intc.c, complete by adding its corresponding header.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 13711aafe8..87ceca7ff1 100644
@@ -1257,6 +1257,7 @@ S: Maintained
 F: hw/sh4/r2d.c
 F: hw/intc/sh_intc.c
 F: hw/timer/sh_timer.c
+F: include/hw/sh4/sh_intc.h
 
Quoted 6 lines

MAINTAINERS S: Maintained · line 1263

Quoted 2 lines
MAINTAINERS +0 -0
 Shix
 M: Yoshinori Sato <[email protected]>

Hmm, sh_intc.h is used by sh7750_init() in sh7750.c ... and that function is used by both, r2d and shix machines ... so should that maybe rather be part of both machines or a generic entry?

Quoted 4 lines

I'll add it to both machines. The maintainers can reorder the sections later.

Thanks for the review!

Ok, with that change:

#5 lore raw

PATCH v4 2/7 MAINTAINERS: Add an entry for common Renesas peripherals

In reply to Philippe Mathieu-Daudé

Renesas peripherals are common to SH4/RX based MCUs. Their datasheets share common sections. It makes sense to maintain them altogether.
Add the uncovered UART SCI peripheral.
The current names are misleading (see the 'sh_' prefix). In another series we will remove these peripherals with the 'renesas_' prefix. Out of the scope of this change in MAINTAINERS.

---
 MAINTAINERS | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
MAINTAINERS +8 -1
index 87ceca7ff1..4792509673 100644
@@ -1256,7 +1256,6 @@ R: Magnus Damm <[email protected]>
 S: Maintained
 F: hw/sh4/r2d.c
 F: hw/intc/sh_intc.c
-F: hw/timer/sh_timer.c
 F: include/hw/sh4/sh_intc.h
 
 Shix
@@ -1958,6 +1957,14 @@ F: hw/*/*xive*
 F: include/hw/*/*xive*
 F: docs/*/*xive*
 
+Renesas peripherals
+M: Yoshinori Sato <[email protected]>
+R: Magnus Damm <[email protected]>
+S: Maintained
+F: hw/char/sh_serial.c
+F: hw/timer/sh_timer.c
+F: include/hw/sh4/sh.h
+
 Subsystems
 ----------
 Audio
Signature · 1 line
2.21.3
Reviewed-by on v4 2/7
#6 lore raw

Re: [PATCH v4 2/7] MAINTAINERS: Add an entry for common Renesas peripherals

Quoted 9 lines · Philippe Mathieu-Daudé

Renesas peripherals are common to SH4/RX based MCUs. Their datasheets share common sections. It makes sense to maintain them altogether.
Add the uncovered UART SCI peripheral.
The current names are misleading (see the 'sh_' prefix). In another series we will remove these peripherals with the 'renesas_' prefix. Out of the scope of this change in MAINTAINERS.

Quoted 6 lines
---
 MAINTAINERS | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

r~

#7 lore raw

PATCH v4 3/7 hw/sh4: Use MemoryRegion typedef

In reply to Philippe Mathieu-Daudé

Use the MemoryRegion type defined in "qemu/typedefs.h", to keep the repository style consistent.

---
 include/hw/sh4/sh.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
include/hw/sh4/sh.h +2 -3
index 767a2df7e2..fe773cb01d 100644
@@ -10,9 +10,8 @@
 
 /* sh7750.c */
 struct SH7750State;
-struct MemoryRegion;
 
-struct SH7750State *sh7750_init(SuperHCPU *cpu, struct MemoryRegion *sysmem);
+struct SH7750State *sh7750_init(SuperHCPU *cpu, MemoryRegion *sysmem);
 
 typedef struct {
     /* The callback will be triggered if any of the designated lines change */
@@ -32,7 +31,7 @@ int sh7750_register_io_device(struct SH7750State *s,
 #define TMU012_FEAT_TOCR   (1 << 0)
 #define TMU012_FEAT_3CHAN  (1 << 1)
 #define TMU012_FEAT_EXTCLK (1 << 2)
-void tmu012_init(struct MemoryRegion *sysmem, hwaddr base,
+void tmu012_init(MemoryRegion *sysmem, hwaddr base,
                  int feat, uint32_t freq,
 		 qemu_irq ch0_irq, qemu_irq ch1_irq,
 		 qemu_irq ch2_irq0, qemu_irq ch2_irq1);
Signature · 1 line
2.21.3
#8 lore raw

PATCH v4 4/7 hw/sh4: Extract timer definitions to 'hw/timer/tmu012.h'

In reply to Philippe Mathieu-Daudé

Extract timer definitions to 'hw/timer/tmu012.h'.

---
 include/hw/sh4/sh.h       |  9 ---------
 include/hw/timer/tmu012.h | 23 +++++++++++++++++++++++
 hw/sh4/sh7750.c           |  1 +
 hw/timer/sh_timer.c       |  2 ++
 4 files changed, 26 insertions(+), 9 deletions(-)
 create mode 100644 include/hw/timer/tmu012.h
include/hw/sh4/sh.h +0 -9
index fe773cb01d..93f464bf4c 100644
@@ -27,15 +27,6 @@ typedef struct {
 
 int sh7750_register_io_device(struct SH7750State *s,
 			      sh7750_io_device * device);
-/* sh_timer.c */
-#define TMU012_FEAT_TOCR   (1 << 0)
-#define TMU012_FEAT_3CHAN  (1 << 1)
-#define TMU012_FEAT_EXTCLK (1 << 2)
-void tmu012_init(MemoryRegion *sysmem, hwaddr base,
-                 int feat, uint32_t freq,
-		 qemu_irq ch0_irq, qemu_irq ch1_irq,
-		 qemu_irq ch2_irq0, qemu_irq ch2_irq1);
-
 
 /* sh_serial.c */
 #define SH_SERIAL_FEAT_SCIF (1 << 0)
include/hw/timer/tmu012.h new file +23 -0
new file mode 100644
index 0000000000..808ed8de1d
@@ -0,0 +1,23 @@
+/*
+ * SuperH Timer
+ *
+ * Copyright (c) 2007 Magnus Damm
+ *
+ * This code is licensed under the GPL.
+ */
+
+#ifndef HW_TIMER_TMU012_H
+#define HW_TIMER_TMU012_H
+
+#include "exec/hwaddr.h"
+
+#define TMU012_FEAT_TOCR   (1 << 0)
+#define TMU012_FEAT_3CHAN  (1 << 1)
+#define TMU012_FEAT_EXTCLK (1 << 2)
+
+void tmu012_init(MemoryRegion *sysmem, hwaddr base,
+                 int feat, uint32_t freq,
+                 qemu_irq ch0_irq, qemu_irq ch1_irq,
+                 qemu_irq ch2_irq0, qemu_irq ch2_irq1);
+
+#endif
hw/sh4/sh7750.c +1 -0
index d660714443..f8ac3ec6e3 100644
@@ -30,6 +30,7 @@
 #include "sh7750_regs.h"
 #include "sh7750_regnames.h"
 #include "hw/sh4/sh_intc.h"
+#include "hw/timer/tmu012.h"
 #include "cpu.h"
 #include "exec/exec-all.h"
 
hw/timer/sh_timer.c +2 -0
index 13c4051808..b9cbacf5d0 100644
@@ -9,10 +9,12 @@
  */
 
 #include "qemu/osdep.h"
+#include "exec/memory.h"
 #include "hw/hw.h"
 #include "hw/irq.h"
 #include "hw/sh4/sh.h"
 #include "qemu/timer.h"
+#include "hw/timer/tmu012.h"
 #include "hw/ptimer.h"
 
 //#define DEBUG_TIMER
Signature · 1 line
2.21.3
#9 lore raw

PATCH v4 5/7 hw/timer/sh_timer: Remove unused 'qemu/timer.h' include

In reply to Philippe Mathieu-Daudé

Remove unused "qemu/timer.h" include.

---
 hw/timer/sh_timer.c | 1 -
 1 file changed, 1 deletion(-)
hw/timer/sh_timer.c +0 -1
index b9cbacf5d0..bb0e1c8ee5 100644
@@ -13,7 +13,6 @@
 #include "hw/hw.h"
 #include "hw/irq.h"
 #include "hw/sh4/sh.h"
-#include "qemu/timer.h"
 #include "hw/timer/tmu012.h"
 #include "hw/ptimer.h"
 
Signature · 1 line
2.21.3
#10 lore raw

PATCH v4 6/7 tests/acceptance: Add boot tests for sh4 QEMU advent calendar image

In reply to Philippe Mathieu-Daudé

From: Thomas Huth <[email protected]>

Now that we can select the second serial console in the acceptance tests (see commit 746f244d9720 "Allow to use other serial consoles than default"), we can also test the sh4 image from the QEMU advent calendar 2018.

Message-Id: <[email protected]>

[PMD: Split .travis.yml change in separate patch]
---
 tests/acceptance/boot_linux_console.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
tests/acceptance/boot_linux_console.py +11 -2
index 3f3aa0c854..3d02519660 100644
@@ -858,12 +858,12 @@ def test_m68k_q800(self):
         console_pattern = 'No filesystem could mount root'
         self.wait_for_console_pattern(console_pattern)
 
-    def do_test_advcal_2018(self, day, tar_hash, kernel_name):
+    def do_test_advcal_2018(self, day, tar_hash, kernel_name, console=0):
         tar_url = ('https://www.qemu-advent-calendar.org'
                    '/2018/download/day' + day + '.tar.xz')
         file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
         archive.extract(file_path, self.workdir)
-        self.vm.set_console()
+        self.vm.set_console(console_index=console)
         self.vm.add_args('-kernel',
                          self.workdir + '/day' + day + '/' + kernel_name)
         self.vm.launch()
@@ -937,6 +937,15 @@ def test_ppc_mac99(self):
         self.vm.add_args('-M', 'graphics=off')
         self.do_test_advcal_2018('15', tar_hash, 'invaders.elf')
 
+    def test_sh4_r2d(self):
+        """
+        :avocado: tags=arch:sh4
+        :avocado: tags=machine:r2d
+        """
+        tar_hash = 'fe06a4fd8ccbf2e27928d64472939d47829d4c7e'
+        self.vm.add_args('-append', 'console=ttySC1')
+        self.do_test_advcal_2018('09', tar_hash, 'zImage', console=1)
+
     def test_sparc_ss20(self):
         """
         :avocado: tags=arch:sparc
Signature · 1 line
2.21.3
#11 lore raw

PATCH v4 7/7 .travis.yml: Test SH4 QEMU advent calendar image

In reply to Philippe Mathieu-Daudé

From: Thomas Huth <[email protected]>

Now that we can select the second serial console in the acceptance tests (see commit 746f244d9720 "Allow to use other serial consoles than default"), we can also test the sh4 image from the QEMU advent calendar 2018.

Message-Id: <[email protected]>

[PMD: Split tests/acceptance/boot_linux_console.py in previous commit]
---
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
.travis.yml +1 -1
index 564be50a3c..e2003565d8 100644
@@ -293,7 +293,7 @@ jobs:
     - name: "GCC check-acceptance"
       dist: bionic
       env:
-        - CONFIG="--enable-tools --target-list=aarch64-softmmu,alpha-softmmu,arm-softmmu,m68k-softmmu,microblaze-softmmu,mips-softmmu,mips64el-softmmu,nios2-softmmu,or1k-softmmu,ppc-softmmu,ppc64-softmmu,s390x-softmmu,sparc-softmmu,x86_64-softmmu,xtensa-softmmu"
+        - CONFIG="--enable-tools --target-list=aarch64-softmmu,alpha-softmmu,arm-softmmu,m68k-softmmu,microblaze-softmmu,mips-softmmu,mips64el-softmmu,nios2-softmmu,or1k-softmmu,ppc-softmmu,ppc64-softmmu,s390x-softmmu,sh4-softmmu,sparc-softmmu,x86_64-softmmu,xtensa-softmmu"
         - TEST_CMD="make check-acceptance"
         - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-acceptance"
       after_script:
Signature · 1 line
2.21.3