* [PATCH v2 0/4] Trivial ARM changes
@ 2024-11-03 14:33 Bernhard Beschow
2024-11-03 14:33 ` [PATCH v2 1/4] hw/rtc/ds1338: Trace send and receive operations Bernhard Beschow
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Bernhard Beschow @ 2024-11-03 14:33 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrangé, Peter Maydell, Marc-André Lureau,
Paolo Bonzini, Jean-Christophe Dubois, qemu-arm, Michael Tokarev,
Laurent Vivier, qemu-trivial, Philippe Mathieu-Daudé,
Bernhard Beschow
This series improves the tracing experience in three devices used in ARM
context. It also removes a duplicate statement in an IMX watchdog.
v2:
* Fix format strings in trace events for imx_gpt (Phil)
* Add patch for tmp105 which improves tracing
Bernhard Beschow (4):
hw/rtc/ds1338: Trace send and receive operations
hw/timer/imx_gpt: Convert DPRINTF to trace events
hw/watchdog/wdt_imx2: Remove redundant assignment
hw/sensor/tmp105: Convert printf() to trace event, add tracing for
read/write access
meson.build | 1 +
hw/sensor/trace.h | 1 +
hw/rtc/ds1338.c | 6 ++++++
hw/sensor/tmp105.c | 7 ++++++-
hw/timer/imx_gpt.c | 18 +++++-------------
hw/watchdog/wdt_imx2.c | 1 -
hw/rtc/trace-events | 4 ++++
hw/sensor/trace-events | 6 ++++++
hw/timer/trace-events | 6 ++++++
9 files changed, 35 insertions(+), 15 deletions(-)
create mode 100644 hw/sensor/trace.h
create mode 100644 hw/sensor/trace-events
--
2.47.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/4] hw/rtc/ds1338: Trace send and receive operations
2024-11-03 14:33 [PATCH v2 0/4] Trivial ARM changes Bernhard Beschow
@ 2024-11-03 14:33 ` Bernhard Beschow
2024-11-03 14:33 ` [PATCH v2 2/4] hw/timer/imx_gpt: Convert DPRINTF to trace events Bernhard Beschow
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Bernhard Beschow @ 2024-11-03 14:33 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrangé, Peter Maydell, Marc-André Lureau,
Paolo Bonzini, Jean-Christophe Dubois, qemu-arm, Michael Tokarev,
Laurent Vivier, qemu-trivial, Philippe Mathieu-Daudé,
Bernhard Beschow
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
hw/rtc/ds1338.c | 6 ++++++
hw/rtc/trace-events | 4 ++++
2 files changed, 10 insertions(+)
diff --git a/hw/rtc/ds1338.c b/hw/rtc/ds1338.c
index a5fe221418..929a92f7bd 100644
--- a/hw/rtc/ds1338.c
+++ b/hw/rtc/ds1338.c
@@ -17,6 +17,7 @@
#include "qemu/module.h"
#include "qom/object.h"
#include "sysemu/rtc.h"
+#include "trace.h"
/* Size of NVRAM including both the user-accessible area and the
* secondary register area.
@@ -126,6 +127,9 @@ static uint8_t ds1338_recv(I2CSlave *i2c)
uint8_t res;
res = s->nvram[s->ptr];
+
+ trace_ds1338_recv(s->ptr, res);
+
inc_regptr(s);
return res;
}
@@ -134,6 +138,8 @@ static int ds1338_send(I2CSlave *i2c, uint8_t data)
{
DS1338State *s = DS1338(i2c);
+ trace_ds1338_send(s->ptr, data);
+
if (s->addr_byte) {
s->ptr = data & (NVRAM_SIZE - 1);
s->addr_byte = false;
diff --git a/hw/rtc/trace-events b/hw/rtc/trace-events
index ebb311a5b0..8012afe102 100644
--- a/hw/rtc/trace-events
+++ b/hw/rtc/trace-events
@@ -22,6 +22,10 @@ pl031_set_alarm(uint32_t ticks) "alarm set for %u ticks"
aspeed_rtc_read(uint64_t addr, uint64_t value) "addr 0x%02" PRIx64 " value 0x%08" PRIx64
aspeed_rtc_write(uint64_t addr, uint64_t value) "addr 0x%02" PRIx64 " value 0x%08" PRIx64
+# ds1338.c
+ds1338_recv(uint32_t addr, uint8_t value) "[0x%" PRIx32 "] -> 0x%02" PRIx8
+ds1338_send(uint32_t addr, uint8_t value) "[0x%" PRIx32 "] <- 0x%02" PRIx8
+
# m48t59.c
m48txx_nvram_io_read(uint64_t addr, uint64_t value) "io read addr:0x%04" PRIx64 " value:0x%02" PRIx64
m48txx_nvram_io_write(uint64_t addr, uint64_t value) "io write addr:0x%04" PRIx64 " value:0x%02" PRIx64
--
2.47.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 2/4] hw/timer/imx_gpt: Convert DPRINTF to trace events
2024-11-03 14:33 [PATCH v2 0/4] Trivial ARM changes Bernhard Beschow
2024-11-03 14:33 ` [PATCH v2 1/4] hw/rtc/ds1338: Trace send and receive operations Bernhard Beschow
@ 2024-11-03 14:33 ` Bernhard Beschow
2024-11-03 14:33 ` [PATCH v2 3/4] hw/watchdog/wdt_imx2: Remove redundant assignment Bernhard Beschow
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Bernhard Beschow @ 2024-11-03 14:33 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrangé, Peter Maydell, Marc-André Lureau,
Paolo Bonzini, Jean-Christophe Dubois, qemu-arm, Michael Tokarev,
Laurent Vivier, qemu-trivial, Philippe Mathieu-Daudé,
Bernhard Beschow
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
hw/timer/imx_gpt.c | 18 +++++-------------
hw/timer/trace-events | 6 ++++++
2 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/hw/timer/imx_gpt.c b/hw/timer/imx_gpt.c
index 23b3d79bdb..2663a9d9ef 100644
--- a/hw/timer/imx_gpt.c
+++ b/hw/timer/imx_gpt.c
@@ -18,19 +18,12 @@
#include "migration/vmstate.h"
#include "qemu/module.h"
#include "qemu/log.h"
+#include "trace.h"
#ifndef DEBUG_IMX_GPT
#define DEBUG_IMX_GPT 0
#endif
-#define DPRINTF(fmt, args...) \
- do { \
- if (DEBUG_IMX_GPT) { \
- fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX_GPT, \
- __func__, ##args); \
- } \
- } while (0)
-
static const char *imx_gpt_reg_name(uint32_t reg)
{
switch (reg) {
@@ -145,7 +138,7 @@ static void imx_gpt_set_freq(IMXGPTState *s)
s->freq = imx_ccm_get_clock_frequency(s->ccm,
s->clocks[clksrc]) / (1 + s->pr);
- DPRINTF("Setting clksrc %d to frequency %d\n", clksrc, s->freq);
+ trace_imx_gpt_set_freq(clksrc, s->freq);
if (s->freq) {
ptimer_set_freq(s->timer, s->freq);
@@ -317,7 +310,7 @@ static uint64_t imx_gpt_read(void *opaque, hwaddr offset, unsigned size)
break;
}
- DPRINTF("(%s) = 0x%08x\n", imx_gpt_reg_name(offset >> 2), reg_value);
+ trace_imx_gpt_read(imx_gpt_reg_name(offset >> 2), reg_value);
return reg_value;
}
@@ -384,8 +377,7 @@ static void imx_gpt_write(void *opaque, hwaddr offset, uint64_t value,
IMXGPTState *s = IMX_GPT(opaque);
uint32_t oldreg;
- DPRINTF("(%s, value = 0x%08x)\n", imx_gpt_reg_name(offset >> 2),
- (uint32_t)value);
+ trace_imx_gpt_write(imx_gpt_reg_name(offset >> 2), (uint32_t)value);
switch (offset >> 2) {
case 0:
@@ -485,7 +477,7 @@ static void imx_gpt_timeout(void *opaque)
{
IMXGPTState *s = IMX_GPT(opaque);
- DPRINTF("\n");
+ trace_imx_gpt_timeout();
s->sr |= s->next_int;
s->next_int = 0;
diff --git a/hw/timer/trace-events b/hw/timer/trace-events
index f48a712801..5cfc369fba 100644
--- a/hw/timer/trace-events
+++ b/hw/timer/trace-events
@@ -49,6 +49,12 @@ cmsdk_apb_dualtimer_read(uint64_t offset, uint64_t data, unsigned size) "CMSDK A
cmsdk_apb_dualtimer_write(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB dualtimer write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
cmsdk_apb_dualtimer_reset(void) "CMSDK APB dualtimer: reset"
+# imx_gpt.c
+imx_gpt_set_freq(uint32_t clksrc, uint32_t freq) "Setting clksrc %u to %u Hz"
+imx_gpt_read(const char *name, uint64_t value) "%s -> 0x%08" PRIx64
+imx_gpt_write(const char *name, uint64_t value) "%s <- 0x%08" PRIx64
+imx_gpt_timeout(void) ""
+
# npcm7xx_timer.c
npcm7xx_timer_read(const char *id, uint64_t offset, uint64_t value) " %s offset: 0x%04" PRIx64 " value 0x%08" PRIx64
npcm7xx_timer_write(const char *id, uint64_t offset, uint64_t value) "%s offset: 0x%04" PRIx64 " value 0x%08" PRIx64
--
2.47.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 3/4] hw/watchdog/wdt_imx2: Remove redundant assignment
2024-11-03 14:33 [PATCH v2 0/4] Trivial ARM changes Bernhard Beschow
2024-11-03 14:33 ` [PATCH v2 1/4] hw/rtc/ds1338: Trace send and receive operations Bernhard Beschow
2024-11-03 14:33 ` [PATCH v2 2/4] hw/timer/imx_gpt: Convert DPRINTF to trace events Bernhard Beschow
@ 2024-11-03 14:33 ` Bernhard Beschow
2024-11-04 11:20 ` Richard Henderson
2024-11-03 14:33 ` [PATCH v2 4/4] hw/sensor/tmp105: Convert printf() to trace event, add tracing for read/write access Bernhard Beschow
2024-11-04 13:50 ` [PATCH v2 0/4] Trivial ARM changes Peter Maydell
4 siblings, 1 reply; 8+ messages in thread
From: Bernhard Beschow @ 2024-11-03 14:33 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrangé, Peter Maydell, Marc-André Lureau,
Paolo Bonzini, Jean-Christophe Dubois, qemu-arm, Michael Tokarev,
Laurent Vivier, qemu-trivial, Philippe Mathieu-Daudé,
Bernhard Beschow, Guenter Roeck
The same statement is executed unconditionally right before the if statement.
Cc: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
hw/watchdog/wdt_imx2.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/hw/watchdog/wdt_imx2.c b/hw/watchdog/wdt_imx2.c
index be63d421da..8162d58afa 100644
--- a/hw/watchdog/wdt_imx2.c
+++ b/hw/watchdog/wdt_imx2.c
@@ -39,7 +39,6 @@ static void imx2_wdt_expired(void *opaque)
/* Perform watchdog action if watchdog is enabled */
if (s->wcr & IMX2_WDT_WCR_WDE) {
- s->wrsr = IMX2_WDT_WRSR_TOUT;
watchdog_perform_action();
}
}
--
2.47.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 4/4] hw/sensor/tmp105: Convert printf() to trace event, add tracing for read/write access
2024-11-03 14:33 [PATCH v2 0/4] Trivial ARM changes Bernhard Beschow
` (2 preceding siblings ...)
2024-11-03 14:33 ` [PATCH v2 3/4] hw/watchdog/wdt_imx2: Remove redundant assignment Bernhard Beschow
@ 2024-11-03 14:33 ` Bernhard Beschow
2024-11-03 20:25 ` Philippe Mathieu-Daudé
2024-11-04 13:50 ` [PATCH v2 0/4] Trivial ARM changes Peter Maydell
4 siblings, 1 reply; 8+ messages in thread
From: Bernhard Beschow @ 2024-11-03 14:33 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrangé, Peter Maydell, Marc-André Lureau,
Paolo Bonzini, Jean-Christophe Dubois, qemu-arm, Michael Tokarev,
Laurent Vivier, qemu-trivial, Philippe Mathieu-Daudé,
Bernhard Beschow
printf() unconditionally prints to the console which disturbs `-serial stdio`.
Fix that by converting into a trace event. While at it, add some tracing for
read and write access.
Fixes: 7e7c5e4c1ba5 "Nokia N800 machine support (ARM)."
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
meson.build | 1 +
hw/sensor/trace.h | 1 +
hw/sensor/tmp105.c | 7 ++++++-
hw/sensor/trace-events | 6 ++++++
4 files changed, 14 insertions(+), 1 deletion(-)
create mode 100644 hw/sensor/trace.h
create mode 100644 hw/sensor/trace-events
diff --git a/meson.build b/meson.build
index 2c9086a3fe..19df8d7125 100644
--- a/meson.build
+++ b/meson.build
@@ -3476,6 +3476,7 @@ if have_system
'hw/s390x',
'hw/scsi',
'hw/sd',
+ 'hw/sensor',
'hw/sh4',
'hw/sparc',
'hw/sparc64',
diff --git a/hw/sensor/trace.h b/hw/sensor/trace.h
new file mode 100644
index 0000000000..e4721560b0
--- /dev/null
+++ b/hw/sensor/trace.h
@@ -0,0 +1 @@
+#include "trace/trace-hw_sensor.h"
diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c
index 9d7b911f59..ef2824f3e1 100644
--- a/hw/sensor/tmp105.c
+++ b/hw/sensor/tmp105.c
@@ -27,6 +27,7 @@
#include "qapi/visitor.h"
#include "qemu/module.h"
#include "hw/registerfields.h"
+#include "trace.h"
FIELD(CONFIG, SHUTDOWN_MODE, 0, 1)
FIELD(CONFIG, THERMOSTAT_MODE, 1, 1)
@@ -150,17 +151,21 @@ static void tmp105_read(TMP105State *s)
s->buf[s->len++] = ((uint16_t) s->limit[1]) >> 0;
break;
}
+
+ trace_tmp105_read(s->i2c.address, s->pointer);
}
static void tmp105_write(TMP105State *s)
{
+ trace_tmp105_write(s->i2c.address, s->pointer);
+
switch (s->pointer & 3) {
case TMP105_REG_TEMPERATURE:
break;
case TMP105_REG_CONFIG:
if (FIELD_EX8(s->buf[0] & ~s->config, CONFIG, SHUTDOWN_MODE)) {
- printf("%s: TMP105 shutdown\n", __func__);
+ trace_tmp105_write_shutdown(s->i2c.address);
}
s->config = FIELD_DP8(s->buf[0], CONFIG, ONE_SHOT, 0);
s->faults = tmp105_faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUEUE)];
diff --git a/hw/sensor/trace-events b/hw/sensor/trace-events
new file mode 100644
index 0000000000..a3fe54fa6d
--- /dev/null
+++ b/hw/sensor/trace-events
@@ -0,0 +1,6 @@
+# See docs/devel/tracing.rst for syntax documentation.
+
+# tmp105.c
+tmp105_read(uint8_t dev, uint8_t addr) "device: 0x%02x, addr: 0x%02x"
+tmp105_write(uint8_t dev, uint8_t addr) "device: 0x%02x, addr 0x%02x"
+tmp105_write_shutdown(uint8_t dev) "device: 0x%02x"
--
2.47.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 4/4] hw/sensor/tmp105: Convert printf() to trace event, add tracing for read/write access
2024-11-03 14:33 ` [PATCH v2 4/4] hw/sensor/tmp105: Convert printf() to trace event, add tracing for read/write access Bernhard Beschow
@ 2024-11-03 20:25 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-11-03 20:25 UTC (permalink / raw)
To: Bernhard Beschow, qemu-devel
Cc: Daniel P. Berrangé, Peter Maydell, Marc-André Lureau,
Paolo Bonzini, Jean-Christophe Dubois, qemu-arm, Michael Tokarev,
Laurent Vivier, qemu-trivial
On 3/11/24 11:33, Bernhard Beschow wrote:
> printf() unconditionally prints to the console which disturbs `-serial stdio`.
> Fix that by converting into a trace event. While at it, add some tracing for
> read and write access.
>
> Fixes: 7e7c5e4c1ba5 "Nokia N800 machine support (ARM)."
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
> meson.build | 1 +
> hw/sensor/trace.h | 1 +
> hw/sensor/tmp105.c | 7 ++++++-
> hw/sensor/trace-events | 6 ++++++
> 4 files changed, 14 insertions(+), 1 deletion(-)
> create mode 100644 hw/sensor/trace.h
> create mode 100644 hw/sensor/trace-events
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 3/4] hw/watchdog/wdt_imx2: Remove redundant assignment
2024-11-03 14:33 ` [PATCH v2 3/4] hw/watchdog/wdt_imx2: Remove redundant assignment Bernhard Beschow
@ 2024-11-04 11:20 ` Richard Henderson
0 siblings, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2024-11-04 11:20 UTC (permalink / raw)
To: Bernhard Beschow, qemu-devel
Cc: Daniel P. Berrangé, Peter Maydell, Marc-André Lureau,
Paolo Bonzini, Jean-Christophe Dubois, qemu-arm, Michael Tokarev,
Laurent Vivier, qemu-trivial, Philippe Mathieu-Daudé,
Guenter Roeck
On 11/3/24 14:33, Bernhard Beschow wrote:
> The same statement is executed unconditionally right before the if statement.
>
> Cc: Guenter Roeck<linux@roeck-us.net>
> Reviewed-by: Guenter Roeck<linux@roeck-us.net>
> Signed-off-by: Bernhard Beschow<shentey@gmail.com>
> ---
> hw/watchdog/wdt_imx2.c | 1 -
> 1 file changed, 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/4] Trivial ARM changes
2024-11-03 14:33 [PATCH v2 0/4] Trivial ARM changes Bernhard Beschow
` (3 preceding siblings ...)
2024-11-03 14:33 ` [PATCH v2 4/4] hw/sensor/tmp105: Convert printf() to trace event, add tracing for read/write access Bernhard Beschow
@ 2024-11-04 13:50 ` Peter Maydell
4 siblings, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2024-11-04 13:50 UTC (permalink / raw)
To: Bernhard Beschow
Cc: qemu-devel, Daniel P. Berrangé, Marc-André Lureau,
Paolo Bonzini, Jean-Christophe Dubois, qemu-arm, Michael Tokarev,
Laurent Vivier, qemu-trivial, Philippe Mathieu-Daudé
On Sun, 3 Nov 2024 at 14:34, Bernhard Beschow <shentey@gmail.com> wrote:
>
> This series improves the tracing experience in three devices used in ARM
> context. It also removes a duplicate statement in an IMX watchdog.
>
> v2:
> * Fix format strings in trace events for imx_gpt (Phil)
> * Add patch for tmp105 which improves tracing
>
> Bernhard Beschow (4):
> hw/rtc/ds1338: Trace send and receive operations
> hw/timer/imx_gpt: Convert DPRINTF to trace events
> hw/watchdog/wdt_imx2: Remove redundant assignment
> hw/sensor/tmp105: Convert printf() to trace event, add tracing for
> read/write access
Applied to target-arm.next, thanks.
-- PMM
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-11-04 13:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-03 14:33 [PATCH v2 0/4] Trivial ARM changes Bernhard Beschow
2024-11-03 14:33 ` [PATCH v2 1/4] hw/rtc/ds1338: Trace send and receive operations Bernhard Beschow
2024-11-03 14:33 ` [PATCH v2 2/4] hw/timer/imx_gpt: Convert DPRINTF to trace events Bernhard Beschow
2024-11-03 14:33 ` [PATCH v2 3/4] hw/watchdog/wdt_imx2: Remove redundant assignment Bernhard Beschow
2024-11-04 11:20 ` Richard Henderson
2024-11-03 14:33 ` [PATCH v2 4/4] hw/sensor/tmp105: Convert printf() to trace event, add tracing for read/write access Bernhard Beschow
2024-11-03 20:25 ` Philippe Mathieu-Daudé
2024-11-04 13:50 ` [PATCH v2 0/4] Trivial ARM changes Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).