Skip to content
Commit 449fa54d authored by Fugang Duan's avatar Fugang Duan Committed by Christoph Hellwig
Browse files

dma-direct: correct the physical addr in dma_direct_sync_sg_for_cpu/device



dma_map_sg() may use swiotlb buffer when the kernel command line includes
"swiotlb=force" or the dma_addr is out of dev->dma_mask range.  After
DMA complete the memory moving from device to memory, then user call
dma_sync_sg_for_cpu() to sync with DMA buffer, and copy the original
virtual buffer to other space.

So dma_direct_sync_sg_for_cpu() should use swiotlb physical addr, not
the original physical addr from sg_phys(sg).

dma_direct_sync_sg_for_device() also has the same issue, correct it as
well.

Fixes: 55897af6("dma-direct: merge swiotlb_dma_ops into the dma_direct code")
Signed-off-by: default avatarFugang Duan <fugang.duan@nxp.com>
Reviewed-by: default avatarRobin Murphy <robin.murphy@arm.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent a5008b59
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment