aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSricharan R <sricharan@codeaurora.org>2015-04-21 20:00:37 +0530
committerSrinivas Kandagatla <srinivas.kandagatla@linaro.org>2016-07-05 14:12:09 +0100
commit73b3b53058470295765f97a355bfbbbd88e0f5ed (patch)
treeb7552fc8b84b6a31b78b1b3a0c456c1b7e41b870
parent90aa281e71355d8f67e31478611d0ccfa36065ef (diff)
arm64: mm: Fix a bug in iommu dma-mapping
iommu_alloc_attrs and arm_iommu_mmap_attrs calls dma_pgprot with device type set to always 'coherent' which is wrong. Should be based on the device type. Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
-rw-r--r--arch/arm64/mm/dma-mapping.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index 17562a9e363ec..0a5c1209eaa74 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -1281,7 +1281,8 @@ static void __iommu_free_atomic(struct device *dev, void *cpu_addr,
static void *arm_iommu_alloc_attrs(struct device *dev, size_t size,
dma_addr_t *handle, gfp_t gfp, struct dma_attrs *attrs)
{
- pgprot_t prot = __get_dma_pgprot(attrs, PAGE_KERNEL, true);
+ pgprot_t prot = __get_dma_pgprot(attrs, PAGE_KERNEL,
+ is_device_dma_coherent(dev));
struct page **pages;
void *addr = NULL;
@@ -1333,7 +1334,8 @@ static int arm_iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma,
unsigned long usize = vma->vm_end - vma->vm_start;
struct page **pages = __iommu_get_pages(cpu_addr, attrs);
- vma->vm_page_prot = __get_dma_pgprot(attrs, vma->vm_page_prot, true);
+ vma->vm_page_prot = __get_dma_pgprot(attrs, vma->vm_page_prot,
+ is_device_dma_coherent(dev));
if (!pages)
return -ENXIO;