Skip to content

Commit

Permalink
dmaengine: xgene-dma: move unmap to before callback
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Rameshwar Prasad Sahu <[email protected]>
Signed-off-by: Vinod Koul <[email protected]>
  • Loading branch information
davejiang authored and Vinod Koul committed Aug 8, 2016
1 parent ed9f2c5 commit fd3c69b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/dma/xgene-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,12 +606,11 @@ static void xgene_dma_run_tx_complete_actions(struct xgene_dma_chan *chan,
return;

dma_cookie_complete(tx);
dma_descriptor_unmap(tx);

/* Run the link descriptor callback function */
dmaengine_desc_get_callback_invoke(tx, NULL);

dma_descriptor_unmap(tx);

/* Run any dependencies */
dma_run_dependencies(tx);
}
Expand Down

0 comments on commit fd3c69b

Please sign in to comment.