From: "Volker Rümelin" <vr_qemu@t-online.de>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"BALATON Zoltan" <balaton@eik.bme.hu>,
qemu-devel@nongnu.org
Subject: [PATCH 8/8] hw/audio/es1370: trace lost interrupts
Date: Sun, 17 Sep 2023 08:58:13 +0200 [thread overview]
Message-ID: <20230917065813.6692-8-vr_qemu@t-online.de> (raw)
In-Reply-To: <cfc5a196-9939-44b5-8716-9525f1a08a2a@t-online.de>
It turns out that there are drivers which assume that interrupts
can't be lost. E.g. the AROS sb128 driver is such a driver. Add
a lost interrupt tracepoint to debug this kind of issues.
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
---
hw/audio/es1370.c | 14 ++++++++++----
hw/audio/trace-events | 3 ++-
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
index 6d2aff57f2..4966f72ae6 100644
--- a/hw/audio/es1370.c
+++ b/hw/audio/es1370.c
@@ -602,7 +602,7 @@ static uint64_t es1370_read(void *opaque, hwaddr addr, unsigned size)
}
static void es1370_transfer_audio (ES1370State *s, struct chan *d, int loop_sel,
- int max, int *irq)
+ int max, bool *irq)
{
uint8_t tmpbuf[4096];
size_t to_transfer;
@@ -657,10 +657,13 @@ static void es1370_transfer_audio (ES1370State *s, struct chan *d, int loop_sel,
}
if (csc_bytes == transferred) {
- *irq = 1;
+ if (*irq) {
+ trace_es1370_lost_interrupt(index);
+ }
+ *irq = true;
d->scount = sc | (sc << 16);
} else {
- *irq = 0;
+ *irq = false;
d->scount = sc | (((csc_bytes - transferred - 1) >> d->shift) << 16);
}
@@ -688,7 +691,8 @@ static void es1370_transfer_audio (ES1370State *s, struct chan *d, int loop_sel,
static void es1370_run_channel (ES1370State *s, size_t chan, int free_or_avail)
{
uint32_t new_status = s->status;
- int max_bytes, irq;
+ int max_bytes;
+ bool irq;
struct chan *d = &s->chan[chan];
const struct chan_bits *b = &es1370_chan_bits[chan];
@@ -702,6 +706,8 @@ static void es1370_run_channel (ES1370State *s, size_t chan, int free_or_avail)
return;
}
+ irq = s->sctl & b->sctl_inten && s->status & b->stat_int;
+
es1370_transfer_audio (s, d, b->sctl_loopsel, max_bytes, &irq);
if (irq) {
diff --git a/hw/audio/trace-events b/hw/audio/trace-events
index 00f9e45158..ccbc8dabd5 100644
--- a/hw/audio/trace-events
+++ b/hw/audio/trace-events
@@ -11,10 +11,11 @@ es1370_frame_address_rd(int ch, uint32_t addr) "ch=%d addr=0x%08x"
es1370_frame_address_wr(int ch, uint32_t addr) "ch=%d addr=0x%08x"
es1370_frame_count_rd(int ch, uint32_t curr, uint32_t size) "ch=%d CURR_CT=%u BUF_SIZE=%u"
es1370_frame_count_wr(int ch, uint32_t curr, uint32_t size) "ch=%d CURR_CT=%u BUF_SIZE=%u"
+es1370_lost_interrupt(int ch) "ch=%d lost interrupt"
es1370_sample_count_rd(int ch, uint32_t curr, uint32_t num) "ch=%d CURR_SAMP_CT=%u SAMP_CT=%u"
es1370_sample_count_wr(int ch, uint32_t curr, uint32_t num) "ch=%d CURR_SAMP_CT=%u SAMP_CT=%u"
es1370_stream_format(int ch, uint32_t freq, const char *fmt, const char *mode, uint32_t shift) "ch=%d fmt=%u:%s:%s shift=%u"
-es1370_transfer_audio(int ch, uint32_t f_curr, uint32_t f_size, uint32_t s_curr, uint32_t s_num, uint32_t leftover, int irq) "ch=%d CURR_CT=%u BUF_SIZE=%u CURR_SAMP_CT=%u SAMP_CT=%u leftover=%u irq=%d"
+es1370_transfer_audio(int ch, uint32_t f_curr, uint32_t f_size, uint32_t s_curr, uint32_t s_num, uint32_t leftover, bool irq) "ch=%d CURR_CT=%u BUF_SIZE=%u CURR_SAMP_CT=%u SAMP_CT=%u leftover=%u irq=%d"
# hda-codec.c
hda_audio_running(const char *stream, int nr, bool running) "st %s, nr %d, run %d"
--
2.35.3
next prev parent reply other threads:[~2023-09-17 6:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-17 6:55 [PATCH 0/8] hw/audio/es1370: bug fix Volker Rümelin
2023-09-17 6:58 ` [PATCH 1/8] hw/audio/es1370: reset current sample counter Volker Rümelin
2023-09-17 6:58 ` [PATCH 2/8] hw/audio/es1370: replace bit-rotted code with tracepoints Volker Rümelin
2023-09-17 6:58 ` [PATCH 3/8] hw/audio/es1370: remove unused dolog macro Volker Rümelin
2023-09-17 6:58 ` [PATCH 4/8] hw/audio/es1370: remove #ifdef ES1370_DEBUG to avoid bit rot Volker Rümelin
2023-09-17 6:58 ` [PATCH 5/8] hw/audio/es1370: remove #ifdef ES1370_VERBOSE " Volker Rümelin
2023-09-17 6:58 ` [PATCH 6/8] hw/audio/es1370: block structure coding style fixes Volker Rümelin
2023-09-17 6:58 ` [PATCH 7/8] hw/audio/es1370: change variable type and name Volker Rümelin
2023-09-17 6:58 ` Volker Rümelin [this message]
2023-09-18 11:19 ` [PATCH 0/8] hw/audio/es1370: bug fix Marc-André Lureau
2023-10-10 12:24 ` BALATON Zoltan
2023-10-11 6:30 ` Marc-André Lureau
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=20230917065813.6692-8-vr_qemu@t-online.de \
--to=vr_qemu@t-online.de \
--cc=balaton@eik.bme.hu \
--cc=kraxel@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=philmd@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).