浏览代码

dmaengine: mv_xor_v2: move unmap to before callback

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>
Hanna Hawa 7 年之前
父节点
当前提交
c3a272c7b0
共有 1 个文件被更改,包括 1 次插入2 次删除
  1. 1 2
      drivers/dma/mv_xor_v2.c

+ 1 - 2
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_cookie_complete(&next_pending_sw_desc->async_tx);
 
 
+			dma_descriptor_unmap(&next_pending_sw_desc->async_tx);
 			dmaengine_desc_get_callback_invoke(
 			dmaengine_desc_get_callback_invoke(
 					&next_pending_sw_desc->async_tx, NULL);
 					&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);
 		dma_run_dependencies(&next_pending_sw_desc->async_tx);