Re: [PATCH v2 3/4] iommu/dma-iommu: Use the dev->coherent_dma_mask

From: Christoph Hellwig
Date: Tue Apr 30 2019 - 07:12:33 EST


> static dma_addr_t __iommu_dma_map(struct device *dev, phys_addr_t phys,
> - size_t size, int prot, struct iommu_domain *domain)
> + size_t size, int prot, struct iommu_domain *domain,
> + dma_addr_t dma_limit)

Can we just call this dma_mask?

> static void iommu_dma_unmap_resource(struct device *dev, dma_addr_t handle,
> @@ -1250,7 +1251,8 @@ static struct iommu_dma_msi_page *iommu_dma_get_msi_page(struct device *dev,
> if (!msi_page)
> return NULL;
>
> - iova = __iommu_dma_map(dev, msi_addr, size, prot, domain);
> + iova = __iommu_dma_map(dev, msi_addr, size, prot, domain,
> + dma_get_mask(dev));

Hmm, I don't think we need the DMA mask for the MSI mapping, this
should probably always use a 64-bit mask. Or we could just untangle
it from the DMA mapping fast path entire, something like:

---