Skip to contentSkip to conversation

dmaengine: zynqmp_dma: Add device_synchronize support

PATCH Applied Swati Agarwal 2 participants 2 messages Sep 15, 2022 – Sep 29, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: zynqmp_dma: Add device_synchronize support

dmaengine_synchronize implementation is required to synchronize proper termination of current transfers so that any memory resources are not freed while still in use.

Implement this callback in the driver so that framework can use the same (in dmaengine_terminate_sync/ dmaengine_synchronize).

---
 drivers/dma/xilinx/zynqmp_dma.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/dma/xilinx/zynqmp_dma.c +12 -0
index a156e5f40fc5..0525caf1f998 100644
@@ -795,6 +795,17 @@ static int zynqmp_dma_device_terminate_all(struct dma_chan *dchan)
 	return 0;
 }
 
+/**
+ * zynqmp_dma_synchronize - Synchronizes the termination of a transfers to the current context.
+ * @dchan: DMA channel pointer
+ */
+static void zynqmp_dma_synchronize(struct dma_chan *dchan)
+{
+	struct zynqmp_dma_chan *chan = to_chan(dchan);
+
+	tasklet_kill(&chan->tasklet);
+}
+
 /**
  * zynqmp_dma_prep_memcpy - prepare descriptors for memcpy transaction
  * @dchan: DMA channel
@@ -1057,6 +1068,7 @@ static int zynqmp_dma_probe(struct platform_device *pdev)
 	p = &zdev->common;
 	p->device_prep_dma_memcpy = zynqmp_dma_prep_memcpy;
 	p->device_terminate_all = zynqmp_dma_device_terminate_all;
+	p->device_synchronize = zynqmp_dma_synchronize;
 	p->device_issue_pending = zynqmp_dma_issue_pending;
 	p->device_alloc_chan_resources = zynqmp_dma_alloc_chan_resources;
 	p->device_free_chan_resources = zynqmp_dma_free_chan_resources;
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw
Quoted 6 lines · Swati Agarwal

dmaengine_synchronize implementation is required to synchronize proper termination of current transfers so that any memory resources are not freed while still in use.

Implement this callback in the driver so that framework can use the same (in dmaengine_terminate_sync/ dmaengine_synchronize).

Applied, thanks

Signature · 1 line
~Vinod