]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
arm64: mm: Fix a bug in iommu dma-mapping
authorSricharan R <sricharan@codeaurora.org>
Tue, 21 Apr 2015 14:30:37 +0000 (20:00 +0530)
committerSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Mon, 11 Jan 2016 09:54:39 +0000 (09:54 +0000)
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>
arch/arm64/mm/dma-mapping.c

index 5130f1cb8cf42bf489fd7b76d7dc23c07ec888c5..aac69ad4897545b423e14975bf8906b43ba8c0ee 100644 (file)
@@ -1309,7 +1309,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;
 
@@ -1361,7 +1362,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;