ARM: support generic per-device coherent dma mem

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

authored by Dmitry Baryshkov and committed by Ingo Molnar 1fe53268 538c29d4

+11
+1
arch/arm/Kconfig
··· 16 16 select HAVE_KRETPROBES if (HAVE_KPROBES) 17 17 select HAVE_FTRACE if (!XIP_KERNEL) 18 18 select HAVE_DYNAMIC_FTRACE if (HAVE_FTRACE) 19 + select HAVE_GENERIC_DMA_COHERENT 19 20 help 20 21 The ARM series is a line of low-power-consumption RISC chip designs 21 22 licensed by ARM Ltd and targeted at embedded applications and
+8
arch/arm/mm/consistent.c
··· 274 274 void * 275 275 dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp) 276 276 { 277 + void *memory; 278 + 279 + if (dma_alloc_from_coherent(dev, size, handle, &memory)) 280 + return memory; 281 + 277 282 if (arch_is_coherent()) { 278 283 void *virt; 279 284 ··· 366 361 u32 off; 367 362 368 363 WARN_ON(irqs_disabled()); 364 + 365 + if (dma_release_from_coherent(dev, get_order(size), cpu_addr)) 366 + return; 369 367 370 368 if (arch_is_coherent()) { 371 369 kfree(cpu_addr);
+2
include/asm-arm/dma-mapping.h
··· 7 7 8 8 #include <linux/scatterlist.h> 9 9 10 + #include <asm-generic/dma-coherent.h> 11 + 10 12 /* 11 13 * DMA-consistent mapping functions. These allocate/free a region of 12 14 * uncached, unwrite-buffered mapped memory space for use with DMA