浏览代码

dmaengine: ppc4xx/adma: 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: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Dave Jiang 9 年之前
父节点
当前提交
ed9f2c5896
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/dma/ppc4xx/adma.c

+ 1 - 1
drivers/dma/ppc4xx/adma.c

@@ -1482,11 +1482,11 @@ static dma_cookie_t ppc440spe_adma_run_tx_complete_actions(
 		cookie = desc->async_tx.cookie;
 		cookie = desc->async_tx.cookie;
 		desc->async_tx.cookie = 0;
 		desc->async_tx.cookie = 0;
 
 
+		dma_descriptor_unmap(&desc->async_tx);
 		/* call the callback (must not sleep or submit new
 		/* call the callback (must not sleep or submit new
 		 * operations to this channel)
 		 * operations to this channel)
 		 */
 		 */
 		dmaengine_desc_get_callback_invoke(&desc->async_tx, NULL);
 		dmaengine_desc_get_callback_invoke(&desc->async_tx, NULL);
-		dma_descriptor_unmap(&desc->async_tx);
 	}
 	}
 
 
 	/* run dependent operations */
 	/* run dependent operations */