mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
iommu/dma: add missing support for DMA_ATTR_MMIO for dma_iova_unlink()
Commitc288d657ddadded 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:c288d657dd("iommu/dma: implement DMA_ATTR_MMIO for dma_iova_link().") Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Leon Romanovsky <leon@kernel.org> Link: https://lore.kernel.org/r/20251124170955.3884351-1-m.szyprowski@samsung.com
This commit is contained in:
@@ -2008,7 +2008,7 @@ static void iommu_dma_iova_unlink_range_slow(struct device *dev,
|
|||||||
end - addr, iovad->granule - iova_start_pad);
|
end - addr, iovad->granule - iova_start_pad);
|
||||||
|
|
||||||
if (!dev_is_dma_coherent(dev) &&
|
if (!dev_is_dma_coherent(dev) &&
|
||||||
!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
|
!(attrs & (DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_MMIO)))
|
||||||
arch_sync_dma_for_cpu(phys, len, dir);
|
arch_sync_dma_for_cpu(phys, len, dir);
|
||||||
|
|
||||||
swiotlb_tbl_unmap_single(dev, phys, len, dir, attrs);
|
swiotlb_tbl_unmap_single(dev, phys, len, dir, attrs);
|
||||||
@@ -2032,7 +2032,8 @@ static void __iommu_dma_iova_unlink(struct device *dev,
|
|||||||
size_t unmapped;
|
size_t unmapped;
|
||||||
|
|
||||||
if ((state->__size & DMA_IOVA_USE_SWIOTLB) ||
|
if ((state->__size & DMA_IOVA_USE_SWIOTLB) ||
|
||||||
(!dev_is_dma_coherent(dev) && !(attrs & DMA_ATTR_SKIP_CPU_SYNC)))
|
(!dev_is_dma_coherent(dev) &&
|
||||||
|
!(attrs & (DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_MMIO))))
|
||||||
iommu_dma_iova_unlink_range_slow(dev, addr, size, dir, attrs);
|
iommu_dma_iova_unlink_range_slow(dev, addr, size, dir, attrs);
|
||||||
|
|
||||||
iommu_iotlb_gather_init(&iotlb_gather);
|
iommu_iotlb_gather_init(&iotlb_gather);
|
||||||
|
|||||||
Reference in New Issue
Block a user