Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754106AbcLIPrX (ORCPT ); Fri, 9 Dec 2016 10:47:23 -0500 Received: from mail-qk0-f169.google.com ([209.85.220.169]:35452 "EHLO mail-qk0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753521AbcLIPrV (ORCPT ); Fri, 9 Dec 2016 10:47:21 -0500 MIME-Version: 1.0 In-Reply-To: <584ACF82.5090609@arm.com> References: <1480600080-30196-1-git-send-email-benjamin.gaignard@linaro.org> <584ACF82.5090609@arm.com> From: Benjamin Gaignard Date: Fri, 9 Dec 2016 16:47:20 +0100 Message-ID: Subject: Re: [PATCH] nommu: allow mmap when !CONFIG_MMU To: Vladimir Murzin Cc: linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, Linux Kernel Mailing List , Robin.Murphy@arm.com, Catalin Marinas , Arnd Bergmann Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id uB9FlS1v013357 Content-Length: 2092 Lines: 66 2016-12-09 16:36 GMT+01:00 Vladimir Murzin : > On 09/12/16 15:27, Benjamin Gaignard wrote: >> + Vladimir > > I'm not in DMA, but I can see that with your patch it deviates from > dma_common_mmap(), can you give more context, please? I'm working on ARM platform with MMU (stm32f4) to enable display driver. Framebuffer is allocated with dma_alloc_wc() and when userland try to mmap drm/kms fraemwork calls dma_mmap_wc(). All this is in drivers/gpu/drm/drm_gem_cma_helper.c dma_mmap_wc() call failed because __arm_dma_mmap() always return an error if CONFIG_MMU isn't defined. That what I try to solve with this patch. > Cheers > Vladimir > >> >> 2016-12-01 14:48 GMT+01:00 Benjamin Gaignard : >>> 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 >>> Cc: Catalin Marinas >>> 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, >>> vma->vm_page_prot); >>> } >>> +#else >>> + ret = vm_iomap_memory(vma, vma->vm_start, >>> + (vma->vm_end - vma->vm_start)); >>> #endif /* CONFIG_MMU */ >>> >>> return ret; >>> -- >>> 1.9.1 >>> >> > -- Benjamin Gaignard Graphic Study Group Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog