Renesas hardware patches for 2020-06-21
The following changes since commit 06c4cc3660b366278bdc7bc8b6677032d7b1118c:
qht: Fix threshold rate calculation (2020-06-19 18:29:11 +0100)
are available in the Git repository at:
https://gitlab.com/philmd/qemu.git tags/renesas-hw-20200621
for you to fetch changes up to 730101266e4026fc19808c740ee4b8118eeaaafe:
docs: Document the RX target (2020-06-21 01:21:47 +0200)
----------------------------------------------------------------
Renesas hardware patches
- 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.
Travis-CI:
https://travis-ci.org/github/philmd/qemu/builds/700461815
----------------------------------------------------------------
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 | 196 +++++++++++ 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, 2518 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
[PULL 01/15] MAINTAINERS: Cover sh_intc files in the R2D/Shix machine sections
Commit 81527b94ad added hw/intc/sh_intc.c, but only to the R2D machine (it is also used by the Shix machine). Complete the previous commit by adding the header to the R2D section, and both source + header to the Shix section.
--- MAINTAINERS | 3 +++ 1 file changed, 3 insertions(+)
MAINTAINERS +3 -0
@@ -1261,12 +1261,15 @@ 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]> R: Magnus Damm <[email protected]> S: Odd Fixes F: hw/sh4/shix.c +F: hw/intc/sh_intc.c +F: include/hw/sh4/sh_intc.h SPARC Machines --------------
Signature · 1 line
2.21.3
[PULL 03/15] 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
@@ -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
[PULL 04/15] 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
@@ -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
@@ -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
@@ -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
@@ -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
[PULL 05/15] 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
@@ -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
[PULL 06/15] hw/intc: RX62N interrupt controller (ICUa)
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
This 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 | 76 ++++++++ hw/intc/rx_icu.c | 397 +++++++++++++++++++++++++++++++++++++++ MAINTAINERS | 6 + hw/intc/Kconfig | 3 + hw/intc/Makefile.objs | 1 + 5 files changed, 483 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 +76 -0
@@ -0,0 +1,76 @@ +/* +* RX Interrupt Control Unit +* +* Copyright (c) 2019 Yoshinori Sato +* +* SPDX-License-Identifier: GPL-2.0-or-later +* +* 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 HW_INTC_RX_ICU_H +#define HW_INTC_RX_ICU_H + +#include "hw/sysbus.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 { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +MemoryRegion memory; +struct IRQSource src[NR_IRQS ]; +uint32_t nr_irqs; +uint8_t *map; +uint32_t nr_sense; +uint8_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; +int16_t req_irq; +qemu_irq _irq; +qemu_irq _fir; +qemu_irq _swi; +}; +typedef struct RXICUState RXICUState ; + +#define TYPE_RX_ICU "rx-icu" +#define RX_ICU (obj) OBJECT_CHECK(RXICUState, (obj), TYPE_RX_ICU) + +#endif /* RX_ICU_H */
hw/intc/rx_icu.c new file +397 -0
397 lines not on this page · raw message
MAINTAINERS +6 -0
@@ -1971,6 +1971,12 @@ F: hw/char/sh_serial.c F: hw/timer/sh_timer.c F: include/hw/sh4/sh.h +Renesas RX peripherals +M: Yoshinori Sato <[email protected]> +S: Maintained +F: hw/intc/rx_icu.c +F: include/hw/intc/rx_icu.h + Subsystems ---------- Audio
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
@@ -20,6 +20,7 @@ common-obj-$(CONFIG_ARM_GIC) += arm_gicv3_dist.o common-obj-$(CONFIG_ARM_GIC) += arm_gicv3_redist.o common-obj-$(CONFIG_ARM_GIC) += arm_gicv3_its_common.o common-obj-$(CONFIG_OPENPIC) += openpic.o +common-obj-$(CONFIG_RX_ICU) += rx_icu.o common-obj-y += intc.o obj-$(CONFIG_APIC) += apic.o apic_common.o
Signature · 1 line
2.21.3
[PULL 09/15] hw/char: RX62N serial communication interface (SCI)
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
This 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 | 51 +++++ hw/char/renesas_sci.c | 350 ++++++++++++++++++++++++++++++++++ MAINTAINERS | 2 + hw/char/Kconfig | 3 + hw/char/Makefile.objs | 1 + 5 files changed, 407 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 +51 -0
@@ -0,0 +1,51 @@ +/* +* Renesas Serial Communication Interface +* +* Copyright (c) 2018 Yoshinori Sato +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#ifndef HW_CHAR_RENESAS_SCI_H +#define HW_CHAR_RENESAS_SCI_H + +#include "chardev/char-fe.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 { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +MemoryRegion memory; +QEMUTimer timer; +CharBackend chr; +qemu_irq irq[SCI_NR_IRQ ]; + +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; +uint64_t input_freq; +}RSCIState ; + +#endif
hw/char/renesas_sci.c new file +350 -0
350 lines not on this page · raw message
MAINTAINERS +2 -0
@@ -1967,9 +1967,11 @@ Renesas peripherals M: Yoshinori Sato <[email protected]> R: Magnus Damm <[email protected]> S: Maintained +F: hw/char/renesas_sci.c F: hw/char/sh_serial.c F: hw/timer/renesas_*.c F: hw/timer/sh_timer.c +F: include/hw/char/renesas_sci.h F: include/hw/sh4/sh.h F: include/hw/timer/renesas_*.h
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.21.3
[PULL 02/15] 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
@@ -1260,7 +1260,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
@@ -1964,6 +1963,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
[PULL 10/15] hw/rx: RX62N microcontroller (MCU)
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
rx62n - RX62N cpu.
[PMD: Use TYPE_RX62N_CPU, use #define for RX62N_NR_TMR/CMT/SCI,
renamed CPU -> MCU, device -> microcontroller]
Message-Id: <[email protected]>
--- include/hw/rx/rx62n.h | 75 +++++++++++++ hw/rx/rx62n.c | 254 ++++++++++++++++++++++++++++++++++++++++++ MAINTAINERS | 2 + hw/Kconfig | 1 + hw/rx/Kconfig | 6 + hw/rx/Makefile.objs | 1 + 6 files changed, 339 insertions(+) create mode 100644 include/hw/rx/rx62n.h create mode 100644 hw/rx/rx62n.c create mode 100644 hw/rx/Kconfig create mode 100644 hw/rx/Makefile.objs
include/hw/rx/rx62n.h new file +75 -0
@@ -0,0 +1,75 @@ +/* +* RX62N MCU Object +* +* Datasheet: RX62N Group, RX621 Group User's Manual: Hardware +* (Rev.1.40 R01UH0033EJ0140) +* +* Copyright (c) 2019 Yoshinori Sato +* +* SPDX-License-Identifier: GPL-2.0-or-later +* +* 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 HW_RX_RX62N_MCU_H +#define HW_RX_RX62N_MCU_H + +#include "target/rx/cpu.h" +#include "hw/intc/rx_icu.h" +#include "hw/timer/renesas_tmr.h" +#include "hw/timer/renesas_cmt.h" +#include "hw/char/renesas_sci.h" +#include "qemu/units.h" + +#define TYPE_RX62N_MCU "rx62n-mcu" +#define RX62N_MCU (obj) OBJECT_CHECK(RX62NState, (obj), TYPE_RX62N_MCU) + +#define RX62N_NR_TMR 2 +#define RX62N_NR_CMT 2 +#define RX62N_NR_SCI 6 + +typedef struct RX62NState { +/*< private >*/ +DeviceState parent_obj; +/*< public >*/ + +RXCPU cpu; +RXICUState icu; +RTMRState tmr[RX62N_NR_TMR ]; +RCMTState cmt[RX62N_NR_CMT ]; +RSCIState sci[RX62N_NR_SCI ]; + +MemoryRegion *sysmem; +bool kernel; + +MemoryRegion iram; +MemoryRegion iomem1; +MemoryRegion d_flash; +MemoryRegion iomem2; +MemoryRegion iomem3; +MemoryRegion c_flash; +qemu_irq irq[NR_IRQS ]; +}RX62NState ; + +/* +* RX62N Internal Memory +* It is the value of R5F562N8. +* Please change the size for R5F562N7. +*/ +#define RX62N_IRAM_SIZE (96 * KiB) +#define RX62N_DFLASH_SIZE (32 * KiB) +#define RX62N_CFLASH_SIZE (512 * KiB) + +#define RX62N_PCLK (48 * 1000 * 1000) + +#endif
hw/rx/rx62n.c new file +254 -0
254 lines not on this page · raw message
MAINTAINERS +2 -0
@@ -1979,7 +1979,9 @@ Renesas RX peripherals M: Yoshinori Sato <[email protected]> S: Maintained F: hw/intc/rx_icu.c +F: hw/rx/ F: include/hw/intc/rx_icu.h +F: include/hw/rx/ Subsystems ----------
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
hw/rx/Kconfig new file +6 -0
@@ -0,0 +1,6 @@ +config RX62N_MCU + bool + select RX_ICU + select RENESAS_TMR + select RENESAS_CMT + select RENESAS_SCI
hw/rx/Makefile.objs new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_RX62N_MCU) += rx62n.o
Signature · 1 line
2.21.3
[PULL 07/15] hw/timer: RX62N 8-Bit timer (TMR)
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
renesas_tmr: 8bit 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_tmr.h | 55 ++++ hw/timer/renesas_tmr.c | 477 +++++++++++++++++++++++++++++++++ MAINTAINERS | 2 + hw/timer/Kconfig | 3 + hw/timer/Makefile.objs | 1 + 5 files changed, 538 insertions(+) create mode 100644 include/hw/timer/renesas_tmr.h create mode 100644 hw/timer/renesas_tmr.c
include/hw/timer/renesas_tmr.h new file +55 -0
@@ -0,0 +1,55 @@ +/* +* Renesas 8bit timer Object +* +* Copyright (c) 2018 Yoshinori Sato +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#ifndef HW_TIMER_RENESAS_TMR_H +#define HW_TIMER_RENESAS_TMR_H + +#include "qemu/timer.h" +#include "hw/sysbus.h" + +#define TYPE_RENESAS_TMR "renesas-tmr" +#define RTMR (obj) OBJECT_CHECK(RTMRState, (obj), TYPE_RENESAS_TMR) + +enum timer_event { + cmia =0 , + cmib =1 , + ovi =2 , + none =3 , +TMR_NR_EVENTS =4 +}; + +enum { +TMR_CH =2 , +TMR_NR_IRQ =3 *TMR_CH +}; + +typedef struct RTMRState { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +uint64_t input_freq; +MemoryRegion memory; + +int64_t tick; +uint8_t tcnt[TMR_CH ]; +uint8_t tcora[TMR_CH ]; +uint8_t tcorb[TMR_CH ]; +uint8_t tcr[TMR_CH ]; +uint8_t tccr[TMR_CH ]; +uint8_t tcor[TMR_CH ]; +uint8_t tcsr[TMR_CH ]; +int64_t div_round[TMR_CH ]; +uint8_t next[TMR_CH ]; +qemu_irq cmia[TMR_CH ]; +qemu_irq cmib[TMR_CH ]; +qemu_irq ovi[TMR_CH ]; +QEMUTimer timer[TMR_CH ]; +}RTMRState ; + +#endif
hw/timer/renesas_tmr.c new file +477 -0
477 lines not on this page · raw message
MAINTAINERS +2 -0
@@ -1968,8 +1968,10 @@ M: Yoshinori Sato <[email protected]> R: Magnus Damm <[email protected]> S: Maintained F: hw/char/sh_serial.c +F: hw/timer/renesas_tmr.c F: hw/timer/sh_timer.c F: include/hw/sh4/sh.h +F: include/hw/timer/renesas_tmr.h Renesas RX peripherals M: Yoshinori Sato <[email protected]>
hw/timer/Kconfig +3 -0
@@ -35,3 +35,6 @@ config CMSDK_APB_TIMER config CMSDK_APB_DUALTIMER bool select PTIMER + +config RENESAS_TMR + bool
hw/timer/Makefile.objs +1 -0
@@ -23,6 +23,7 @@ common-obj-$(CONFIG_OMAP) += omap_gptimer.o common-obj-$(CONFIG_OMAP) += omap_synctimer.o common-obj-$(CONFIG_PXA2XX) += pxa2xx_timer.o common-obj-$(CONFIG_SH4) += sh_timer.o +common-obj-$(CONFIG_RENESAS_TMR) += renesas_tmr.o common-obj-$(CONFIG_DIGIC) += digic-timer.o common-obj-$(CONFIG_MIPS_CPS) += mips_gictimer.o
Signature · 1 line
2.21.3
Re: [PULL 07/15] hw/timer: RX62N 8-Bit timer (TMR)
Quoted 4 lines · Philippe Mathieu-Daudé
From: Yoshinori Sato <[email protected]>
renesas_tmr: 8bit timer modules.
Hi; the recent Coverity run reports a potential bug in this
code: (CID 1429976)
hw/timer/renesas_tmr.c line 126
Quoted 5 lines
hw/timer/renesas_tmr.c new file +5
-0+static uint16_t read_tcnt (RTMRState *tmr,unsigned size,int ch) +{ +int64_t delta, now =qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ); +int elapsed, ovf =0 ; +uint16_t tcnt[2 ];
Here we declare tcnt[] but do not initialize its contents...
Quoted 15 lines
hw/timer/renesas_tmr.c new file +15
-0+uint32_t ret; + + delta = (now - tmr->tick) *NANOSECONDS_PER_SECOND / tmr->input_freq; +if (delta >0 ) { + tmr->tick = now; + +if (FIELD_EX8 (tmr->tccr[1 ],TCCR ,CSS ) ==INTERNAL ) { +/* timer1 count update */ + elapsed =elapsed_time (tmr,1 , delta); +if (elapsed >=0x100 ) { + ovf = elapsed >>8 ; + } + tcnt[1 ] = tmr->tcnt[1 ] + (elapsed &0xff ); + } +switch (FIELD_EX8 (tmr->tccr[0 ],TCCR ,CSS )) {
hw/timer/renesas_tmr.c line 151
Quoted 10 lines
hw/timer/renesas_tmr.c new file +10
-0+case INTERNAL : + elapsed =elapsed_time (tmr,0 , delta); + tcnt[0 ] = tmr->tcnt[0 ] + elapsed; +break ; +case CASCADING : +if (ovf >0 ) { + tcnt[0 ] = tmr->tcnt[0 ] + ovf; + } +break ; + }
...but not all cases here set both tcnt[0] and tcnt[1] (for instance in the "case CASCADING:" if ovf <=0 we won't set either of them)...
hw/timer/renesas_tmr.c line 162
Quoted 11 lines
hw/timer/renesas_tmr.c new file +11
-0+ }else { + tcnt[0 ] = tmr->tcnt[0 ]; + tcnt[1 ] = tmr->tcnt[1 ]; + } +if (size ==1 ) { +return tcnt[ch]; + }else { + ret =0 ; + ret =deposit32 (ret,0 ,8 , tcnt[1 ]); + ret =deposit32 (ret,8 ,8 , tcnt[0 ]); +return ret;
...and so here we will end up returning uninitialized data. Presumably the spec says what value is actually supposed to be returned in these cases?
PS: the "else" branch with the deposit32() calls could be rewritten more simply as
return lduw_be_p(tcnt);
hw/timer/renesas_tmr.c line 179
Quoted 2 lines
hw/timer/renesas_tmr.c new file +2
-0+static uint64_t tmr_read (void *opaque,hwaddr addr,unsigned size) +{
In this function Coverity reports a missing "break" (CID 1429977):
hw/timer/renesas_tmr.c line 223
Quoted 6 lines
hw/timer/renesas_tmr.c new file +6
-0+case A_TCORA : +if (size ==1 ) { +return tmr->tcora[ch]; + }else if (ch ==0 ) { +return concat_reg (tmr->tcora); + }
Here execution can fall through but there is no 'break' or '/* fallthrough */'.
hw/timer/renesas_tmr.c line 229
Quoted 6 lines
hw/timer/renesas_tmr.c new file +6
-0+case A_TCORB : +if (size ==1 ) { +return tmr->tcorb[ch]; + }else { +return concat_reg (tmr->tcorb); + }
Is it correct that the A_TCORA and A_TCORB code is different? It looks odd, so if this is intentional then a comment describing why it is so might be helpful to readers.
thanks
-- PMM
Re: [PULL 07/15] hw/timer: RX62N 8-Bit timer (TMR)
On 25/06/2020 11.25, Peter Maydell wrote:
[...]
Quoted 5 lines
hw/timer/renesas_tmr.c line 179
Quoted 2 lines
hw/timer/renesas_tmr.c new file +2
-0+static uint64_t tmr_read (void *opaque,hwaddr addr,unsigned size) +{In this function Coverity reports a missing "break" (CID 1429977):
Quoted 8 lines
hw/timer/renesas_tmr.c line 223
Quoted 6 lines
hw/timer/renesas_tmr.c new file +6
-0+case A_TCORA : +if (size ==1 ) { +return tmr->tcora[ch]; + }else if (ch ==0 ) { +return concat_reg (tmr->tcora); + }Here execution can fall through but there is no 'break' or '/* fallthrough */'.
Should we maybe start compiling with -Wimplicit-fallthrough if the compiler supports it, so that we do not always catch these problems after they have been merged?
Thomas
Re: [PULL 07/15] hw/timer: RX62N 8-Bit timer (TMR)
Quoted 7 lines · Thomas Huth
Quoted 1 line · Peter Maydell
Here execution can fall through but there is no 'break' or '/* fallthrough */'.
Should we maybe start compiling with -Wimplicit-fallthrough if the compiler supports it, so that we do not always catch these problems after they have been merged?
Yes. There have definitely been patches on list to do that, I'm not sure what their status is.
-- PMM
Re: [PULL 07/15] hw/timer: RX62N 8-Bit timer (TMR)
In reply to Peter MaydellHi Yoshinori,
Quoted 89 lines · Peter Maydell
Quoted 4 lines · Philippe Mathieu-Daudé
From: Yoshinori Sato <[email protected]>
renesas_tmr: 8bit timer modules.Hi; the recent Coverity run reports a potential bug in this
code: (CID 1429976)hw/timer/renesas_tmr.c line 126
Quoted 5 lines
hw/timer/renesas_tmr.c new file +5
-0+static uint16_t read_tcnt (RTMRState *tmr,unsigned size,int ch) +{ +int64_t delta, now =qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ); +int elapsed, ovf =0 ; +uint16_t tcnt[2 ];Here we declare tcnt[] but do not initialize its contents...
Quoted 15 lines
hw/timer/renesas_tmr.c new file +15
-0+uint32_t ret; + + delta = (now - tmr->tick) *NANOSECONDS_PER_SECOND / tmr->input_freq; +if (delta >0 ) { + tmr->tick = now; + +if (FIELD_EX8 (tmr->tccr[1 ],TCCR ,CSS ) ==INTERNAL ) { +/* timer1 count update */ + elapsed =elapsed_time (tmr,1 , delta); +if (elapsed >=0x100 ) { + ovf = elapsed >>8 ; + } + tcnt[1 ] = tmr->tcnt[1 ] + (elapsed &0xff ); + } +switch (FIELD_EX8 (tmr->tccr[0 ],TCCR ,CSS )) {hw/timer/renesas_tmr.c line 151
Quoted 10 lines
hw/timer/renesas_tmr.c new file +10
-0+case INTERNAL : + elapsed =elapsed_time (tmr,0 , delta); + tcnt[0 ] = tmr->tcnt[0 ] + elapsed; +break ; +case CASCADING : +if (ovf >0 ) { + tcnt[0 ] = tmr->tcnt[0 ] + ovf; + } +break ; + }...but not all cases here set both tcnt[0] and tcnt[1] (for instance in the "case CASCADING:" if ovf <=0 we won't set either of them)...
hw/timer/renesas_tmr.c line 162
Quoted 11 lines
hw/timer/renesas_tmr.c new file +11
-0+ }else { + tcnt[0 ] = tmr->tcnt[0 ]; + tcnt[1 ] = tmr->tcnt[1 ]; + } +if (size ==1 ) { +return tcnt[ch]; + }else { + ret =0 ; + ret =deposit32 (ret,0 ,8 , tcnt[1 ]); + ret =deposit32 (ret,8 ,8 , tcnt[0 ]); +return ret;...and so here we will end up returning uninitialized data. Presumably the spec says what value is actually supposed to be returned in these cases?
PS: the "else" branch with the
deposit32()calls could be rewritten more simply as
returnlduw_be_p(tcnt);hw/timer/renesas_tmr.c line 179
Quoted 2 lines
hw/timer/renesas_tmr.c new file +2
-0+static uint64_t tmr_read (void *opaque,hwaddr addr,unsigned size) +{In this function Coverity reports a missing "break" (CID 1429977):
hw/timer/renesas_tmr.c line 223
Quoted 6 lines
hw/timer/renesas_tmr.c new file +6
-0+case A_TCORA : +if (size ==1 ) { +return tmr->tcora[ch]; + }else if (ch ==0 ) { +return concat_reg (tmr->tcora); + }Here execution can fall through but there is no 'break' or '/* fallthrough */'.
hw/timer/renesas_tmr.c line 229
Quoted 6 lines
hw/timer/renesas_tmr.c new file +6
-0+case A_TCORB : +if (size ==1 ) { +return tmr->tcorb[ch]; + }else { +return concat_reg (tmr->tcorb); + }
Quoted 3 lines
Is it correct that the
A_TCORAandA_TCORBcode is different? It looks odd, so if this is intentional then a comment describing why it is so might be helpful to readers.
Can you address Peter's comments please?
Quoted 4 lines
thanks
-- PMM
Re: [PULL 07/15] hw/timer: RX62N 8-Bit timer (TMR)
ping...?
Quoted 103 lines · Philippe Mathieu-Daudé
Hi Yoshinori,
Quoted 89 lines · Peter Maydell
Quoted 4 lines · Philippe Mathieu-Daudé
From: Yoshinori Sato <[email protected]>
renesas_tmr: 8bit timer modules.Hi; the recent Coverity run reports a potential bug in this
code: (CID 1429976)hw/timer/renesas_tmr.c line 126
Quoted 5 lines
hw/timer/renesas_tmr.c new file +5
-0+static uint16_t read_tcnt (RTMRState *tmr,unsigned size,int ch) +{ +int64_t delta, now =qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ); +int elapsed, ovf =0 ; +uint16_t tcnt[2 ];Here we declare tcnt[] but do not initialize its contents...
Quoted 15 lines
hw/timer/renesas_tmr.c new file +15
-0+uint32_t ret; + + delta = (now - tmr->tick) *NANOSECONDS_PER_SECOND / tmr->input_freq; +if (delta >0 ) { + tmr->tick = now; + +if (FIELD_EX8 (tmr->tccr[1 ],TCCR ,CSS ) ==INTERNAL ) { +/* timer1 count update */ + elapsed =elapsed_time (tmr,1 , delta); +if (elapsed >=0x100 ) { + ovf = elapsed >>8 ; + } + tcnt[1 ] = tmr->tcnt[1 ] + (elapsed &0xff ); + } +switch (FIELD_EX8 (tmr->tccr[0 ],TCCR ,CSS )) {hw/timer/renesas_tmr.c line 151
Quoted 10 lines
hw/timer/renesas_tmr.c new file +10
-0+case INTERNAL : + elapsed =elapsed_time (tmr,0 , delta); + tcnt[0 ] = tmr->tcnt[0 ] + elapsed; +break ; +case CASCADING : +if (ovf >0 ) { + tcnt[0 ] = tmr->tcnt[0 ] + ovf; + } +break ; + }...but not all cases here set both tcnt[0] and tcnt[1] (for instance in the "case CASCADING:" if ovf <=0 we won't set either of them)...
hw/timer/renesas_tmr.c line 162
Quoted 11 lines
hw/timer/renesas_tmr.c new file +11
-0+ }else { + tcnt[0 ] = tmr->tcnt[0 ]; + tcnt[1 ] = tmr->tcnt[1 ]; + } +if (size ==1 ) { +return tcnt[ch]; + }else { + ret =0 ; + ret =deposit32 (ret,0 ,8 , tcnt[1 ]); + ret =deposit32 (ret,8 ,8 , tcnt[0 ]); +return ret;...and so here we will end up returning uninitialized data. Presumably the spec says what value is actually supposed to be returned in these cases?
PS: the "else" branch with the
deposit32()calls could be rewritten more simply as
returnlduw_be_p(tcnt);hw/timer/renesas_tmr.c line 179
Quoted 2 lines
hw/timer/renesas_tmr.c new file +2
-0+static uint64_t tmr_read (void *opaque,hwaddr addr,unsigned size) +{In this function Coverity reports a missing "break" (CID 1429977):
hw/timer/renesas_tmr.c line 223
Quoted 6 lines
hw/timer/renesas_tmr.c new file +6
-0+case A_TCORA : +if (size ==1 ) { +return tmr->tcora[ch]; + }else if (ch ==0 ) { +return concat_reg (tmr->tcora); + }Here execution can fall through but there is no 'break' or '/* fallthrough */'.
hw/timer/renesas_tmr.c line 229
Quoted 6 lines
hw/timer/renesas_tmr.c new file +6
-0+case A_TCORB : +if (size ==1 ) { +return tmr->tcorb[ch]; + }else { +return concat_reg (tmr->tcorb); + }Quoted 3 lines
Is it correct that the
A_TCORAandA_TCORBcode is different? It looks odd, so if this is intentional then a comment describing why it is so might be helpful to readers.Can you address Peter's comments please?
Quoted 4 lines
thanks
-- PMM
Re: [PULL 07/15] hw/timer: RX62N 8-Bit timer (TMR)
In reply to Philippe Mathieu-DaudéQuoted 93 lines · Philippe Mathieu-Daudé
Hi Yoshinori,
Quoted 89 lines · Peter Maydell
Quoted 4 lines · Philippe Mathieu-Daudé
From: Yoshinori Sato <[email protected]>
renesas_tmr: 8bit timer modules.Hi; the recent Coverity run reports a potential bug in this
code: (CID 1429976)hw/timer/renesas_tmr.c line 126
Quoted 5 lines
hw/timer/renesas_tmr.c new file +5
-0+static uint16_t read_tcnt (RTMRState *tmr,unsigned size,int ch) +{ +int64_t delta, now =qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ); +int elapsed, ovf =0 ; +uint16_t tcnt[2 ];Here we declare tcnt[] but do not initialize its contents...
Quoted 15 lines
hw/timer/renesas_tmr.c new file +15
-0+uint32_t ret; + + delta = (now - tmr->tick) *NANOSECONDS_PER_SECOND / tmr->input_freq; +if (delta >0 ) { + tmr->tick = now; + +if (FIELD_EX8 (tmr->tccr[1 ],TCCR ,CSS ) ==INTERNAL ) { +/* timer1 count update */ + elapsed =elapsed_time (tmr,1 , delta); +if (elapsed >=0x100 ) { + ovf = elapsed >>8 ; + } + tcnt[1 ] = tmr->tcnt[1 ] + (elapsed &0xff ); + } +switch (FIELD_EX8 (tmr->tccr[0 ],TCCR ,CSS )) {hw/timer/renesas_tmr.c line 151
Quoted 10 lines
hw/timer/renesas_tmr.c new file +10
-0+case INTERNAL : + elapsed =elapsed_time (tmr,0 , delta); + tcnt[0 ] = tmr->tcnt[0 ] + elapsed; +break ; +case CASCADING : +if (ovf >0 ) { + tcnt[0 ] = tmr->tcnt[0 ] + ovf; + } +break ; + }...but not all cases here set both tcnt[0] and tcnt[1] (for instance in the "case CASCADING:" if ovf <=0 we won't set either of them)...
hw/timer/renesas_tmr.c line 162
Quoted 11 lines
hw/timer/renesas_tmr.c new file +11
-0+ }else { + tcnt[0 ] = tmr->tcnt[0 ]; + tcnt[1 ] = tmr->tcnt[1 ]; + } +if (size ==1 ) { +return tcnt[ch]; + }else { + ret =0 ; + ret =deposit32 (ret,0 ,8 , tcnt[1 ]); + ret =deposit32 (ret,8 ,8 , tcnt[0 ]); +return ret;...and so here we will end up returning uninitialized data. Presumably the spec says what value is actually supposed to be returned in these cases?
PS: the "else" branch with the
deposit32()calls could be rewritten more simply as
returnlduw_be_p(tcnt);hw/timer/renesas_tmr.c line 179
Quoted 2 lines
hw/timer/renesas_tmr.c new file +2
-0+static uint64_t tmr_read (void *opaque,hwaddr addr,unsigned size) +{In this function Coverity reports a missing "break" (CID 1429977):
hw/timer/renesas_tmr.c line 223
Quoted 6 lines
hw/timer/renesas_tmr.c new file +6
-0+case A_TCORA : +if (size ==1 ) { +return tmr->tcora[ch]; + }else if (ch ==0 ) { +return concat_reg (tmr->tcora); + }Here execution can fall through but there is no 'break' or '/* fallthrough */'.
Quoted 6 lines
hw/timer/renesas_tmr.c new file +6
-0+case A_TCORB : +if (size ==1 ) { +return tmr->tcorb[ch]; + }else { +return concat_reg (tmr->tcorb); + }
Quoted 5 lines
Quoted 3 lines
Is it correct that the
A_TCORAandA_TCORBcode is different? It looks odd, so if this is intentional then a comment describing why it is so might be helpful to readers.Can you address Peter's comments please?
This register can 8bit and 16bit access.
8bit case return separate single TCORA or TCORB. 16bit case return merged two channel's TCORA or TCORB. high byte: channel 0 register.
low byte: channel 1 register
Quoted 5 lines
Quoted 4 lines
thanks
-- PMM
Signature · 1 line
Yosinori Sato
Re: [PULL 07/15] hw/timer: RX62N 8-Bit timer (TMR)
Quoted 99 lines · Yoshinori Sato
Quoted 97 lines · Philippe Mathieu-Daudé
Hi Yoshinori,
Quoted 92 lines · Peter Maydell
Quoted 4 lines · Philippe Mathieu-Daudé
From: Yoshinori Sato <[email protected]>
renesas_tmr: 8bit timer modules.Hi; the recent Coverity run reports a potential bug in this
code: (CID 1429976)hw/timer/renesas_tmr.c line 126
Quoted 5 lines
hw/timer/renesas_tmr.c new file +5
-0+static uint16_t read_tcnt (RTMRState *tmr,unsigned size,int ch) +{ +int64_t delta, now =qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ); +int elapsed, ovf =0 ; +uint16_t tcnt[2 ];Here we declare tcnt[] but do not initialize its contents...
Quoted 15 lines
hw/timer/renesas_tmr.c new file +15
-0+uint32_t ret; + + delta = (now - tmr->tick) *NANOSECONDS_PER_SECOND / tmr->input_freq; +if (delta >0 ) { + tmr->tick = now; + +if (FIELD_EX8 (tmr->tccr[1 ],TCCR ,CSS ) ==INTERNAL ) { +/* timer1 count update */ + elapsed =elapsed_time (tmr,1 , delta); +if (elapsed >=0x100 ) { + ovf = elapsed >>8 ; + } + tcnt[1 ] = tmr->tcnt[1 ] + (elapsed &0xff ); + } +switch (FIELD_EX8 (tmr->tccr[0 ],TCCR ,CSS )) {hw/timer/renesas_tmr.c line 151
Quoted 10 lines
hw/timer/renesas_tmr.c new file +10
-0+case INTERNAL : + elapsed =elapsed_time (tmr,0 , delta); + tcnt[0 ] = tmr->tcnt[0 ] + elapsed; +break ; +case CASCADING : +if (ovf >0 ) { + tcnt[0 ] = tmr->tcnt[0 ] + ovf; + } +break ; + }...but not all cases here set both tcnt[0] and tcnt[1] (for instance in the "case CASCADING:" if ovf <=0 we won't set either of them)...
hw/timer/renesas_tmr.c line 162
Quoted 11 lines
hw/timer/renesas_tmr.c new file +11
-0+ }else { + tcnt[0 ] = tmr->tcnt[0 ]; + tcnt[1 ] = tmr->tcnt[1 ]; + } +if (size ==1 ) { +return tcnt[ch]; + }else { + ret =0 ; + ret =deposit32 (ret,0 ,8 , tcnt[1 ]); + ret =deposit32 (ret,8 ,8 , tcnt[0 ]); +return ret;...and so here we will end up returning uninitialized data. Presumably the spec says what value is actually supposed to be returned in these cases?
PS: the "else" branch with the
deposit32()calls could be rewritten more simply as
returnlduw_be_p(tcnt);hw/timer/renesas_tmr.c line 179
Quoted 2 lines
hw/timer/renesas_tmr.c new file +2
-0+static uint64_t tmr_read (void *opaque,hwaddr addr,unsigned size) +{In this function Coverity reports a missing "break" (CID 1429977):
hw/timer/renesas_tmr.c line 223
Quoted 6 lines
hw/timer/renesas_tmr.c new file +6
-0+case A_TCORA : +if (size ==1 ) { +return tmr->tcora[ch]; + }else if (ch ==0 ) { +return concat_reg (tmr->tcora); + }Here execution can fall through but there is no 'break' or '/* fallthrough */'.
hw/timer/renesas_tmr.c line 229
Quoted 6 lines
hw/timer/renesas_tmr.c new file +6
-0+case A_TCORB : +if (size ==1 ) { +return tmr->tcorb[ch]; + }else { +return concat_reg (tmr->tcorb); + }Is it correct that the
A_TCORAandA_TCORBcode is different? It looks odd, so if this is intentional then a comment describing why it is so might be helpful to readers.
Quoted 7 lines
Quoted 1 line
Can you address Peter's comments please?
This register can 8bit and 16bit access.
8bit case return separate single TCORA or TCORB. 16bit case return merged two channel's TCORA or TCORB. high byte: channel 0 register.
low byte: channel 1 register
Thanks, can you send a patch to fix the potential bug?
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
thanks
-- PMM
Re: [PULL 07/15] hw/timer: RX62N 8-Bit timer (TMR)
In reply to Yoshinori SatoQuoted 99 lines · Yoshinori Sato
Quoted 97 lines · Philippe Mathieu-Daudé
Hi Yoshinori,
Quoted 92 lines · Peter Maydell
Quoted 4 lines · Philippe Mathieu-Daudé
From: Yoshinori Sato <[email protected]>
renesas_tmr: 8bit timer modules.Hi; the recent Coverity run reports a potential bug in this
code: (CID 1429976)hw/timer/renesas_tmr.c line 126
Quoted 5 lines
hw/timer/renesas_tmr.c new file +5
-0+static uint16_t read_tcnt (RTMRState *tmr,unsigned size,int ch) +{ +int64_t delta, now =qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ); +int elapsed, ovf =0 ; +uint16_t tcnt[2 ];Here we declare tcnt[] but do not initialize its contents...
Quoted 15 lines
hw/timer/renesas_tmr.c new file +15
-0+uint32_t ret; + + delta = (now - tmr->tick) *NANOSECONDS_PER_SECOND / tmr->input_freq; +if (delta >0 ) { + tmr->tick = now; + +if (FIELD_EX8 (tmr->tccr[1 ],TCCR ,CSS ) ==INTERNAL ) { +/* timer1 count update */ + elapsed =elapsed_time (tmr,1 , delta); +if (elapsed >=0x100 ) { + ovf = elapsed >>8 ; + } + tcnt[1 ] = tmr->tcnt[1 ] + (elapsed &0xff ); + } +switch (FIELD_EX8 (tmr->tccr[0 ],TCCR ,CSS )) {hw/timer/renesas_tmr.c line 151
Quoted 10 lines
hw/timer/renesas_tmr.c new file +10
-0+case INTERNAL : + elapsed =elapsed_time (tmr,0 , delta); + tcnt[0 ] = tmr->tcnt[0 ] + elapsed; +break ; +case CASCADING : +if (ovf >0 ) { + tcnt[0 ] = tmr->tcnt[0 ] + ovf; + } +break ; + }...but not all cases here set both tcnt[0] and tcnt[1] (for instance in the "case CASCADING:" if ovf <=0 we won't set either of them)...
hw/timer/renesas_tmr.c line 162
Quoted 11 lines
hw/timer/renesas_tmr.c new file +11
-0+ }else { + tcnt[0 ] = tmr->tcnt[0 ]; + tcnt[1 ] = tmr->tcnt[1 ]; + } +if (size ==1 ) { +return tcnt[ch]; + }else { + ret =0 ; + ret =deposit32 (ret,0 ,8 , tcnt[1 ]); + ret =deposit32 (ret,8 ,8 , tcnt[0 ]); +return ret;...and so here we will end up returning uninitialized data. Presumably the spec says what value is actually supposed to be returned in these cases?
PS: the "else" branch with the
deposit32()calls could be rewritten more simply as
returnlduw_be_p(tcnt);hw/timer/renesas_tmr.c line 179
Quoted 2 lines
hw/timer/renesas_tmr.c new file +2
-0+static uint64_t tmr_read (void *opaque,hwaddr addr,unsigned size) +{In this function Coverity reports a missing "break" (CID 1429977):
hw/timer/renesas_tmr.c line 223
Quoted 6 lines
hw/timer/renesas_tmr.c new file +6
-0+case A_TCORA : +if (size ==1 ) { +return tmr->tcora[ch]; + }else if (ch ==0 ) { +return concat_reg (tmr->tcora); + }Here execution can fall through but there is no 'break' or '/* fallthrough */'.
hw/timer/renesas_tmr.c line 229
Quoted 6 lines
hw/timer/renesas_tmr.c new file +6
-0+case A_TCORB : +if (size ==1 ) { +return tmr->tcorb[ch]; + }else { +return concat_reg (tmr->tcorb); + }Is it correct that the
A_TCORAandA_TCORBcode is different? It looks odd, so if this is intentional then a comment describing why it is so might be helpful to readers.
Quoted 7 lines
Quoted 1 line
Can you address Peter's comments please?
This register can 8bit and 16bit access.
8bit case return separate single TCORA or TCORB. 16bit case return merged two channel's TCORA or TCORB. high byte: channel 0 register.
low byte: channel 1 register
So could you please provide a patch that either adds the missing "break;" statement between the cases here, or adds a "/* fallthrough */" comment between the cases?
Thanks,
Thomas
Re: [PULL 07/15] hw/timer: RX62N 8-Bit timer (TMR)
2020-07-08 00:06 に Thomas Huth さんは書きました:
Quoted 109 lines · Yoshinori Sato
Quoted 100 lines
Quoted 98 lines · Philippe Mathieu-Daudé
Hi Yoshinori,
Quoted 93 lines · Peter Maydell
Quoted 4 lines · Philippe Mathieu-Daudé
From: Yoshinori Sato <[email protected]>
renesas_tmr: 8bit timer modules.Hi; the recent Coverity run reports a potential bug in this
code: (CID 1429976)hw/timer/renesas_tmr.c line 126
Quoted 5 lines
hw/timer/renesas_tmr.c new file +5
-0+static uint16_t read_tcnt (RTMRState *tmr,unsigned size,int ch) +{ +int64_t delta, now =qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ); +int elapsed, ovf =0 ; +uint16_t tcnt[2 ];Here we declare tcnt[] but do not initialize its contents...
Quoted 16 lines
hw/timer/renesas_tmr.c new file +3
-0+uint32_t ret; + + delta = (now - tmr->tick) * NANOSECONDS_PER_SECOND /
tmr->input_freq;hw/timer/renesas_tmr.c new file +12
-0+if (delta >0 ) { + tmr->tick = now; + +if (FIELD_EX8 (tmr->tccr[1 ],TCCR ,CSS ) ==INTERNAL ) { +/* timer1 count update */ + elapsed =elapsed_time (tmr,1 , delta); +if (elapsed >=0x100 ) { + ovf = elapsed >>8 ; + } + tcnt[1 ] = tmr->tcnt[1 ] + (elapsed &0xff ); + } +switch (FIELD_EX8 (tmr->tccr[0 ],TCCR ,CSS )) {hw/timer/renesas_tmr.c line 151
Quoted 10 lines
hw/timer/renesas_tmr.c new file +10
-0+case INTERNAL : + elapsed =elapsed_time (tmr,0 , delta); + tcnt[0 ] = tmr->tcnt[0 ] + elapsed; +break ; +case CASCADING : +if (ovf >0 ) { + tcnt[0 ] = tmr->tcnt[0 ] + ovf; + } +break ; + }...but not all cases here set both tcnt[0] and tcnt[1] (for instance in the "case CASCADING:" if ovf <=0 we won't set either of them)...
hw/timer/renesas_tmr.c line 162
Quoted 11 lines
hw/timer/renesas_tmr.c new file +11
-0+ }else { + tcnt[0 ] = tmr->tcnt[0 ]; + tcnt[1 ] = tmr->tcnt[1 ]; + } +if (size ==1 ) { +return tcnt[ch]; + }else { + ret =0 ; + ret =deposit32 (ret,0 ,8 , tcnt[1 ]); + ret =deposit32 (ret,8 ,8 , tcnt[0 ]); +return ret;...and so here we will end up returning uninitialized data. Presumably the spec says what value is actually supposed to be returned in these cases?
PS: the "else" branch with the
deposit32()calls could be rewritten more simply as
returnlduw_be_p(tcnt);hw/timer/renesas_tmr.c line 179
Quoted 2 lines
hw/timer/renesas_tmr.c new file +2
-0+static uint64_t tmr_read (void *opaque,hwaddr addr,unsigned size) +{In this function Coverity reports a missing "break" (CID 1429977):
hw/timer/renesas_tmr.c line 223
Quoted 6 lines
hw/timer/renesas_tmr.c new file +6
-0+case A_TCORA : +if (size ==1 ) { +return tmr->tcora[ch]; + }else if (ch ==0 ) { +return concat_reg (tmr->tcora); + }Here execution can fall through but there is no 'break' or '/* fallthrough */'.
hw/timer/renesas_tmr.c line 229
Quoted 6 lines
hw/timer/renesas_tmr.c new file +6
-0+case A_TCORB : +if (size ==1 ) { +return tmr->tcorb[ch]; + }else { +return concat_reg (tmr->tcorb); + }Is it correct that the
A_TCORAandA_TCORBcode is different? It looks odd, so if this is intentional then a comment describing why it is so might be helpful to readers.Quoted 7 lines
Quoted 1 line
Can you address Peter's comments please?
This register can 8bit and 16bit access.
8bit case return separate single TCORA or TCORB. 16bit case return merged two channel's TCORA or TCORB. high byte: channel 0 register.
low byte: channel 1 register
Quoted 6 lines
So could you please provide a patch that either adds the missing "break;" statement between the cases here, or adds a "/* fallthrough */" comment between the cases?
Thanks,
Thomas
OK.
This part will be cleaned up more.
Thanks.
[PULL 13/15] hw/rx: Add RX GDB simulator
In reply to Philippe Mathieu-Daudé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]>
--- default-configs/rx-softmmu.mak | 1 + include/hw/rx/rx62n.h | 4 + hw/rx/rx-gdbsim.c | 196 +++++++++++++++++++++++++++++++++ MAINTAINERS | 7 ++ hw/rx/Kconfig | 4 + hw/rx/Makefile.objs | 1 + 6 files changed, 213 insertions(+) create mode 100644 hw/rx/rx-gdbsim.c
default-configs/rx-softmmu.mak +1 -0
@@ -1,2 +1,3 @@ # Default configuration for rx-softmmu +CONFIG_RX_GDBSIM=y
include/hw/rx/rx62n.h +4 -0
@@ -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 +196 -0
196 lines not on this page · raw message
MAINTAINERS +7 -0
@@ -1252,6 +1252,13 @@ S: Supported F: hw/riscv/opentitan.c F: include/hw/riscv/opentitan.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
@@ -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
@@ -1 +1,2 @@ obj-$(CONFIG_RX62N_MCU) += rx62n.o +obj-$(CONFIG_RX_GDBSIM) += rx-gdbsim.o
Signature · 1 line
2.21.3
[PULL 12/15] hw/rx: Register R5F562N7 and R5F562N8 MCUs
In reply to Philippe Mathieu-DaudéMake the current TYPE_RX62N_MCU an abstract class, and generate TYPE_R5F562N7_MCU and TYPE_R5F562N8_MCU models.
--- include/hw/rx/rx62n.h | 19 ++++----- hw/rx/rx62n.c | 92 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 85 insertions(+), 26 deletions(-)
include/hw/rx/rx62n.h +8 -11
@@ -34,6 +34,9 @@#define TYPE_RX62N_MCU "rx62n-mcu"#define RX62N_MCU (obj) OBJECT_CHECK(RX62NState, (obj), TYPE_RX62N_MCU) +#define TYPE_R5F562N7_MCU "r5f562n7-mcu" +#define TYPE_R5F562N8_MCU "r5f562n8-mcu" +#define RX62N_NR_TMR 2#define RX62N_NR_CMT 2#define RX62N_NR_SCI 6
@@ -59,17 +62,11 @@ typedef struct RX62NState {MemoryRegion iomem3;MemoryRegion c_flash;qemu_irq irq[NR_IRQS ]; + +/* Input Clock (XTAL) frequency */ +uint32_t xtal_freq_hz; +/* Peripheral Module Clock frequency */ + uint32_t pclk_freq_hz; } RX62NState; -/* -* RX62N Internal Memory -* It is the value of R5F562N8. -* Please change the size for R5F562N7. -*/ -#define RX62N_IRAM_SIZE (96 * KiB) -#define RX62N_DFLASH_SIZE (32 * KiB) -#define RX62N_CFLASH_SIZE (512 * KiB) - -#define RX62N_PCLK (48 * 1000 * 1000) -#endif
hw/rx/rx62n.c +77 -15
147 lines not on this page · raw message
Signature · 1 line
2.21.3
[PULL 08/15] hw/timer: RX62N compare match timer (CMT)
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
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 | 40 +++++ hw/timer/renesas_cmt.c | 283 +++++++++++++++++++++++++++++++++ MAINTAINERS | 4 +- hw/timer/Kconfig | 3 + hw/timer/Makefile.objs | 1 + 5 files changed, 329 insertions(+), 2 deletions(-) create mode 100644 include/hw/timer/renesas_cmt.h create mode 100644 hw/timer/renesas_cmt.c
include/hw/timer/renesas_cmt.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +* Renesas Compare-match timer Object +* +* Copyright (c) 2019 Yoshinori Sato +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#ifndef HW_TIMER_RENESAS_CMT_H +#define HW_TIMER_RENESAS_CMT_H + +#include "qemu/timer.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 { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +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
hw/timer/renesas_cmt.c new file +283 -0
283 lines not on this page · raw message
MAINTAINERS +2 -2
@@ -1968,10 +1968,10 @@ M: Yoshinori Sato <[email protected]> R: Magnus Damm <[email protected]> S: Maintained F: hw/char/sh_serial.c -F: hw/timer/renesas_tmr.c +F: hw/timer/renesas_*.c F: hw/timer/sh_timer.c F: include/hw/sh4/sh.h -F: include/hw/timer/renesas_tmr.h +F: include/hw/timer/renesas_*.h Renesas RX peripherals M: Yoshinori Sato <[email protected]>
hw/timer/Kconfig +3 -0
@@ -38,3 +38,6 @@ config CMSDK_APB_DUALTIMER config RENESAS_TMR bool + +config RENESAS_CMT + bool
hw/timer/Makefile.objs +1 -0
@@ -24,6 +24,7 @@ common-obj-$(CONFIG_OMAP) += omap_synctimer.o common-obj-$(CONFIG_PXA2XX) += pxa2xx_timer.o common-obj-$(CONFIG_SH4) += sh_timer.o common-obj-$(CONFIG_RENESAS_TMR) += renesas_tmr.o +common-obj-$(CONFIG_RENESAS_CMT) += renesas_cmt.o common-obj-$(CONFIG_DIGIC) += digic-timer.o common-obj-$(CONFIG_MIPS_CPS) += mips_gictimer.o
Signature · 1 line
2.21.3
[PULL 14/15] BootLinuxConsoleTest: Test the RX GDB simulator
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
Add two tests for the rx-gdbsim 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/machine_rx_gdbsim.py JOB ID : 84a6ef01c0b87975ecbfcb31a920afd735753ace JOB LOG : /home/phil/avocado/job-results/job-2019-05-24T05.02-84a6ef0/job.log (1/2) tests/acceptance/machine_rx_gdbsim.py:RxGdbSimMachine.test_uboot: PASS (0.11 s) (2/2) tests/acceptance/machine_rx_gdbsim.py:RxGdbSimMachine.test_linux_sash: 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/machine_rx_gdbsim.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
Message-Id: <[email protected]>
--- MAINTAINERS | 1 + tests/acceptance/machine_rx_gdbsim.py | 68 +++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 tests/acceptance/machine_rx_gdbsim.py
MAINTAINERS +1 -0
@@ -1258,6 +1258,7 @@ rx-gdbsim M: Yoshinori Sato <[email protected]> S: Maintained F: hw/rx/rx-gdbsim.c +F: tests/acceptance/machine_rx_gdbsim.py SH4 Machines ------------
tests/acceptance/machine_rx_gdbsim.py new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
2.21.3
[PULL 15/15] docs: Document the RX target
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
Add rx-virt target specification document.
Message-Id: <[email protected]>
--- docs/system/target-rx.rst | 36 ++++++++++++++++++++++++++++++++++++ docs/system/targets.rst | 1 + MAINTAINERS | 1 + 3 files changed, 38 insertions(+) create mode 100644 docs/system/target-rx.rst
docs/system/target-rx.rst new file +36 -0
@@ -0,0 +1,36 @@ +.. _RX-System-emulator: + +RX System emulator +-------------------- + +Use the executable ``qemu-system-rx`` to simulate RX target (GDB simulator). +This target emulated following devices. + +- R5F562N8 MCU + + - On-chip memory (ROM 512KB, RAM 96KB) + - Interrupt Control Unit (ICUa) + - 8Bit Timer x 1CH (TMR0,1) + - Compare Match Timer x 2CH (CMT0,1) + - Serial Communication Interface x 1CH (SCI0) + +- External memory 16MByte + +Example of ``qemu-system-rx`` usage for RX is shown below: + +Download ``<u-boot_image_file>`` from +https://osdn.net/users/ysato/pf/qemu/dl/u-boot.bin.gz + +Start emulation of rx-virt:: + qemu-system-rx -M gdbsim-r5f562n8 -bios <u-boot_image_file> + +Download ``kernel_image_file`` from +https://osdn.net/users/ysato/pf/qemu/dl/zImage + +Download ``device_tree_blob`` from +https://osdn.net/users/ysato/pf/qemu/dl/rx-virt.dtb + +Start emulation of rx-virt:: + qemu-system-rx -M gdbsim-r5f562n8 \ + -kernel <kernel_image_file> -dtb <device_tree_blob> \ + -append "earlycon"
docs/system/targets.rst +1 -0
@@ -18,3 +18,4 @@ Contents: target-m68k target-xtensa target-s390x + target-rx
MAINTAINERS +1 -0
@@ -1257,6 +1257,7 @@ RX Machines rx-gdbsim M: Yoshinori Sato <[email protected]> S: Maintained +F: docs/system/target-rx.rst F: hw/rx/rx-gdbsim.c F: tests/acceptance/machine_rx_gdbsim.py
Signature · 1 line
2.21.3
[PULL 11/15] hw/rx: Honor -accel qtest
In reply to Philippe Mathieu-DaudéFrom: 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]>
--- hw/rx/rx62n.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
hw/rx/rx62n.c +8 -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" /*
@@ -208,7 +210,12 @@ static void rx62n_realize(DeviceState *dev, Error **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.21.3
Quoted 20 lines · Philippe Mathieu-Daudé
The following changes since commit
06c4cc3660b366278bdc7bc8b6677032d7b1118c:qht: Fix threshold rate calculation (2020-06-19 18:29:11 +0100)
are available in the Git repository at:
https://gitlab.com/philmd/qemu.git tags/renesas-hw-20200621
for you to fetch changes up to
730101266e4026fc19808c740ee4b8118eeaaafe:docs: Document the RX target (2020-06-21 01:21:47 +0200)
----------------------------------------------------------------
Renesas hardware patches- Add a common entry for Renesas hardware in
MAINTAINERS
- Trivial SH4 cleanups
- Add RX GDB simulator from Yoshinori Sato
Quoted 8 lines
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.
Travis-CI:
https://travis-ci.org/github/philmd/qemu/builds/700461815
Hi; I'm afraid there's a format-string issue here (manifests on OSX, openbsd, and 32-bit platforms):
/home/peter.maydell/qemu/hw/rx/rx-gdbsim.c: In function 'rx_gdbsim_init':/home/peter.maydell/qemu/hw/rx/rx-gdbsim.c:93:22: error: format '%lli' expects argument of type 'long long int', but argument 2 has type 'ram_addr_t {aka unsigned int}' [-Werror=format=]
error_report("Invalid RAM size, should be more than %" PRIi64 " Bytes",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mc->default_ram_size);
~~~~~~~~~~~~~~~~~~~~thanks
-- PMM
Quoted 20 lines · Peter Maydell
Quoted 6 lines · Philippe Mathieu-Daudé
Renesas hardware patches
- Add a common entry for Renesas hardware in
MAINTAINERS
- Trivial SH4 cleanups
- Add RX GDB simulator from Yoshinori SatoQuoted 8 lines
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.
Travis-CI:
https://travis-ci.org/github/philmd/qemu/builds/700461815Hi; I'm afraid there's a format-string issue here (manifests on OSX, openbsd, and 32-bit platforms):
Quoted 8 lines
/home/peter.maydell/qemu/hw/rx/rx-gdbsim.c: In function 'rx_gdbsim_init':/home/peter.maydell/qemu/hw/rx/rx-gdbsim.c:93:22: error: format '%lli' expects argument of type 'long long int', but argument 2 has type 'ram_addr_t{aka unsigned int}' [-Werror=format=]error_report("Invalid RAM size, should be more than %" PRIi64 " Bytes", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mc->default_ram_size); ~~~~~~~~~~~~~~~~~~~~
Also there appears to be a makefile/dependency bug somewhere, because when I drop this merge attempt and retry building with current master I get this error:
make[1]: Entering directory '/home/petmay01/qemu-for-merges/slirp' make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/petmay01/qemu-for-merges/slirp'
CC qga/main.o CC qemu-io.o CC monitor/qmp-cmds-control.o
make: *** No rule to make target '/home/petmay01/qemu-for-merges/hw/rx/Kconfig', needed by 'aarch64-softmmu/config-devices.mak'. Stop.
make: *** Waiting for unfinished jobs....
make: Leaving directory '/home/petmay01/qemu-for-merges/build/w64'
This seems to be because aarch64-softmmu/config-devices.mak.d in the build tree says that aarch64-softmmu/config-devices.mak depends on all the Kconfig files; this means that if a Kconfig file gets deleted then incremental build stops working?
thanks
-- PMM
+Thomas
Quoted 46 lines · Peter Maydell
Quoted 20 lines · Peter Maydell
Quoted 6 lines · Philippe Mathieu-Daudé
Renesas hardware patches
- Add a common entry for Renesas hardware in
MAINTAINERS
- Trivial SH4 cleanups
- Add RX GDB simulator from Yoshinori SatoQuoted 8 lines
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.
Travis-CI:
https://travis-ci.org/github/philmd/qemu/builds/700461815Hi; I'm afraid there's a format-string issue here (manifests on OSX, openbsd, and 32-bit platforms):
Quoted 8 lines
/home/peter.maydell/qemu/hw/rx/rx-gdbsim.c: In function 'rx_gdbsim_init':/home/peter.maydell/qemu/hw/rx/rx-gdbsim.c:93:22: error: format '%lli' expects argument of type 'long long int', but argument 2 has type 'ram_addr_t{aka unsigned int}' [-Werror=format=]error_report("Invalid RAM size, should be more than %" PRIi64 " Bytes", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mc->default_ram_size); ~~~~~~~~~~~~~~~~~~~~Also there appears to be a makefile/dependency bug somewhere, because when I drop this merge attempt and retry building with current master I get this error:
make[1]: Entering directory '
/home/petmay01/qemu-for-merges/slirp' make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/petmay01/qemu-for-merges/slirp'CC qga/main.o CC qemu-io.o CC monitor/qmp-cmds-control.omake: *** No rule to make target '
/home/petmay01/qemu-for-merges/hw/rx/Kconfig', needed by 'aarch64-softmmu/config-devices.mak'. Stop.
make: *** Waiting for unfinished jobs....
make: Leaving directory '/home/petmay01/qemu-for-merges/build/w64'
Quoted 4 lines
This seems to be because aarch64-softmmu/config-devices.mak.d in the build tree says that aarch64-softmmu/config-devices.mak depends on all the
Kconfigfiles; this means that if aKconfigfile gets deleted then incremental build stops working?
This seems the same problem previously discussed here:
https://www.mail-archive.com/[email protected]/msg676319.html
понедељак, 22. јун 2020., Philippe Mathieu-Daudé <[email protected]> је написао/ла:
Quoted 14 lines
+Thomas
Quoted 1 line · Peter Maydell
On Mon, 22 Jun 2020 at 17:01, Peter Maydell <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
On Sun, 21 Jun 2020 at 13:50, Philippe Mathieu-Daudé <[email protected]>
Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 6 lines
Renesas hardware patches
- Add a common entry for Renesas hardware in
MAINTAINERS
- Trivial SH4 cleanups
- Add RX GDB simulator from Yoshinori Sato
Can this rx patch be included in this pull request: (it was r-b-ed a couple of weeks ago already):
https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg08581.html
Thanks in advance!
Aleksandar
Quoted 48 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
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.
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Travis-CI:
https://travis-ci.org/github/philmd/qemu/builds/700461815Hi; I'm afraid there's a format-string issue here (manifests on OSX, openbsd, and 32-bit platforms):
/home/peter.maydell/qemu/hw/rx/rx-gdbsim.c: In function'
rx_gdbsim_init':Quoted 4 lines
Quoted 4 lines
/home/peter.maydell/qemu/hw/rx/rx-gdbsim.c:93:22: error: format '%lli' expects argument of type 'long long int', but argument 2 has type 'ram_addr_t{aka unsigned int}' [-Werror=format=]
error_report("Invalid RAM size, should be more than %" PRIi64" Bytes",
Quoted 20 lines
Quoted 3 lines
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mc->default_ram_size); ~~~~~~~~~~~~~~~~~~~~Also there appears to be a makefile/dependency bug somewhere, because when I drop this merge attempt and retry building with current master I get this error:
make[1]: Entering directory '
/home/petmay01/qemu-for-merges/slirp' make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/petmay01/qemu-for-merges/slirp'CC qga/main.o CC qemu-io.o CC monitor/qmp-cmds-control.omake: *** No rule to make target '
/home/petmay01/qemu-for-merges/hw/rx/Kconfig', needed by 'aarch64-softmmu/config-devices.mak'. Stop.
make: *** Waiting for unfinished jobs....
make: Leaving directory '/home/petmay01/qemu-for-merges/build/w64'Quoted 4 lines
This seems to be because aarch64-softmmu/config-devices.mak.d in the build tree says that aarch64-softmmu/config-devices.mak depends on all the
Kconfigfiles; this means that if aKconfigfile gets deleted then incremental build stops working?This seems the same problem previously discussed here:
https://www.mail-archive.com/[email protected]/msg676319.html
понедељак, 22. јун 2020., Aleksandar Markovic <
[email protected]> је написао/ла:
Quoted 22 lines
понедељак, 22. јун 2020., Philippe Mathieu-Daudé <[email protected]> је написао/ла:
Quoted 14 lines
+Thomas
Quoted 1 line · Peter Maydell
On Mon, 22 Jun 2020 at 17:01, Peter Maydell <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
On Sun, 21 Jun 2020 at 13:50, Philippe Mathieu-Daudé <[email protected]>
Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 6 lines
Renesas hardware patches
- Add a common entry for Renesas hardware in
MAINTAINERS
- Trivial SH4 cleanups
- Add RX GDB simulator from Yoshinori Sato
Quoted 6 lines
Can this rx patch be included in this pull request: (it was r-b-ed a couple of weeks ago already):
https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg08581.html
R-b by Richard is here:
https://lists.gnu.org/archive/html/qemu-devel/2020-06/msg00229.html
The two messages are not directly connected on the list, since r-b was in June, and the patch was in May.
Quoted 55 lines
Thanks in advance!
Aleksandar
Quoted 48 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
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.
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Travis-CI:
https://travis-ci.org/github/philmd/qemu/builds/700461815Hi; I'm afraid there's a format-string issue here (manifests on OSX, openbsd, and 32-bit platforms):
/home/peter.maydell/qemu/hw/rx/rx-gdbsim.c: In function'
rx_gdbsim_init':Quoted 4 lines
Quoted 4 lines
/home/peter.maydell/qemu/hw/rx/rx-gdbsim.c:93:22: error: format '%lli' expects argument of type 'long long int', but argument 2 has type 'ram_addr_t{aka unsigned int}' [-Werror=format=]
error_report("Invalid RAM size, should be more than %" PRIi64" Bytes",
Quoted 20 lines
Quoted 3 lines
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mc->default_ram_size); ~~~~~~~~~~~~~~~~~~~~Also there appears to be a makefile/dependency bug somewhere, because when I drop this merge attempt and retry building with current master I get this error:
make[1]: Entering directory '
/home/petmay01/qemu-for-merges/slirp' make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/petmay01/qemu-for-merges/slirp'CC qga/main.o CC qemu-io.o CC monitor/qmp-cmds-control.omake: *** No rule to make target '
/home/petmay01/qemu-for-merges/hw/rx/Kconfig', needed by 'aarch64-softmmu/config-devices.mak'. Stop.
make: *** Waiting for unfinished jobs....
make: Leaving directory '/home/petmay01/qemu-for-merges/build/w64'Quoted 4 lines
This seems to be because aarch64-softmmu/config-devices.mak.d in the build tree says that aarch64-softmmu/config-devices.mak depends on all the
Kconfigfiles; this means that if aKconfigfile gets deleted then incremental build stops working?This seems the same problem previously discussed here:
https://www.mail-archive.com/[email protected]/msg676319.html
Hi Aleksandar,
Quoted 26 lines · Aleksandar Markovic
понедељак, 22. јун 2020., Aleksandar Markovic <[email protected] <mailto:[email protected]>> је написао/ла:
понедељак, 22. јун 2020., Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]>> је написао/ла:
+Thomas
On 6/22/20 6:19 PM, Peter Maydell wrote:
> On Mon, 22 Jun 2020 at 17:01, Peter Maydell <[email protected] <mailto:[email protected]>> wrote:
>>
>> On Sun, 21 Jun 2020 at 13:50, Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]>> wrote:
>>> Renesas hardware patches
>>>
>>> - Add a common entry for Renesas hardware inMAINTAINERS>>> - Trivial SH4 cleanups
>>> - Add RX GDB simulator from Yoshinori Sato
>>>
Quoted 5 lines
Can this rx patch be included in this pull request: (it was r-b-ed a couple of weeks ago already):
https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg08581.html
<https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg08581.html>
This pull request only contains hardware emulation patches (files under hw/, not the TCG code from target/).
Quoted 67 lines
R-b by Richard is here:
https://lists.gnu.org/archive/html/qemu-devel/2020-06/msg00229.html
The two messages are not directly connected on the list, since r-b was in June, and the patch was in May.
Thanks in advance!
Aleksandar
>>> 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. >>>
>>> Travis-CI:
>>> https://travis-ci.org/github/philmd/qemu/builds/700461815
<https://travis-ci.org/github/philmd/qemu/builds/700461815>
>>
>> Hi; I'm afraid there's a format-string issue here (manifests >> on OSX, openbsd, and 32-bit platforms):
>>
>>/home/peter.maydell/qemu/hw/rx/rx-gdbsim.c: In function 'rx_gdbsim_init':
>>/home/peter.maydell/qemu/hw/rx/rx-gdbsim.c:93:22: error:
format '%lli'
>> expects argument of type 'long long int', but argument 2 has type >> 'ram_addr_t{aka unsigned int}' [-Werror=format=]
>> error_report("Invalid RAM size, should be more than %" PRIi64 " Bytes",
>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> mc->default_ram_size);
>> ~~~~~~~~~~~~~~~~~~~~
>
> Also there appears to be a makefile/dependency bug somewhere, > because when I drop this merge attempt and retry building > with current master I get this error:
>
> make[1]: Entering directory '/home/petmay01/qemu-for-merges/slirp' > make[1]: Nothing to be done for 'all'.
> make[1]: Leaving directory '/home/petmay01/qemu-for-merges/slirp' > CCqga/main.o
> CC qemu-io.o
> CCmonitor/qmp-cmds-control.o
> make: *** No rule to make target
> '/home/petmay01/qemu-for-merges/hw/rx/Kconfig', needed by > 'aarch64-softmmu/config-devices.mak'. Stop.
> make: *** Waiting for unfinished jobs....
> make: Leaving directory '/home/petmay01/qemu-for-merges/build/w64' >
> This seems to be because aarch64-softmmu/config-devices.mak.d > in the build tree says that aarch64-softmmu/config-devices.mak > depends on all theKconfigfiles; this means that if aKconfig> file gets deleted then incremental build stops working?This seems the same problem previously discussed here:
https://www.mail-archive.com/[email protected]/msg676319.html <https://www.mail-archive.com/[email protected]/msg676319.html>
понедељак, 22. јун 2020., Philippe Mathieu-Daudé <[email protected]> је написао/ла:
Quoted 33 lines
Hi Aleksandar,
Quoted 14 lines · Aleksandar Markovic
понедељак, 22. јун 2020., Aleksandar Markovic <[email protected] <mailto:[email protected]>> је написао/ла:
понедељак, 22. јун 2020., Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]>> је написао/ла:
+Thomas
On 6/22/20 6:19 PM, Peter Maydell wrote:
> On Mon, 22 Jun 2020 at 17:01, Peter Maydell <[email protected] <mailto:[email protected]>>Quoted 15 lines · wrote:
>>
>> On Sun, 21 Jun 2020 at 13:50, Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]>> wrote:
>>> Renesas hardware patches
>>>
>>> - Add a common entry for Renesas hardware inMAINTAINERS>>> - Trivial SH4 cleanups
>>> - Add RX GDB simulator from Yoshinori Sato >>>Can this rx patch be included in this pull request: (it was r-b-ed a couple of weeks ago already):
Quoted 8 lines
Quoted 3 lines
https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg08581.html <https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg08581.htmlThis pull request only contains hardware emulation patches (files under hw/, not the TCG code from target/).
The patch in question affects system mode, therefore hardware emulation too. Not a big deal, but, to me, it seems as a natural part of this pull request. It is quite common that pull requests are not limited by directories - optimally, they should deal with certain set of related functionalities, not limited by directories. Why would be that patch be left lonesome? Could you please, Philippe, reconsider exclusion/inclusion of this patch, if possible?
Thanks, Aleksandar
Quoted 76 lines
R-b by Richard is here:
Quoted 8 lines
https://lists.gnu.org/archive/html/qemu-devel/2020-06/msg00229.html
The two messages are not directly connected on the list, since r-b was in June, and the patch was in May.
Quoted 8 lines
Thanks in advance!
Aleksandar
>>> The Renesas RX target emulation was added in commit
c8c35e5f51,Quoted 11 lines
>>> 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. >>> >>> Travis-CI: >>> https://travis-ci.org/github/philmd/qemu/builds/700461815 <https://travis-ci.org/github/philmd/qemu/builds/700461815> >>Quoted 8 lines
>> Hi; I'm afraid there's a format-string issue here (manifests >> on OSX, openbsd, and 32-bit platforms): >> >> /home/peter.maydell/qemu/hw/rx/rx-gdbsim.c: In function 'rx_gdbsim_init': >> /home/peter.maydell/qemu/hw/rx/rx-gdbsim.c:93:22: error: format '%lli' >> expects argument of type 'long long int', but argument 2 hastype
Quoted 4 lines
>> '
ram_addr_t{aka unsigned int}' [-Werror=format=]
>> error_report("Invalid RAM size, should be more than
%" PRIi64 " Bytes",
>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 8 lines
>>
mc->default_ram_size);
>> ~~~~~~~~~~~~~~~~~~~~
>
> Also there appears to be a makefile/dependency bug somewhere, > because when I drop this merge attempt and retry building > with current master I get this error:
>
> make[1]: Entering directory '/home/petmay01/qemu-for-merges/slirp'
Quoted 2 lines
> make[1]: Nothing to be done for 'all'.
> make[1]: Leaving directory '/home/petmay01/qemu-for-merges/slirp'
Quoted 8 lines
> CC qga/main.o > CC qemu-io.o > CC monitor/qmp-cmds-control.o> make: *** No rule to make target
> '/home/petmay01/qemu-for-merges/hw/rx/Kconfig', needed by > 'aarch64-softmmu/config-devices.mak'. Stop.
> make: *** Waiting for unfinished jobs....
> make: Leaving directory '/home/petmay01/qemu-for-merges/build/w64'
Quoted 8 lines
>
> This seems to be because aarch64-softmmu/config-devices.mak.d > in the build tree says that aarch64-softmmu/config-devices.mak > depends on all theKconfigfiles; this means that if aKconfig> file gets deleted then incremental build stops working?This seems the same problem previously discussed here:
https://www.mail-archive.com/[email protected]/msg676319.html <https://www.mail-archive.com/[email protected]/
msg676319.html>Quoted 1 line
Quoted 33 lines · Peter Maydell
Quoted 20 lines · Philippe Mathieu-Daudé
The following changes since commit
06c4cc3660b366278bdc7bc8b6677032d7b1118c:qht: Fix threshold rate calculation (2020-06-19 18:29:11 +0100)
are available in the Git repository at:
https://gitlab.com/philmd/qemu.git tags/renesas-hw-20200621
for you to fetch changes up to
730101266e4026fc19808c740ee4b8118eeaaafe:docs: Document the RX target (2020-06-21 01:21:47 +0200)
----------------------------------------------------------------
Renesas hardware patches- Add a common entry for Renesas hardware in
MAINTAINERS
- Trivial SH4 cleanups
- Add RX GDB simulator from Yoshinori SatoQuoted 8 lines
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.
Travis-CI:
https://travis-ci.org/github/philmd/qemu/builds/700461815Hi; I'm afraid there's a format-string issue here (manifests on OSX, openbsd, and 32-bit platforms):
Quoted 8 lines
/home/peter.maydell/qemu/hw/rx/rx-gdbsim.c: In function 'rx_gdbsim_init':/home/peter.maydell/qemu/hw/rx/rx-gdbsim.c:93:22: error: format '%lli' expects argument of type 'long long int', but argument 2 has type 'ram_addr_t{aka unsigned int}' [-Werror=format=]error_report("Invalid RAM size, should be more than %" PRIi64 " Bytes", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mc->default_ram_size); ~~~~~~~~~~~~~~~~~~~~
I apologize, I missed that while rebasing on Igor's memdev work. I disabled my obsd and win32 builds after they started to fail few months ago and forgot to re-enable them after they were fixed.
We recently dropped the Travis-CI OSX builds (commit 22a231950) in favor of Cirrus-CI. There the build succeeded (Mojave):
https://cirrus-ci.com/build/6678899172048896
What is different in your OSX setup?
I'll respin with:
-- >8 --
hw/rx/rx-gdbsim.c +1 -1
@@ -17,6 +17,7 @@*/ #include "qemu/osdep.h" +#include "qemu/cutils.h" #include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h"
@@ -90,8 +91,9 @@ static void rx_gdbsim_init(MachineState *machine)const char *dtb_filename = machine->dtb;if (machine->ram_size < mc->default_ram_size) { - error_report("Invalid RAM size, should be more than %" PRIi64 "
Bytes",
- mc->default_ram_size);
+ char *sz = size_to_str(mc->default_ram_size);
+ error_report("Invalid RAM size, should be more than %s", sz);
+ g_free(sz);
}
/* Allocate memory space */---