From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Damien Hedde" <damien.hedde@greensocs.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [PATCH-for-5.2 3/4] hw/char/serial: Let SerialState have an 'id' field
Date: Thu, 6 Aug 2020 15:03:39 +0200 [thread overview]
Message-ID: <20200806130340.17316-4-f4bug@amsat.org> (raw)
In-Reply-To: <20200806130340.17316-1-f4bug@amsat.org>
When a SoC has multiple UARTs (some configured differently),
it is hard to associate events to their UART.
To be able to distinct trace events between various instances,
add an 'id' field. Update the trace format accordingly.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
include/hw/char/serial.h | 1 +
hw/char/serial.c | 7 ++++---
hw/char/trace-events | 6 +++---
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h
index 81d7ba1917..75c71adfd2 100644
--- a/include/hw/char/serial.h
+++ b/include/hw/char/serial.h
@@ -75,6 +75,7 @@ typedef struct SerialState {
uint64_t char_transmit_time; /* time to transmit a char in ticks */
int poll_msl;
+ uint8_t id;
QEMUTimer *modem_status_poll;
MemoryRegion io;
} SerialState;
diff --git a/hw/char/serial.c b/hw/char/serial.c
index 758a3aa49b..2ddc73f255 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -177,7 +177,7 @@ static void serial_update_parameters(SerialState *s)
ssp.stop_bits = stop_bits;
s->char_transmit_time = (NANOSECONDS_PER_SECOND / speed) * frame_size;
qemu_chr_fe_ioctl(&s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
- trace_serial_update_parameters(speed, parity, data_bits, stop_bits);
+ trace_serial_update_parameters(s->id, speed, parity, data_bits, stop_bits);
}
static void serial_update_msl(SerialState *s)
@@ -333,7 +333,7 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
SerialState *s = opaque;
addr &= 7;
- trace_serial_ioport_write(addr, val);
+ trace_serial_ioport_write(s->id, addr, val);
switch(addr) {
default:
case 0:
@@ -550,7 +550,7 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size)
ret = s->scr;
break;
}
- trace_serial_ioport_read(addr, ret);
+ trace_serial_ioport_read(s->id, addr, ret);
return ret;
}
@@ -973,6 +973,7 @@ const MemoryRegionOps serial_io_ops = {
};
static Property serial_properties[] = {
+ DEFINE_PROP_UINT8("id", SerialState, id, 0),
DEFINE_PROP_CHR("chardev", SerialState, chr),
DEFINE_PROP_UINT32("baudbase", SerialState, baudbase, 115200),
DEFINE_PROP_END_OF_LIST(),
diff --git a/hw/char/trace-events b/hw/char/trace-events
index 85e39d9d62..04a6fb4a15 100644
--- a/hw/char/trace-events
+++ b/hw/char/trace-events
@@ -5,9 +5,9 @@ parallel_ioport_read(const char *desc, uint16_t addr, uint8_t value) "read [%s]
parallel_ioport_write(const char *desc, uint16_t addr, uint8_t value) "write [%s] addr 0x%02x val 0x%02x"
# serial.c
-serial_ioport_read(uint16_t addr, uint8_t value) "read addr 0x%02x val 0x%02x"
-serial_ioport_write(uint16_t addr, uint8_t value) "write addr 0x%02x val 0x%02x"
-serial_update_parameters(uint64_t baudrate, char parity, int data_bits, int stop_bits) "baudrate=%"PRIu64" parity='%c' data=%d stop=%d"
+serial_ioport_read(uint8_t id, uint16_t addr, uint8_t value) "id#%u read addr 0x%02x val 0x%02x"
+serial_ioport_write(uint8_t id, uint16_t addr, uint8_t value) "id#%u write addr 0x%02x val 0x%02x"
+serial_update_parameters(uint8_t id, uint64_t baudrate, char parity, int data_bits, int stop_bits) "id#%u baudrate=%"PRIu64" parity=%c data=%d stop=%d"
# virtio-serial-bus.c
virtio_serial_send_control_event(unsigned int port, uint16_t event, uint16_t value) "port %u, event %u, value %u"
--
2.21.3
next prev parent reply other threads:[~2020-08-06 13:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-06 13:03 [PATCH-for-5.2 0/4] hw/char/serial: Use the Clock API to feed the UART reference clock Philippe Mathieu-Daudé
2020-08-06 13:03 ` [PATCH-for-5.2 1/4] hw/char/serial: Replace commented DPRINTF() by trace event Philippe Mathieu-Daudé
2020-08-12 17:41 ` Richard Henderson
2020-08-06 13:03 ` [PATCH-for-5.2 2/4] hw/char/serial: Remove old DEBUG_SERIAL commented code Philippe Mathieu-Daudé
2020-08-12 17:42 ` Richard Henderson
2020-08-06 13:03 ` Philippe Mathieu-Daudé [this message]
2020-08-12 17:43 ` [PATCH-for-5.2 3/4] hw/char/serial: Let SerialState have an 'id' field Richard Henderson
2020-08-06 13:03 ` [PATCH-for-5.2 4/4] hw/char/serial: Use the Clock API to feed the UART reference clock Philippe Mathieu-Daudé
2020-08-12 17:46 ` Richard Henderson
2020-08-22 20:00 ` [PATCH-for-5.2 0/4] " Philippe Mathieu-Daudé
2020-08-24 15:19 ` Peter Maydell
2020-08-26 9:52 ` Philippe Mathieu-Daudé
2020-09-01 16:54 ` Marc-André Lureau
2020-09-01 17:02 ` Paolo Bonzini
2020-09-02 10:41 ` 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=20200806130340.17316-4-f4bug@amsat.org \
--to=f4bug@amsat.org \
--cc=damien.hedde@greensocs.com \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).