Skip to content

Commit aa7243a

Browse files
committed
Merge tag 'dma-mapping-6.18-2025-11-27' of git://git.kernel.org/pub/scm/linux/kernel/git/mszyprowski/linux
Pull dma-mapping fixes from Marek Szyprowski: "Two last minute fixes for the recently modified DMA API infrastructure: - proper handling of DMA_ATTR_MMIO in dma_iova_unlink() function (me) - regression fix for the code refactoring related to P2PDMA (Pranjal Shrivastava)" * tag 'dma-mapping-6.18-2025-11-27' of git://git.kernel.org/pub/scm/linux/kernel/git/mszyprowski/linux: dma-direct: Fix missing sg_dma_len assignment in P2PDMA bus mappings iommu/dma: add missing support for DMA_ATTR_MMIO for dma_iova_unlink()
2 parents 3fa7787 + d0d08f4 commit aa7243a

2 files changed

Lines changed: 4 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);

kernel/dma/direct.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
481481
case PCI_P2PDMA_MAP_BUS_ADDR:
482482
sg->dma_address = pci_p2pdma_bus_addr_map(&p2pdma_state,
483483
sg_phys(sg));
484+
sg_dma_len(sg) = sg->length;
484485
sg_dma_mark_bus_address(sg);
485486
continue;
486487
default:

0 commit comments

Comments
 (0)