Skip to content

Commit 1a96f3a

Browse files
committed
iommu/dma: add missing support for DMA_ATTR_MMIO for dma_iova_unlink()
Commit c288d65 added support for DMA_ATTR_MMIO attribute in the dma_iova_link() code path, but missed that the CPU cache is being also touched in the dma_iova_unlink() path. Fix this. Fixes: c288d65 ("iommu/dma: implement DMA_ATTR_MMIO for dma_iova_link().") Signed-off-by: Marek Szyprowski <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a50f745 commit 1a96f3a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/iommu/dma-iommu.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,7 +2008,7 @@ static void iommu_dma_iova_unlink_range_slow(struct device *dev,
20082008
end - addr, iovad->granule - iova_start_pad);
20092009

20102010
if (!dev_is_dma_coherent(dev) &&
2011-
!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
2011+
!(attrs & (DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_MMIO)))
20122012
arch_sync_dma_for_cpu(phys, len, dir);
20132013

20142014
swiotlb_tbl_unmap_single(dev, phys, len, dir, attrs);
@@ -2032,7 +2032,8 @@ static void __iommu_dma_iova_unlink(struct device *dev,
20322032
size_t unmapped;
20332033

20342034
if ((state->__size & DMA_IOVA_USE_SWIOTLB) ||
2035-
(!dev_is_dma_coherent(dev) && !(attrs & DMA_ATTR_SKIP_CPU_SYNC)))
2035+
(!dev_is_dma_coherent(dev) &&
2036+
!(attrs & (DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_MMIO))))
20362037
iommu_dma_iova_unlink_range_slow(dev, addr, size, dir, attrs);
20372038

20382039
iommu_iotlb_gather_init(&iotlb_gather);

0 commit comments

Comments
 (0)