Where a device driver has set a 64-bit DMA mask to indicate the absence of addressing limitations, we still need to ensure that we don't allocate IOVAs beyond the actual input size of the IOMMU. The reported aperture is the most reliable way we have of inferring that input address size, so use that to enforce a hard upper limit.
Signed-off-by: Robin Murphy <robin.mur...@arm.com> --- This is the only other thing I currently have which could perhaps be considered a fix; otherwise I'll pull it into the PCI/SMMU series. drivers/iommu/dma-iommu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 7d991c81c4fa..092d781f5f35 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -158,6 +158,8 @@ static struct iova *__alloc_iova(struct iova_domain *iovad, size_t size, unsigned long shift = iova_shift(iovad); unsigned long length = iova_align(iovad, size) >> shift; + if (domain->geometry.force_aperture) + dma_limit &= domain->geometry.aperture_end; /* * Enforce size-alignment to be safe - there could perhaps be an * attribute to control this per-device, or at least per-domain... -- 2.8.1.dirty _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu