Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1516142
| From | Marek Szyprowski <m.szyprowski@samsung.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] iommu/dma-iommu: properly respect configured address space size |
| Date | 2016-11-07 14:20 +0100 |
| Message-ID | <sAS0a-3Aq-29@gated-at.bofh.it> (permalink) |
| References | <sAS0a-3Aq-31@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
When one called iommu_dma_init_domain() with size smaller than device's DMA mask, the alloc_iova() will not respect it and always assume that all IOVA addresses will be allocated from the the (base ... dev->dma_mask) range. This patch fixes this issue by taking the configured address space size parameter into account (if it is smaller than the device's dma_mask). Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> --- drivers/iommu/dma-iommu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index c5ab8667e6f2..8b4b72654359 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -212,11 +212,13 @@ static struct iova *__alloc_iova(struct iommu_domain *domain, size_t size, if (domain->geometry.force_aperture) dma_limit = min(dma_limit, domain->geometry.aperture_end); + + dma_limit = min(dma_limit >> shift, (dma_addr_t)iovad->dma_32bit_pfn); /* * Enforce size-alignment to be safe - there could perhaps be an * attribute to control this per-device, or at least per-domain... */ - return alloc_iova(iovad, length, dma_limit >> shift, true); + return alloc_iova(iovad, length, dma_limit, true); } /* The IOVA allocator knows what we mapped, so just unmap whatever that was */ -- 1.9.1
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] iommu/dma-iommu: properly respect configured address space size Marek Szyprowski <m.szyprowski@samsung.com> - 2016-11-07 14:20 +0100
Re: [PATCH] iommu/dma-iommu: properly respect configured address space size Robin Murphy <robin.murphy@arm.com> - 2016-11-08 12:50 +0100
Re: [PATCH] iommu/dma-iommu: properly respect configured address space size Marek Szyprowski <m.szyprowski@samsung.com> - 2016-11-08 15:00 +0100
Re: [PATCH] iommu/dma-iommu: properly respect configured address space size Robin Murphy <robin.murphy@arm.com> - 2016-11-08 15:50 +0100
Re: [PATCH] iommu/dma-iommu: properly respect configured address space size Marek Szyprowski <m.szyprowski@samsung.com> - 2016-11-08 16:00 +0100
Re: [PATCH] iommu/dma-iommu: properly respect configured address space size Robin Murphy <robin.murphy@arm.com> - 2016-11-10 15:10 +0100
Re: [PATCH] iommu/dma-iommu: properly respect configured address space size Joerg Roedel <joro@8bytes.org> - 2016-11-10 17:00 +0100
Re: [PATCH] iommu/dma-iommu: properly respect configured address space size Robin Murphy <robin.murphy@arm.com> - 2016-11-10 17:20 +0100
csiph-web