Merge tag 'dma-mapping-6.9-2024-03-24' of git://git.infradead.org/users/hch/dma-mapping
[sfrench/cifs-2.6.git] / drivers / iommu / dma-iommu.c
index 639efa0c40721c80220720b178a3d0287647fc5c..e4cb26f6a9434e37b8a9e2da872bc80071229520 100644 (file)
@@ -859,6 +859,11 @@ static dma_addr_t __iommu_dma_map(struct device *dev, phys_addr_t phys,
            iommu_deferred_attach(dev, domain))
                return DMA_MAPPING_ERROR;
 
+       /* If anyone ever wants this we'd need support in the IOVA allocator */
+       if (dev_WARN_ONCE(dev, dma_get_min_align_mask(dev) > iova_mask(iovad),
+           "Unsupported alignment constraint\n"))
+               return DMA_MAPPING_ERROR;
+
        size = iova_align(iovad, size + iova_off);
 
        iova = iommu_dma_alloc_iova(domain, size, dma_mask, dev);