unicore32/puv3: Convert from DPRINTF() macro to trace event
cover unicore32/puv3: Convert from DPRINTF() macro to trace event
Remove the definition of DPRINTF() in include/hw/unicore32/puv3.h and convert to trace event all the puv3_*.c files.
Compile tested but I didn't find any unicore32 kernel to test the trace output.
Laurent Vivier (6):
hw/dma/puv3_dma: Convert from DPRINTF() macro to trace event hw/dma/puv3_gpio: Convert from DPRINTF() macro to trace event hw/dma/puv3_intc: Convert from DPRINTF() macro to trace event hw/misc/puv3_pm: Convert from DPRINTF() macro to trace event hw/timer/puv3_ost: Convert from DPRINTF() macro to trace event unicore32/puv3: remove definition of DPRINTF
Makefile.objs | 1 + hw/dma/puv3_dma.c | 11 +++++------ hw/dma/trace-events | 6 ++++++ hw/gpio/puv3_gpio.c | 15 +++++++-------- hw/gpio/trace-events | 6 ++++++ hw/intc/puv3_intc.c | 13 ++++++------- hw/intc/trace-events | 7 +++++++ hw/misc/puv3_pm.c | 11 +++++------ hw/misc/trace-events | 6 ++++++ hw/timer/puv3_ost.c | 14 ++++++-------- hw/timer/trace-events | 7 +++++++ include/hw/unicore32/puv3.h | 7 ------- 12 files changed, 62 insertions(+), 42 deletions(-) create mode 100644 hw/gpio/trace-events
Signature · 1 line
2.19.2
PATCH 1/6 hw/dma/puv3_dma: Convert from DPRINTF() macro to trace event
--- hw/dma/puv3_dma.c | 11 +++++------ hw/dma/trace-events | 6 ++++++ 2 files changed, 11 insertions(+), 6 deletions(-)
hw/dma/puv3_dma.c +5 -6
@@ -11,9 +11,8 @@#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/sysbus.h" - -#undef DEBUG_PUV3#include "hw/unicore32/puv3.h" +#include "trace.h" #define PUV3_DMA_CH_NR (6)#define PUV3_DMA_CH_MASK (0xff)
@@ -42,9 +41,9 @@ static uint64_t puv3_dma_read(void *opaque, hwaddr offset, ret = s->reg_CFG[PUV3_DMA_CH (offset)];break ;default : -DPRINTF ("Bad offset 0x%x\n" , offset); +trace_puv3_dma_read_bad (offset); } -DPRINTF ("offset 0x%x, value 0x%x\n" , offset, ret); +trace_puv3_dma_read (offset, ret);return ret; }
@@ -61,9 +60,9 @@ static void puv3_dma_write(void *opaque, hwaddr offset, s->reg_CFG[PUV3_DMA_CH (offset)] = value;break ;default : -DPRINTF ("Bad offset 0x%x\n" , offset); +trace_puv3_dma_write_bad (offset); } -DPRINTF ("offset 0x%x, value 0x%x\n" , offset, value); +trace_puv3_dma_write (offset, value); }static const MemoryRegionOps puv3_dma_ops = {
hw/dma/trace-events +6 -0
@@ -20,3 +20,9 @@ sparc32_dma_enable_lower(void) "Lower DMA enable" # hw/dma/i8257.c i8257_unregistered_dma(int nchan, int dma_pos, int dma_len) "unregistered DMA channel used nchan=%d dma_pos=%d dma_len=%d" + +# hw/dma/puv3_dma.c +puv3_dma_read_bad(unsigned offset) "Bad offset 0x%x" +puv3_dma_read(unsigned offset, uint32_t value) "offset 0x%x, value 0x%x" +puv3_dma_write_bad(unsigned offset) "Bad offset 0x%x" +puv3_dma_write(unsigned offset, uint64_t value) "offset 0x%x, value 0x%" PRIx64
Signature · 1 line
2.19.2
PATCH 2/6 hw/dma/puv3_gpio: Convert from DPRINTF() macro to trace event
In reply to Laurent Vivier--- Makefile.objs | 1 + hw/gpio/puv3_gpio.c | 15 +++++++-------- hw/gpio/trace-events | 6 ++++++ 3 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 hw/gpio/trace-events
Makefile.objs +1 -0
@@ -243,6 +243,7 @@ trace-events-subdirs += hw/vfio trace-events-subdirs += hw/virtio trace-events-subdirs += hw/watchdog trace-events-subdirs += hw/xen +trace-events-subdirs += hw/gpio trace-events-subdirs += io trace-events-subdirs += linux-user trace-events-subdirs += migration
hw/gpio/puv3_gpio.c +7 -8
@@ -11,9 +11,8 @@#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/sysbus.h" - -#undef DEBUG_PUV3#include "hw/unicore32/puv3.h" +#include "trace.h" #define TYPE_PUV3_GPIO "puv3_gpio"#define PUV3_GPIO (obj) OBJECT_CHECK(PUV3GPIOState, (obj), TYPE_PUV3_GPIO)
@@ -46,9 +45,9 @@ static uint64_t puv3_gpio_read(void *opaque, hwaddr offset, ret = s->reg_GPIR;break ;default : -DPRINTF ("Bad offset 0x%x\n" , offset); +trace_puv3_gpio_read_bad (offset); } -DPRINTF ("offset 0x%x, value 0x%x\n" , offset, ret); +trace_puv3_gpio_read (offset, ret);return ret; }
@@ -58,7 +57,7 @@ static void puv3_gpio_write(void *opaque, hwaddr offset, {PUV3GPIOState *s = opaque; -DPRINTF ("offset 0x%x, value 0x%x\n" , offset, value); +trace_puv3_gpio_write (offset, value);switch (offset) {case 0x04 : s->reg_GPDR = value;
@@ -67,14 +66,14 @@ static void puv3_gpio_write(void *opaque, hwaddr offset,if (s->reg_GPDR & value) { s->reg_GPLR |= value; }else { -DPRINTF ("Write gpio input port error!" ); +trace_puv3_gpio_write_error (); }break ;case 0x0c :if (s->reg_GPDR & value) { s->reg_GPLR &= ~value; }else { -DPRINTF ("Write gpio input port error!" ); +trace_puv3_gpio_write_error (); }break ;case 0x10 :/* GRER */
@@ -85,7 +84,7 @@ static void puv3_gpio_write(void *opaque, hwaddr offset, s->reg_GPIR = value;break ;default : -DPRINTF ("Bad offset 0x%x\n" , offset); +trace_puv3_gpio_write_bad (offset); } }
hw/gpio/trace-events new file +6 -0
@@ -0,0 +1,6 @@ +# hw/gpio/puv3_gpio.c +puv3_gpio_read_bad(unsigned offset) "Bad offset 0x%x" +puv3_gpio_read(unsigned offset, uint32_t value) "offset 0x%x, value 0x%x" +puv3_gpio_write(unsigned offset, uint64_t value) "offset 0x%x, value 0x%" PRIx64 +puv3_gpio_write_error(void) "Write gpio input port error!" +puv3_gpio_write_bad(unsigned offset) "Bad offset 0x%x"
Signature · 1 line
2.19.2
PATCH 3/6 hw/dma/puv3_intc: Convert from DPRINTF() macro to trace event
In reply to Laurent Vivier--- hw/intc/puv3_intc.c | 13 ++++++------- hw/intc/trace-events | 7 +++++++ 2 files changed, 13 insertions(+), 7 deletions(-)
hw/intc/puv3_intc.c +6 -7
@@ -10,9 +10,8 @@*/ #include "qemu/osdep.h" #include "hw/sysbus.h" - -#undef DEBUG_PUV3#include "hw/unicore32/puv3.h" +#include "trace.h" #define TYPE_PUV3_INTC "puv3_intc"#define PUV3_INTC (obj) OBJECT_CHECK(PUV3INTCState, (obj), TYPE_PUV3_INTC)
@@ -42,7 +41,7 @@ static void puv3_intc_handler(void *opaque, int irq, int level) {PUV3INTCState *s = opaque; -DPRINTF ("irq 0x%x, level 0x%x\n" , irq, level); +trace_puv3_intc_handler (irq, level);if (level) { s->reg_ICPR |= (1 << irq); }else {
@@ -65,9 +64,9 @@ static uint64_t puv3_intc_read(void *opaque, hwaddr offset, ret = s->reg_ICPR;/* the same value with ICPR */ break ;default : -DPRINTF ("Bad offset %x\n" , (int )offset); +trace_puv3_intc_read_bad (offset); } -DPRINTF ("offset 0x%x, value 0x%x\n" , offset, ret); +trace_puv3_intc_read (offset, ret);return ret; }
@@ -76,7 +75,7 @@ static void puv3_intc_write(void *opaque, hwaddr offset, {PUV3INTCState *s = opaque; -DPRINTF ("offset 0x%x, value 0x%x\n" , offset, value); +trace_puv3_intc_write (offset, value);switch (offset) {case 0x00 :/* INTC_ICLR */ case 0x14 :/* INTC_ICCR */
@@ -85,7 +84,7 @@ static void puv3_intc_write(void *opaque, hwaddr offset, s->reg_ICMR = value;break ;default : -DPRINTF ("Bad offset 0x%x\n" , (int )offset); +trace_puv3_intc_write_bad (offset);return ; }puv3_intc_update (s);
hw/intc/trace-events +7 -0
@@ -200,3 +200,10 @@ nvic_sysreg_write(uint64_t addr, uint32_t value, unsigned size) "NVIC sysreg wri heathrow_write(uint64_t addr, unsigned int n, uint64_t value) "0x%"PRIx64" %u: 0x%"PRIx64 heathrow_read(uint64_t addr, unsigned int n, uint64_t value) "0x%"PRIx64" %u: 0x%"PRIx64 heathrow_set_irq(int num, int level) "set_irq: num=0x%02x level=%d" + +# hw/intc/puv3_intc.c +puv3_intc_handler(int irq, int level) "irq 0x%x, level 0x%x" +puv3_intc_read_bad(uint32_t offset) "Bad offset 0x%x" +puv3_intc_read(uint32_t offset, uint32_t value) "offset 0x%x, value 0x%x" +puv3_intc_write(uint32_t offset, uint64_t value) "offset 0x%x, value 0x%" PRIx64 +puv3_intc_write_bad(uint32_t offset) "Bad offset 0x%x"
Signature · 1 line
2.19.2
PATCH 4/6 hw/misc/puv3_pm: Convert from DPRINTF() macro to trace event
In reply to Laurent Vivier--- hw/misc/puv3_pm.c | 11 +++++------ hw/misc/trace-events | 6 ++++++ 2 files changed, 11 insertions(+), 6 deletions(-)
hw/misc/puv3_pm.c +5 -6
@@ -11,9 +11,8 @@#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/sysbus.h" - -#undef DEBUG_PUV3#include "hw/unicore32/puv3.h" +#include "trace.h" #define TYPE_PUV3_PM "puv3_pm"#define PUV3_PM (obj) OBJECT_CHECK(PUV3PMState, (obj), TYPE_PUV3_PM)
@@ -72,9 +71,9 @@ static uint64_t puv3_pm_read(void *opaque, hwaddr offset, ret =0x7 ;break ;default : -DPRINTF ("Bad offset 0x%x\n" , offset); +trace_puv3_pm_read_bad (offset); } -DPRINTF ("offset 0x%x, value 0x%x\n" , offset, ret); +trace_puv3_pm_read (offset, ret);return ret; }
@@ -104,9 +103,9 @@ static void puv3_pm_write(void *opaque, hwaddr offset,case 0x38 :break ;default : -DPRINTF ("Bad offset 0x%x\n" , offset); +trace_puv3_pm_write_bad (offset); } -DPRINTF ("offset 0x%x, value 0x%x\n" , offset, value); +trace_puv3_pm_write (offset, value); }static const MemoryRegionOps puv3_pm_ops = {
hw/misc/trace-events +6 -0
@@ -132,3 +132,9 @@ iotkit_sysinfo_write(uint64_t offset, uint64_t data, unsigned size) "IoTKit SysI iotkit_sysctl_read(uint64_t offset, uint64_t data, unsigned size) "IoTKit SysCtl read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" iotkit_sysctl_write(uint64_t offset, uint64_t data, unsigned size) "IoTKit SysCtl write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" iotkit_sysctl_reset(void) "IoTKit SysCtl: reset" + +# hw/misc/puv3_pm.c +puv3_pm_read_bad(uint32_t offset) "Bad offset 0x%x" +puv3_pm_read(uint32_t offset, uint32_t value) "offset 0x%x, value 0x%x" +puv3_pm_write_bad(uint32_t offset) "Bad offset 0x%x" +puv3_pm_write(uint32_t offset, uint64_t value) "offset 0x%x, value 0x%" PRIx64
Signature · 1 line
2.19.2
PATCH 5/6 hw/timer/puv3_ost: Convert from DPRINTF() macro to trace event
In reply to Laurent Vivier--- hw/timer/puv3_ost.c | 14 ++++++-------- hw/timer/trace-events | 7 +++++++ 2 files changed, 13 insertions(+), 8 deletions(-)
hw/timer/puv3_ost.c +6 -8
@@ -12,9 +12,8 @@#include "hw/sysbus.h" #include "hw/ptimer.h" #include "qemu/main-loop.h" - -#undef DEBUG_PUV3#include "hw/unicore32/puv3.h" +#include "trace.h" #define TYPE_PUV3_OST "puv3_ost"#define PUV3_OST (obj) OBJECT_CHECK(PUV3OSTState, (obj), TYPE_PUV3_OST)
@@ -51,9 +50,9 @@ static uint64_t puv3_ost_read(void *opaque, hwaddr offset, ret = s->reg_OIER;break ;default : -DPRINTF ("Bad offset %x\n" , (int )offset); +trace_puv3_ost_read_bad (offset); } -DPRINTF ("offset 0x%x, value 0x%x\n" , offset, ret); +trace_puv3_ost_read (offset, ret);return ret; }
@@ -62,7 +61,7 @@ static void puv3_ost_write(void *opaque, hwaddr offset, {PUV3OSTState *s = opaque; -DPRINTF ("offset 0x%x, value 0x%x\n" , offset, value); +trace_puv3_ost_write (offset, value);switch (offset) {case 0x00 :/* Match Register 0 */ s->reg_OSMR0 = value;
@@ -85,7 +84,7 @@ static void puv3_ost_write(void *opaque, hwaddr offset, s->reg_OIER = value;break ;default : -DPRINTF ("Bad offset %x\n" , (int )offset); +trace_puv3_ost_write_bad (offset); } }
@@ -103,8 +102,7 @@ static void puv3_ost_tick(void *opaque) {PUV3OSTState *s = opaque; -DPRINTF ("ost hit when ptimer counter from 0x%x to 0x%x!\n" , - s->reg_OSCR, s->reg_OSMR0); +trace_puv3_ost_tick (s->reg_OSCR, s->reg_OSMR0); s->reg_OSCR = s->reg_OSMR0;if (s->reg_OIER) {
hw/timer/trace-events +7 -0
@@ -72,3 +72,10 @@ sun4v_rtc_write(uint64_t addr, uint64_t value) "write: addr 0x%" PRIx64 " value # hw/timer/xlnx-zynqmp-rtc.c xlnx_zynqmp_rtc_gettime(int year, int month, int day, int hour, int min, int sec) "Get time from host: %d-%d-%d %2d:%02d:%02d" + +# hw/timer/puv3_ost.c +puv3_ost_read_bad(uint32_t offset) "Bad offset 0x%x" +puv3_ost_read(uint32_t offset, uint32_t value) "offset 0x%x, value 0x%x" +puv3_ost_write(uint32_t offset, uint64_t value) "offset 0x%x, value 0x%" PRIx64 +puv3_ost_write_bad(uint32_t offset) "Bad offset 0x%x" +puv3_ost_tick(uint32_t oscr, uint32_t osmr0) "ost hit when ptimer counter from 0x%x to 0x%x!"
Signature · 1 line
2.19.2
PATCH 6/6 unicore32/puv3: remove definition of DPRINTF
In reply to Laurent VivierAs previous patches have removed the use of DPRINTF from puv3 files, we can remove the definition from puv3.h
--- include/hw/unicore32/puv3.h | 7 ------- 1 file changed, 7 deletions(-)
include/hw/unicore32/puv3.h +0 -7
@@ -30,11 +30,4 @@#define PUV3_IRQS_PS2_AUX (23)#define PUV3_IRQS_OST0 (26) -/* All puv3_*.c use DPRINTF for debug. */ -#ifdef DEBUG_PUV3 -#define DPRINTF (fmt, ...) printf("%s: " fmt , __func__, ## __VA_ARGS__) -#else -#define DPRINTF (fmt, ...) do {} while (0) -#endif -#endif /* QEMU_HW_PUV3_H */
Signature · 1 line
2.19.2