[PATCH v8 6/6] dmaengine: dw: report residue for queued transfers

From: James Hilliard

Date: Mon Nov 16 2026 - 05:53:39 EST


A submitted transfer may still be queued behind the active transaction.
dwc_find_desc() only checks the active descriptor, so a status query
reports zero residue for a queued cookie even though none of its data has
been transferred.

Search the issued and submitted queues as well. vchan_find_desc() covers
issued descriptors; submitted descriptors need a separate lookup. The
status getter already reports total_len for a descriptor that is not the
active transaction, giving queued transfers their full remaining length.

Fixes: b68fd0976286 ("dmaengine: dw: move residue to a descriptor")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: James Hilliard <james.hilliard1@xxxxxxxxx>
---
drivers/dma/dw/core.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
index 565d01c9a29a..5a7be765a0c5 100644
--- a/drivers/dma/dw/core.c
+++ b/drivers/dma/dw/core.c
@@ -867,9 +867,19 @@ static void dwc_synchronize(struct dma_chan *chan)

static struct dw_desc *dwc_find_desc(struct dw_dma_chan *dwc, dma_cookie_t c)
{
+ struct virt_dma_desc *vd;
+
if (dwc->desc && dwc->desc->vd.tx.cookie == c)
return dwc->desc;

+ vd = vchan_find_desc(&dwc->vc, c);
+ if (vd)
+ return vd_to_dw_desc(vd);
+
+ list_for_each_entry(vd, &dwc->vc.desc_submitted, node)
+ if (vd->tx.cookie == c)
+ return vd_to_dw_desc(vd);
+
return NULL;
}


--
2.53.0