Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933067AbbFJLU5 (ORCPT ); Wed, 10 Jun 2015 07:20:57 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:33353 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754214AbbFJLUu (ORCPT ); Wed, 10 Jun 2015 07:20:50 -0400 MIME-Version: 1.0 In-Reply-To: <1433351745-3646-1-git-send-email-lorenx4@gmail.com> References: <1433351745-3646-1-git-send-email-lorenx4@gmail.com> Date: Wed, 10 Jun 2015 13:20:48 +0200 Message-ID: Subject: Re: [RFC PATCH v2] arm DMA: Fix allocation from CMA for coherent DMA From: Lorenzo Nava To: Arnd Bergmann Cc: Russell King - ARM Linux , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Catalin Marinas , Lorenzo Nava 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-Length: 1950 Lines: 49 ping! On Wed, Jun 3, 2015 at 7:15 PM, Lorenzo Nava wrote: > This patch allows the use of CMA for DMA coherent memory allocation. > At the moment if the input parameter "is_coherent" is set to true > the allocation is not made using the CMA, which I think is not the > desired behaviour. > > Signed-off-by: Lorenzo Nava > --- > Changes in v2: > correct __arm_dma_free() according to __dma_alloc() allocation > --- > arch/arm/mm/dma-mapping.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c > index 7e7583d..15643b9 100644 > --- a/arch/arm/mm/dma-mapping.c > +++ b/arch/arm/mm/dma-mapping.c > @@ -645,9 +645,9 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, > size = PAGE_ALIGN(size); > want_vaddr = !dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, attrs); > > - if (is_coherent || nommu()) > + if (nommu()) > addr = __alloc_simple_buffer(dev, size, gfp, &page); > - else if (!(gfp & __GFP_WAIT)) > + else if (!is_coherent && !(gfp & __GFP_WAIT)) > addr = __alloc_from_pool(size, &page); > else if (!dev_get_cma_area(dev)) > addr = __alloc_remap_buffer(dev, size, gfp, prot, &page, caller, want_vaddr); > @@ -735,7 +735,7 @@ static void __arm_dma_free(struct device *dev, size_t size, void *cpu_addr, > > size = PAGE_ALIGN(size); > > - if (is_coherent || nommu()) { > + if (nommu()) { > __dma_free_buffer(page, size); > } else if (__free_from_pool(cpu_addr, size)) { > return; > -- > 1.7.10.4 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/