DMA Engine development
 help / color / mirror / Atom feed
* [4/5] dmaengine: mv_xor_v2: move unmap to before callback
@ 2018-07-17 10:30 hannah
  0 siblings, 0 replies; only message in thread
From: hannah @ 2018-07-17 10:30 UTC (permalink / raw)
  To: dan.j.williams, vkoul, dmaengine
  Cc: thomas.petazzoni, linux-kernel, nadavh, omrii, oferh,
	gregory.clement, Hanna Hawa

From: Hanna Hawa <hannah@marvell.com>

Completion callback should happen after dma_descriptor_unmap() has
happened. This allow the cache invalidate to happen and ensure that
the data accessed by the upper layer is in memory that was from DMA
rather than stale data. On some architecture this is done by the
hardware, however we should make the code consistent to not cause
confusion.

Signed-off-by: Hanna Hawa <hannah@marvell.com>
Reviewed-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 drivers/dma/mv_xor_v2.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/dma/mv_xor_v2.c b/drivers/dma/mv_xor_v2.c
index 14e2a7a..d41d916 100644
--- a/drivers/dma/mv_xor_v2.c
+++ b/drivers/dma/mv_xor_v2.c
@@ -589,10 +589,9 @@ static void mv_xor_v2_tasklet(unsigned long data)
 			 */
 			dma_cookie_complete(&next_pending_sw_desc->async_tx);
 
+			dma_descriptor_unmap(&next_pending_sw_desc->async_tx);
 			dmaengine_desc_get_callback_invoke(
 					&next_pending_sw_desc->async_tx, NULL);
-
-			dma_descriptor_unmap(&next_pending_sw_desc->async_tx);
 		}
 
 		dma_run_dependencies(&next_pending_sw_desc->async_tx);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-07-17 10:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-17 10:30 [4/5] dmaengine: mv_xor_v2: move unmap to before callback hannah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox