From 50da260ace56807635394a7420d1c891080025cd Mon Sep 17 00:00:00 2001 From: R0ck Date: Fri, 30 Oct 2026 21:19:20 +0000 Subject: [PATCH] gdma: test the IN link's own START bit when looking up a peripheral's channel. --- hw/dma/esp_gdma.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/dma/esp_gdma.c b/hw/dma/esp_gdma.c index 7efd139412aee..30495967627cd 100644 --- a/hw/dma/esp_gdma.c +++ b/hw/dma/esp_gdma.c @@ -285,8 +285,13 @@ bool esp_gdma_get_channel_periph(ESPGdmaState *s, GdmaPeripheral periph, int dir * descriptor on. The AES path never noticed because it arms one * channel; an SPI display driver that uses a different channel got a * descriptor error and its transfer never completed. */ + /* START is not at the same offset for IN and OUT: on an IN link the + * OUT link's START bit is STOP, so testing it there never found the + * channel AES or SPI receive had armed. */ + const uint32_t start = (dir == ESP_GDMA_IN_IDX) ? R_GDMA_IN_LINK_START_MASK + : R_GDMA_OUT_LINK_START_MASK; if ( FIELD_EX32(s->ch_conf[dir][i].peripheral, GDMA_PERI_SEL, PERI_SEL) == periph && - FIELD_EX32(s->ch_conf[dir][i].link, GDMA_OUT_LINK, START)) { + (s->ch_conf[dir][i].link & start)) { *chan = i; return true;