[PATCH v7 05/10] dmaengine: arm-dma350: Report submitted descriptor status

Jelly Jia Jelly.Jia at cixtech.com
Tue Nov 17 01:43:30 PST 2026


A submitted descriptor can still be on desc_submitted before issue_pending
moves it to desc_issued. Searching only the issued list misreports such a
cookie as failed.

Search both submitted and issued descriptors when reporting queued work.

Fixes: 5d099706449d ("dmaengine: Add Arm DMA-350 driver")
Signed-off-by: Jelly Jia <Jelly.Jia at cixtech.com>
---
 drivers/dma/arm-dma350.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/arm-dma350.c b/drivers/dma/arm-dma350.c
index af1b030b955f..f785251935f4 100644
--- a/drivers/dma/arm-dma350.c
+++ b/drivers/dma/arm-dma350.c
@@ -390,6 +390,18 @@ static u32 d350_desc_bytes(struct d350_desc *desc)
 	return ((u32)desc->xsizehi << 16 | desc->xsize) << desc->tsz;
 }
 
+static struct virt_dma_desc *d350_find_queued_desc(struct d350_chan *dch,
+						   dma_cookie_t cookie)
+{
+	struct virt_dma_desc *vd;
+
+	list_for_each_entry(vd, &dch->vc.desc_submitted, node)
+		if (vd->tx.cookie == cookie)
+			return vd;
+
+	return vchan_find_desc(&dch->vc, cookie);
+}
+
 static enum dma_status d350_tx_status(struct dma_chan *chan, dma_cookie_t cookie,
 				      struct dma_tx_state *state)
 {
@@ -407,7 +419,7 @@ static enum dma_status d350_tx_status(struct dma_chan *chan, dma_cookie_t cookie
 				dch->residue = d350_get_residue(dch);
 			residue = dch->residue;
 		} else {
-			vd = vchan_find_desc(&dch->vc, cookie);
+			vd = d350_find_queued_desc(dch, cookie);
 			if (vd) {
 				residue = d350_desc_bytes(to_d350_desc(vd));
 			} else if (status == DMA_IN_PROGRESS) {
-- 
2.54.0




More information about the linux-arm-kernel mailing list