Trivial ARM changes
Subsystems (2)
v2 cover Trivial ARM changes
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
Signature · 1 line
2.47.0
PATCH v2 1/4 hw/rtc/ds1338: Trace send and receive operations
--- hw/rtc/ds1338.c | 6 ++++++ hw/rtc/trace-events | 4 ++++ 2 files changed, 10 insertions(+)
hw/rtc/ds1338.c +6 -0
@@ -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;
hw/rtc/trace-events +4 -0
@@ -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
Signature · 1 line
2.47.0
PATCH v2 2/4 hw/timer/imx_gpt: Convert DPRINTF to trace events
In reply to Bernhard Beschow--- hw/timer/imx_gpt.c | 18 +++++------------- hw/timer/trace-events | 6 ++++++ 2 files changed, 11 insertions(+), 13 deletions(-)
hw/timer/imx_gpt.c +5 -13
@@ -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 ;
hw/timer/trace-events +6 -0
@@ -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
Signature · 1 line
2.47.0
PATCH v2 3/4 hw/watchdog/wdt_imx2: Remove redundant assignment
In reply to Bernhard BeschowThe same statement is executed unconditionally right before the if statement.
--- hw/watchdog/wdt_imx2.c | 1 - 1 file changed, 1 deletion(-)
hw/watchdog/wdt_imx2.c +0 -1
@@ -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 (); } }
Signature · 1 line
2.47.0
Re: [PATCH v2 3/4] hw/watchdog/wdt_imx2: Remove redundant assignment
Quoted 8 lines · Bernhard Beschow
The same statement is executed unconditionally right before the if statement.
Cc Guenter Roeck<[email protected]>Reviewed-by Guenter Roeck<[email protected]>Signed-off-by Bernhard Beschow<[email protected]>--- hw/watchdog/wdt_imx2.c | 1 - 1 file changed, 1 deletion(-)
r~
PATCH v2 4/4 hw/sensor/tmp105: Convert printf() to trace event, add tracing for read/write access
In reply to Bernhard Beschowprintf() 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.
--- 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
meson.build +1 -0
@@ -3476,6 +3476,7 @@ if have_system 'hw/s390x', 'hw/scsi', 'hw/sd', + 'hw/sensor', 'hw/sh4', 'hw/sparc', 'hw/sparc64',
hw/sensor/trace.h new file +1 -0
@@ -0,0 +1 @@ +#include "trace/trace-hw_sensor.h"
hw/sensor/tmp105.c +6 -1
@@ -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 )];
hw/sensor/trace-events new file +6 -0
@@ -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"
Signature · 1 line
2.47.0
Re: [PATCH v2 4/4] hw/sensor/tmp105: Convert printf() to trace event, add tracing for read/write access
Quoted 6 lines · 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 <[email protected]>
Quoted 8 lines
--- 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
Peter Maydell
AppliedQuoted 8 lines · 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 forimx_gpt(Phil)
* Add patch for tmp105 which improves tracing
Quoted 6 lines
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: Convertprintf()to trace event, add tracing for
read/write access
Applied to target-arm.next, thanks.
-- PMM