summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaura Abbott <lauraa@codeaurora.org>2014-03-14 19:52:24 (GMT)
committerChanho Park <chanho61.park@samsung.com>2014-04-16 12:36:51 (GMT)
commit333aa349b7d050c8b35ed2cb80bdb6f0bef84224 (patch)
tree02ed5c3520da82cb1d333d6875803658cc08974d
parentdb621579175a7a81097a422e67e689e8242aa43b (diff)
downloadlinux-3.10-333aa349b7d050c8b35ed2cb80bdb6f0bef84224.zip
linux-3.10-333aa349b7d050c8b35ed2cb80bdb6f0bef84224.tar.gz
linux-3.10-333aa349b7d050c8b35ed2cb80bdb6f0bef84224.tar.bz2
arm64: Support DMA_ATTR_WRITE_COMBINE
DMA_ATTR_WRITE_COMBINE is currently ignored. Set the pgprot appropriately for non coherent opperations. Signed-off-by: Laura Abbott <lauraa@codeaurora.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r--arch/arm64/mm/dma-mapping.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index 81eea3d..5bba6be 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -30,6 +30,16 @@
struct dma_map_ops *dma_ops;
EXPORT_SYMBOL(dma_ops);
+static pgprot_t __get_dma_pgprot(struct dma_attrs *attrs, pgprot_t prot,
+ bool coherent)
+{
+ if (dma_get_attr(DMA_ATTR_WRITE_COMBINE, attrs))
+ return pgprot_writecombine(prot);
+ else if (!coherent)
+ return pgprot_dmacoherent(prot);
+ return prot;
+}
+
static void *__dma_alloc_coherent(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t flags,
struct dma_attrs *attrs)
@@ -104,7 +114,7 @@ static void *__dma_alloc_noncoherent(struct device *dev, size_t size,
for (i = 0; i < (size >> PAGE_SHIFT); i++)
map[i] = page + i;
coherent_ptr = vmap(map, size >> PAGE_SHIFT, VM_MAP,
- pgprot_dmacoherent(pgprot_default));
+ __get_dma_pgprot(attrs, pgprot_default, false));
kfree(map);
if (!coherent_ptr)
goto no_map;
@@ -250,7 +260,7 @@ static int __swiotlb_mmap_noncoherent(struct device *dev,
void *cpu_addr, dma_addr_t dma_addr, size_t size,
struct dma_attrs *attrs)
{
- vma->vm_page_prot = pgprot_dmacoherent(vma->vm_page_prot);
+ vma->vm_page_prot = __get_dma_pgprot(attrs, vma->vm_page_prot, false);
return __dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
}