From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Alistair Francis" <alistair@alistair23.me>,
"Subbaraya Sundeep" <sundeep.lkml@gmail.com>,
qemu-arm@nongnu.org,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [Qemu-devel] [PATCH 1/3] hw/ssi/mss-spi: Convert debug printf()s to trace events
Date: Tue, 9 Jul 2019 13:37:13 +0200 [thread overview]
Message-ID: <20190709113715.7761-2-philmd@redhat.com> (raw)
In-Reply-To: <20190709113715.7761-1-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Useful while debugging, can be skipped for next dev cycle.
Makefile.objs | 1 +
hw/ssi/mss-spi.c | 23 ++++++-----------------
hw/ssi/trace-events | 6 ++++++
3 files changed, 13 insertions(+), 17 deletions(-)
create mode 100644 hw/ssi/trace-events
diff --git a/Makefile.objs b/Makefile.objs
index 6a143dcd57..60ec443091 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -178,6 +178,7 @@ trace-events-subdirs += hw/scsi
trace-events-subdirs += hw/sd
trace-events-subdirs += hw/sparc
trace-events-subdirs += hw/sparc64
+trace-events-subdirs += hw/ssi
trace-events-subdirs += hw/timer
trace-events-subdirs += hw/tpm
trace-events-subdirs += hw/usb
diff --git a/hw/ssi/mss-spi.c b/hw/ssi/mss-spi.c
index 918b1f3e82..4878279482 100644
--- a/hw/ssi/mss-spi.c
+++ b/hw/ssi/mss-spi.c
@@ -27,18 +27,8 @@
#include "hw/ssi/mss-spi.h"
#include "qemu/log.h"
#include "qemu/module.h"
+#include "trace.h"
-#ifndef MSS_SPI_ERR_DEBUG
-#define MSS_SPI_ERR_DEBUG 0
-#endif
-
-#define DB_PRINT_L(lvl, fmt, args...) do { \
- if (MSS_SPI_ERR_DEBUG >= lvl) { \
- qemu_log("%s: " fmt "\n", __func__, ## args); \
- } \
-} while (0)
-
-#define DB_PRINT(fmt, args...) DB_PRINT_L(1, fmt, ## args)
#define FIFO_CAPACITY 32
@@ -187,9 +177,9 @@ spi_read(void *opaque, hwaddr addr, unsigned int size)
}
break;
}
-
- DB_PRINT("addr=0x%" HWADDR_PRIx " = 0x%" PRIx32, addr * 4, ret);
+ trace_mss_spi_read(addr << 2, ret);
spi_update_irq(s);
+
return ret;
}
@@ -225,9 +215,9 @@ static void spi_flush_txfifo(MSSSpiState *s)
s->regs[R_SPI_STATUS] &= ~(S_TXDONE | S_RXRDY);
tx = fifo32_pop(&s->tx_fifo);
- DB_PRINT("data tx:0x%" PRIx32, tx);
+ trace_mss_spi_flush_fifo("tx", tx);
rx = ssi_transfer(s->spi, tx);
- DB_PRINT("data rx:0x%" PRIx32, rx);
+ trace_mss_spi_flush_fifo("rx", rx);
if (fifo32_num_used(&s->rx_fifo) == s->fifo_depth) {
s->regs[R_SPI_STATUS] |= S_RXCHOVRF;
@@ -262,9 +252,8 @@ static void spi_write(void *opaque, hwaddr addr,
MSSSpiState *s = opaque;
uint32_t value = val64;
- DB_PRINT("addr=0x%" HWADDR_PRIx " =0x%" PRIx32, addr, value);
+ trace_mss_spi_write(addr, value);
addr >>= 2;
-
switch (addr) {
case R_SPI_TX:
/* adding to already full FIFO */
diff --git a/hw/ssi/trace-events b/hw/ssi/trace-events
new file mode 100644
index 0000000000..6e494b913c
--- /dev/null
+++ b/hw/ssi/trace-events
@@ -0,0 +1,6 @@
+# See docs/devel/tracing.txt for syntax documentation.
+
+# mss-spi.c
+mss_spi_read(uint32_t addr, uint32_t value) "read addr:0x%02x value:0x%08x"
+mss_spi_write(uint32_t addr, uint32_t value) "write addr:0x%02x value:0x%08x"
+mss_spi_flush_fifo(const char *name, uint32_t value) "flush fifo:%s value:0x%08x"
--
2.20.1
next prev parent reply other threads:[~2019-07-09 11:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-09 11:37 [Qemu-devel] [PATCH-for-4.1 0/3] hw: Avoid crash when reading empty RX FIFO Philippe Mathieu-Daudé
2019-07-09 11:37 ` Philippe Mathieu-Daudé [this message]
2019-07-09 16:56 ` [Qemu-devel] [PATCH 1/3] hw/ssi/mss-spi: Convert debug printf()s to trace events Alistair Francis
2019-07-09 11:37 ` [Qemu-devel] [PATCH-for-4.1 2/3] hw/ssi/mss-spi: Avoid crash when reading empty RX FIFO Philippe Mathieu-Daudé
2019-07-09 16:55 ` Alistair Francis
2019-07-09 11:37 ` [Qemu-devel] [PATCH-for-4.1 3/3] hw/display/xlnx_dp: " Philippe Mathieu-Daudé
2019-07-09 16:57 ` Alistair Francis
2019-07-11 14:51 ` [Qemu-devel] [PATCH-for-4.1 0/3] hw: " Peter Maydell
2019-07-11 14:57 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190709113715.7761-2-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=alistair@alistair23.me \
--cc=edgar.iglesias@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=sundeep.lkml@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).