dmaengine: mv_xor_v2: move unmap to before callback
authorHanna Hawa <hannah@marvell.com>
Tue, 17 Jul 2018 10:30:02 +0000 (13:30 +0300)
committerVinod Koul <vkoul@kernel.org>
Fri, 20 Jul 2018 09:31:58 +0000 (15:01 +0530)
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>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/mv_xor_v2.c

index 14e2a7a2e80b57ce966143f099434b1fc9f65db5..d41d916f40fac1cc3b61aa046816666ff5caeb76 100644 (file)
@@ -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);