[PATCH 1/7] dma: fsl-edma: Add write barrier after TCD descriptor fill

Jean-Michel Hautbois
2025-11-24T12:50:34Z

Add dma_wmb() barrier after filling TCD descriptors to ensure all
descriptor writes are visible to the DMA engine before starting
transfers. This prevents potential race conditions where the DMA
hardware might read partially written descriptors.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
---
drivers/dma/fsl-edma-common.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
index 4976d7dde08090d16277af4b9f784b9745485320..db36a6aafc910364d75ce6c5d334fd19d2120b6b 100644
--- a/drivers/dma/fsl-edma-common.c
+++ b/drivers/dma/fsl-edma-common.c
@@ -553,6 +553,9 @@ void fsl_edma_fill_tcd(struct fsl_edma_chan *fsl_chan,
fsl_edma_set_tcd_to_le(fsl_chan, tcd, csr, csr);

trace_edma_fill_tcd(fsl_chan, tcd);
+
+ /* Ensure descriptor writes are visible to DMA engine */
+ dma_wmb();
}

static struct fsl_edma_desc *fsl_edma_alloc_desc(struct fsl_edma_chan *fsl_chan,

--
2.39.5