Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iommu/dma: add missing support for DMA_ATTR_MMIO for dma_iova_unlink()

Commit c288d657dd51 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: c288d657dd51 ("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

+3 -2
+3 -2
drivers/iommu/dma-iommu.c
··· 2008 2008 end - addr, iovad->granule - iova_start_pad); 2009 2009 2010 2010 if (!dev_is_dma_coherent(dev) && 2011 - !(attrs & DMA_ATTR_SKIP_CPU_SYNC)) 2011 + !(attrs & (DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_MMIO))) 2012 2012 arch_sync_dma_for_cpu(phys, len, dir); 2013 2013 2014 2014 swiotlb_tbl_unmap_single(dev, phys, len, dir, attrs); ··· 2032 2032 size_t unmapped; 2033 2033 2034 2034 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)))) 2036 2037 iommu_dma_iova_unlink_range_slow(dev, addr, size, dir, attrs); 2037 2038 2038 2039 iommu_iotlb_gather_init(&iotlb_gather);