[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 34/49] hw/gpio/imx_gpio: Turn DPRINTF() into trace events
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 34/49] hw/gpio/imx_gpio: Turn DPRINTF() into trace events |
Date: |
Sun, 12 Jan 2025 23:17:10 +0100 |
From: Bernhard Beschow <shentey@gmail.com>
While at it add a trace event for input GPIO events.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Message-ID: <20250111183711.2338-14-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/gpio/imx_gpio.c | 18 +++++++-----------
hw/gpio/trace-events | 5 +++++
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/hw/gpio/imx_gpio.c b/hw/gpio/imx_gpio.c
index 898f80f8c83..549a281ed79 100644
--- a/hw/gpio/imx_gpio.c
+++ b/hw/gpio/imx_gpio.c
@@ -24,6 +24,7 @@
#include "migration/vmstate.h"
#include "qemu/log.h"
#include "qemu/module.h"
+#include "trace.h"
#ifndef DEBUG_IMX_GPIO
#define DEBUG_IMX_GPIO 0
@@ -34,14 +35,6 @@ typedef enum IMXGPIOLevel {
IMX_GPIO_LEVEL_HIGH = 1,
} IMXGPIOLevel;
-#define DPRINTF(fmt, args...) \
- do { \
- if (DEBUG_IMX_GPIO) { \
- fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX_GPIO, \
- __func__, ##args); \
- } \
- } while (0)
-
static const char *imx_gpio_reg_name(uint32_t reg)
{
switch (reg) {
@@ -111,6 +104,8 @@ static void imx_gpio_set(void *opaque, int line, int level)
IMXGPIOState *s = IMX_GPIO(opaque);
IMXGPIOLevel imx_level = level ? IMX_GPIO_LEVEL_HIGH : IMX_GPIO_LEVEL_LOW;
+ trace_imx_gpio_set(DEVICE(s)->canonical_path, line, imx_level);
+
imx_gpio_set_int_line(s, line, imx_level);
/* this is an input signal, so set PSR */
@@ -200,7 +195,8 @@ static uint64_t imx_gpio_read(void *opaque, hwaddr offset,
unsigned size)
break;
}
- DPRINTF("(%s) = 0x%" PRIx32 "\n", imx_gpio_reg_name(offset), reg_value);
+ trace_imx_gpio_read(DEVICE(s)->canonical_path, imx_gpio_reg_name(offset),
+ reg_value);
return reg_value;
}
@@ -210,8 +206,8 @@ static void imx_gpio_write(void *opaque, hwaddr offset,
uint64_t value,
{
IMXGPIOState *s = IMX_GPIO(opaque);
- DPRINTF("(%s, value = 0x%" PRIx32 ")\n", imx_gpio_reg_name(offset),
- (uint32_t)value);
+ trace_imx_gpio_write(DEVICE(s)->canonical_path, imx_gpio_reg_name(offset),
+ value);
switch (offset) {
case DR_ADDR:
diff --git a/hw/gpio/trace-events b/hw/gpio/trace-events
index b91cc7e9a45..cea896b28f6 100644
--- a/hw/gpio/trace-events
+++ b/hw/gpio/trace-events
@@ -1,5 +1,10 @@
# See docs/devel/tracing.rst for syntax documentation.
+# imx_gpio.c
+imx_gpio_read(const char *id, const char *reg, uint32_t value) "%s:[%s] ->
0x%" PRIx32
+imx_gpio_write(const char *id, const char *reg, uint32_t value) "%s:[%s] <-
0x%" PRIx32
+imx_gpio_set(const char *id, int line, int level) "%s:[%d] <- %d"
+
# npcm7xx_gpio.c
npcm7xx_gpio_read(const char *id, uint64_t offset, uint64_t value) " %s
offset: 0x%04" PRIx64 " value 0x%08" PRIx64
npcm7xx_gpio_write(const char *id, uint64_t offset, uint64_t value) "%s
offset: 0x%04" PRIx64 " value 0x%08" PRIx64
--
2.47.1
- [PULL 23/49] hw/misc/vmcoreinfo: Convert to three-phase reset interface, (continued)
- [PULL 23/49] hw/misc/vmcoreinfo: Convert to three-phase reset interface, Philippe Mathieu-Daudé, 2025/01/12
- [PULL 24/49] hw/pci: Rename has_power to enabled, Philippe Mathieu-Daudé, 2025/01/12
- [PULL 25/49] hw/ufs: Adjust value to match CPU's endian format, Philippe Mathieu-Daudé, 2025/01/12
- [PULL 27/49] hw/sd/sdhci: Factor sdhci_sdma_transfer() out, Philippe Mathieu-Daudé, 2025/01/12
- [PULL 28/49] hw/char/stm32f2xx_usart: replace print with trace, Philippe Mathieu-Daudé, 2025/01/12
- [PULL 29/49] hw/timer/imx_gpt: Remove unused define, Philippe Mathieu-Daudé, 2025/01/12
- [PULL 31/49] hw/misc/imx6_src: Convert DPRINTF() to trace events, Philippe Mathieu-Daudé, 2025/01/12
- [PULL 35/49] tests/qtest/boot-serial-test: Correct HPPA machine name, Philippe Mathieu-Daudé, 2025/01/12
- [PULL 33/49] hw/i2c/imx_i2c: Convert DPRINTF() to trace events, Philippe Mathieu-Daudé, 2025/01/12
- [PULL 32/49] hw/char/imx_serial: Turn some DPRINTF() statements into trace events, Philippe Mathieu-Daudé, 2025/01/12
- [PULL 34/49] hw/gpio/imx_gpio: Turn DPRINTF() into trace events,
Philippe Mathieu-Daudé <=
- [PULL 36/49] tests: Add functional tests for HPPA machines, Philippe Mathieu-Daudé, 2025/01/12
- [PULL 30/49] tests/qtest/libqos: Reuse TYPE_IMX_I2C define, Philippe Mathieu-Daudé, 2025/01/12
- [PULL 37/49] target/hppa: Convert hppa_cpu_init() to ResetHold handler, Philippe Mathieu-Daudé, 2025/01/12
- [PULL 38/49] hw/hppa: Reset vCPUs calling resettable_reset(), Philippe Mathieu-Daudé, 2025/01/12
- [PULL 39/49] target/hppa: Only set PSW 'M' bit on reset, Philippe Mathieu-Daudé, 2025/01/12
- [PULL 40/49] target/hppa: Set PC on vCPU reset, Philippe Mathieu-Daudé, 2025/01/12
- [PULL 41/49] target/hppa: Speed up hppa_is_pa20(), Philippe Mathieu-Daudé, 2025/01/12
- [PULL 42/49] hw/loongarch/virt: Checkpatch cleanup, Philippe Mathieu-Daudé, 2025/01/12
- [PULL 43/49] backends/cryptodev-vhost-user: Fix local_error leaks, Philippe Mathieu-Daudé, 2025/01/12
- [PULL 44/49] hw/usb/hcd-xhci-pci: Use event ring 0 if mapping unsupported, Philippe Mathieu-Daudé, 2025/01/12