[v4,1/4] nommu: allow mmap when !CONFIG_MMU

Message ID 1481105211-18020-2-git-send-email-benjamin.gaignard@linaro.org
State Accepted
Commit 79964a1c2972ca7ecc231e2d2ac7593a1af73f63
Headers show

Commit Message

Benjamin Gaignard Dec. 7, 2016, 10:06 a.m.
commit ab6494f0c96f ("nommu: Add noMMU support to the DMA API") have
add CONFIG_MMU compilation flag but that prohibit to use dma_mmap_wc()
when the platform doesn't have MMU.

This patch call vm_iomap_memory() in noMMU case to test if addresses
are correct and set wma->vm_flags rather than all return an error.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: arnd@arndb.de
 arch/arm/mm/dma-mapping.c | 3 +++
 1 file changed, 3 insertions(+)


diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index ab4f745..230875e 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -868,6 +868,9 @@  static int __arm_dma_mmap(struct device *dev, struct vm_area_struct *vma,
 				      vma->vm_end - vma->vm_start,
+	ret = vm_iomap_memory(vma, vma->vm_start,
+			      (vma->vm_end - vma->vm_start));
 #endif	/* CONFIG_MMU */
 	return ret;