linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: zynqmp_dma: Add device_synchronize support
@ 2022-09-15  9:05 Swati Agarwal
  2022-09-29 16:48 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Swati Agarwal @ 2022-09-15  9:05 UTC (permalink / raw)
  To: vkoul, dmaengine, linux-arm-kernel, linux-kernel
  Cc: harini.katakam, radhey.shyam.pandey, michal.simek,
	appana.durga.kedareswara.rao, 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).

Signed-off-by: Swati Agarwal <swati.agarwal@amd.com>
---
 drivers/dma/xilinx/zynqmp_dma.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
index a156e5f40fc5..0525caf1f998 100644
--- a/drivers/dma/xilinx/zynqmp_dma.c
+++ b/drivers/dma/xilinx/zynqmp_dma.c
@@ -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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dmaengine: zynqmp_dma: Add device_synchronize support
  2022-09-15  9:05 [PATCH] dmaengine: zynqmp_dma: Add device_synchronize support Swati Agarwal
@ 2022-09-29 16:48 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2022-09-29 16:48 UTC (permalink / raw)
  To: Swati Agarwal
  Cc: dmaengine, linux-arm-kernel, linux-kernel, harini.katakam,
	radhey.shyam.pandey, michal.simek, appana.durga.kedareswara.rao

On 15-09-22, 14:35, Swati Agarwal wrote:
> 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

-- 
~Vinod

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-29 16:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-15  9:05 [PATCH] dmaengine: zynqmp_dma: Add device_synchronize support Swati Agarwal
2022-09-29 16:48 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).