]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.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)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 20 Sep 2017 08:07:54 +0000 (10:07 +0200)
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 8880a3cfd9295d0b19596d2df13eef46e4a8d179..21ea0a367ec82ca98ca959f6e0dfd7309c4aef7f 100644 (file)
@@ -1313,7 +1313,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;
 
@@ -1365,7 +1366,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;