* [Qemu-devel] [PATCH 1/6] hw/dma/puv3_dma: Convert from DPRINTF() macro to trace event
2018-12-12 17:30 [Qemu-devel] [PATCH 0/6] unicore32/puv3: Convert from DPRINTF() macro to trace event Laurent Vivier
@ 2018-12-12 17:30 ` Laurent Vivier
2018-12-12 17:30 ` [Qemu-devel] [PATCH 2/6] hw/dma/puv3_gpio: " Laurent Vivier
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2018-12-12 17:30 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, qemu-trivial, Guan Xuetao,
Michael Tokarev, Laurent Vivier
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
hw/dma/puv3_dma.c | 11 +++++------
hw/dma/trace-events | 6 ++++++
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/hw/dma/puv3_dma.c b/hw/dma/puv3_dma.c
index b97a6c1767..38ebb3f307 100644
--- a/hw/dma/puv3_dma.c
+++ b/hw/dma/puv3_dma.c
@@ -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 = {
diff --git a/hw/dma/trace-events b/hw/dma/trace-events
index 22f53d0ff2..56d4f5a32a 100644
--- a/hw/dma/trace-events
+++ b/hw/dma/trace-events
@@ -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
--
2.19.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* [Qemu-devel] [PATCH 2/6] hw/dma/puv3_gpio: Convert from DPRINTF() macro to trace event
2018-12-12 17:30 [Qemu-devel] [PATCH 0/6] unicore32/puv3: Convert from DPRINTF() macro to trace event Laurent Vivier
2018-12-12 17:30 ` [Qemu-devel] [PATCH 1/6] hw/dma/puv3_dma: " Laurent Vivier
@ 2018-12-12 17:30 ` Laurent Vivier
2018-12-12 17:30 ` [Qemu-devel] [PATCH 3/6] hw/dma/puv3_intc: " Laurent Vivier
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2018-12-12 17:30 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, qemu-trivial, Guan Xuetao,
Michael Tokarev, Laurent Vivier
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
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
diff --git a/Makefile.objs b/Makefile.objs
index 1e1ff387d7..fbc3bad1e1 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -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
diff --git a/hw/gpio/puv3_gpio.c b/hw/gpio/puv3_gpio.c
index 445afccf9f..1b52b2c291 100644
--- a/hw/gpio/puv3_gpio.c
+++ b/hw/gpio/puv3_gpio.c
@@ -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);
}
}
diff --git a/hw/gpio/trace-events b/hw/gpio/trace-events
new file mode 100644
index 0000000000..5708899a79
--- /dev/null
+++ b/hw/gpio/trace-events
@@ -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"
--
2.19.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* [Qemu-devel] [PATCH 3/6] hw/dma/puv3_intc: Convert from DPRINTF() macro to trace event
2018-12-12 17:30 [Qemu-devel] [PATCH 0/6] unicore32/puv3: Convert from DPRINTF() macro to trace event Laurent Vivier
2018-12-12 17:30 ` [Qemu-devel] [PATCH 1/6] hw/dma/puv3_dma: " Laurent Vivier
2018-12-12 17:30 ` [Qemu-devel] [PATCH 2/6] hw/dma/puv3_gpio: " Laurent Vivier
@ 2018-12-12 17:30 ` Laurent Vivier
2018-12-12 17:30 ` [Qemu-devel] [PATCH 4/6] hw/misc/puv3_pm: " Laurent Vivier
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2018-12-12 17:30 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, qemu-trivial, Guan Xuetao,
Michael Tokarev, Laurent Vivier
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
hw/intc/puv3_intc.c | 13 ++++++-------
hw/intc/trace-events | 7 +++++++
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/hw/intc/puv3_intc.c b/hw/intc/puv3_intc.c
index ef8488aacc..6c1f36bba6 100644
--- a/hw/intc/puv3_intc.c
+++ b/hw/intc/puv3_intc.c
@@ -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);
diff --git a/hw/intc/trace-events b/hw/intc/trace-events
index 7769869a13..e42d0cfb2d 100644
--- a/hw/intc/trace-events
+++ b/hw/intc/trace-events
@@ -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"
--
2.19.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* [Qemu-devel] [PATCH 4/6] hw/misc/puv3_pm: Convert from DPRINTF() macro to trace event
2018-12-12 17:30 [Qemu-devel] [PATCH 0/6] unicore32/puv3: Convert from DPRINTF() macro to trace event Laurent Vivier
` (2 preceding siblings ...)
2018-12-12 17:30 ` [Qemu-devel] [PATCH 3/6] hw/dma/puv3_intc: " Laurent Vivier
@ 2018-12-12 17:30 ` Laurent Vivier
2018-12-12 17:30 ` [Qemu-devel] [PATCH 5/6] hw/timer/puv3_ost: " Laurent Vivier
2018-12-12 17:30 ` [Qemu-devel] [PATCH 6/6] unicore32/puv3: remove definition of DPRINTF Laurent Vivier
5 siblings, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2018-12-12 17:30 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, qemu-trivial, Guan Xuetao,
Michael Tokarev, Laurent Vivier
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
hw/misc/puv3_pm.c | 11 +++++------
hw/misc/trace-events | 6 ++++++
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/hw/misc/puv3_pm.c b/hw/misc/puv3_pm.c
index 577cebaac7..4db7b1c22a 100644
--- a/hw/misc/puv3_pm.c
+++ b/hw/misc/puv3_pm.c
@@ -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 = {
diff --git a/hw/misc/trace-events b/hw/misc/trace-events
index 52466c77c4..d17a52c91d 100644
--- a/hw/misc/trace-events
+++ b/hw/misc/trace-events
@@ -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
--
2.19.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* [Qemu-devel] [PATCH 5/6] hw/timer/puv3_ost: Convert from DPRINTF() macro to trace event
2018-12-12 17:30 [Qemu-devel] [PATCH 0/6] unicore32/puv3: Convert from DPRINTF() macro to trace event Laurent Vivier
` (3 preceding siblings ...)
2018-12-12 17:30 ` [Qemu-devel] [PATCH 4/6] hw/misc/puv3_pm: " Laurent Vivier
@ 2018-12-12 17:30 ` Laurent Vivier
2018-12-12 17:30 ` [Qemu-devel] [PATCH 6/6] unicore32/puv3: remove definition of DPRINTF Laurent Vivier
5 siblings, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2018-12-12 17:30 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, qemu-trivial, Guan Xuetao,
Michael Tokarev, Laurent Vivier
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
hw/timer/puv3_ost.c | 14 ++++++--------
hw/timer/trace-events | 7 +++++++
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/hw/timer/puv3_ost.c b/hw/timer/puv3_ost.c
index 0b3d717e60..387b7a9bd1 100644
--- a/hw/timer/puv3_ost.c
+++ b/hw/timer/puv3_ost.c
@@ -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) {
diff --git a/hw/timer/trace-events b/hw/timer/trace-events
index 75bd3b1042..c504fd52c0 100644
--- a/hw/timer/trace-events
+++ b/hw/timer/trace-events
@@ -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!"
--
2.19.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* [Qemu-devel] [PATCH 6/6] unicore32/puv3: remove definition of DPRINTF
2018-12-12 17:30 [Qemu-devel] [PATCH 0/6] unicore32/puv3: Convert from DPRINTF() macro to trace event Laurent Vivier
` (4 preceding siblings ...)
2018-12-12 17:30 ` [Qemu-devel] [PATCH 5/6] hw/timer/puv3_ost: " Laurent Vivier
@ 2018-12-12 17:30 ` Laurent Vivier
5 siblings, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2018-12-12 17:30 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, qemu-trivial, Guan Xuetao,
Michael Tokarev, Laurent Vivier
As previous patches have removed the use of DPRINTF from puv3 files,
we can remove the definition from puv3.h
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
include/hw/unicore32/puv3.h | 7 -------
1 file changed, 7 deletions(-)
diff --git a/include/hw/unicore32/puv3.h b/include/hw/unicore32/puv3.h
index f587a1f622..a876f21dfb 100644
--- a/include/hw/unicore32/puv3.h
+++ b/include/hw/unicore32/puv3.h
@@ -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 */
--
2.19.2
^ permalink raw reply related [flat|nested] 7+ messages in thread