Skip to content

Commit 6e23502

Browse files
pippy360joergroedel
authored andcommitted
iommu/dma-iommu: Use the dev->coherent_dma_mask
Use the dev->coherent_dma_mask when allocating in the dma-iommu ops api. Signed-off-by: Tom Murphy <murphyt7@tcd.ie> Reviewed-by: Robin Murphy <robin.murphy@arm.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 795bbbb commit 6e23502

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

‎drivers/iommu/dma-iommu.c‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ static void __iommu_dma_unmap(struct device *dev, dma_addr_t dma_addr,
478478
}
479479

480480
static dma_addr_t __iommu_dma_map(struct device *dev, phys_addr_t phys,
481-
size_t size, int prot)
481+
size_t size, int prot, dma_addr_t dma_mask)
482482
{
483483
struct iommu_domain *domain = iommu_get_dma_domain(dev);
484484
struct iommu_dma_cookie *cookie = domain->iova_cookie;
@@ -491,7 +491,7 @@ static dma_addr_t __iommu_dma_map(struct device *dev, phys_addr_t phys,
491491

492492
size = iova_align(iovad, size + iova_off);
493493

494-
iova = iommu_dma_alloc_iova(domain, size, dma_get_mask(dev), dev);
494+
iova = iommu_dma_alloc_iova(domain, size, dma_mask, dev);
495495
if (!iova)
496496
return DMA_MAPPING_ERROR;
497497

@@ -733,7 +733,7 @@ static dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page,
733733
int prot = dma_info_to_prot(dir, coherent, attrs);
734734
dma_addr_t dma_handle;
735735

736-
dma_handle = __iommu_dma_map(dev, phys, size, prot);
736+
dma_handle = __iommu_dma_map(dev, phys, size, prot, dma_get_mask(dev));
737737
if (!coherent && !(attrs & DMA_ATTR_SKIP_CPU_SYNC) &&
738738
dma_handle != DMA_MAPPING_ERROR)
739739
arch_sync_dma_for_device(dev, phys, size, dir);
@@ -936,7 +936,8 @@ static dma_addr_t iommu_dma_map_resource(struct device *dev, phys_addr_t phys,
936936
size_t size, enum dma_data_direction dir, unsigned long attrs)
937937
{
938938
return __iommu_dma_map(dev, phys, size,
939-
dma_info_to_prot(dir, false, attrs) | IOMMU_MMIO);
939+
dma_info_to_prot(dir, false, attrs) | IOMMU_MMIO,
940+
dma_get_mask(dev));
940941
}
941942

942943
static void iommu_dma_unmap_resource(struct device *dev, dma_addr_t handle,
@@ -1042,7 +1043,8 @@ static void *iommu_dma_alloc(struct device *dev, size_t size,
10421043
if (!cpu_addr)
10431044
return NULL;
10441045

1045-
*handle = __iommu_dma_map(dev, page_to_phys(page), size, ioprot);
1046+
*handle = __iommu_dma_map(dev, page_to_phys(page), size, ioprot,
1047+
dev->coherent_dma_mask);
10461048
if (*handle == DMA_MAPPING_ERROR) {
10471049
__iommu_dma_free(dev, size, cpu_addr);
10481050
return NULL;

0 commit comments

Comments
 (0)