summary refs log tree commit diff stats
path: root/hw/audio/es1370.c
diff options
context:
space:
mode:
authorVolker Rümelin <vr_qemu@t-online.de>2023-09-17 08:58:13 +0200
committerPatchew Applier <no-reply@patchew.org>2023-10-10 12:31:05 +0000
commit5bf1a71c5b7b2d1999f65c08b4d82b5dec9f3013 (patch)
tree366e78574328491471bc1aca9cc6244ae6746421 /hw/audio/es1370.c
parentca98851835645f46eaa5b98bbfb307650b42fc64 (diff)
downloadfocaccia-qemu-5bf1a71c5b7b2d1999f65c08b4d82b5dec9f3013.tar.gz
focaccia-qemu-5bf1a71c5b7b2d1999f65c08b4d82b5dec9f3013.zip
hw/audio/es1370: trace lost interrupts
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>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Tested-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-Id: <20230917065813.6692-8-vr_qemu@t-online.de>
Diffstat (limited to 'hw/audio/es1370.c')
-rw-r--r--hw/audio/es1370.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
index b47794f786..91c47330ad 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) {