From patchwork Tue Aug 26 16:58:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 383171 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C96DE1400DD for ; Wed, 27 Aug 2014 03:02:13 +1000 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XMK5L-0007On-OK; Tue, 26 Aug 2014 16:59:07 +0000 Received: from smtp.codeaurora.org ([198.145.11.231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XMK5J-0007Di-04 for linux-arm-kernel@lists.infradead.org; Tue, 26 Aug 2014 16:59:05 +0000 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 07A6D13FAE5; Tue, 26 Aug 2014 16:58:44 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id EE4A613FB01; Tue, 26 Aug 2014 16:58:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-caf-smtp.dmz.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.1 Received: from [10.42.111.116] (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: lauraa@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id E78E913FAE5; Tue, 26 Aug 2014 16:58:42 +0000 (UTC) Message-ID: <53FCBCC3.5040901@codeaurora.org> Date: Tue, 26 Aug 2014 09:58:43 -0700 From: Laura Abbott User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: James Hogan , Catalin Marinas , Andrew Morton Subject: Re: [PATCHv7 3/5] common: dma-mapping: Introduce common remapping functions References: <1407800431-21566-1-git-send-email-lauraa@codeaurora.org> <1407800431-21566-4-git-send-email-lauraa@codeaurora.org> In-Reply-To: X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140826_095905_095333_D78BF3D1 X-CRM114-Status: GOOD ( 25.29 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Russell King , Arnd Bergmann , Will Deacon , LKML , linux-mm , Thierry Reding , linux-next@vger.kernel.org, Ritesh Harjain , David Riley , ARM Kernel List X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org On 8/26/2014 3:05 AM, James Hogan wrote: > On 12 August 2014 00:40, Laura Abbott wrote: >> >> For architectures without coherent DMA, memory for DMA may >> need to be remapped with coherent attributes. Factor out >> the the remapping code from arm and put it in a >> common location to reduce code duplication. >> >> As part of this, the arm APIs are now migrated away from >> ioremap_page_range to the common APIs which use map_vm_area for remapping. >> This should be an equivalent change and using map_vm_area is more >> correct as ioremap_page_range is intended to bring in io addresses >> into the cpu space and not regular kernel managed memory. >> >> Reviewed-by: Catalin Marinas >> Signed-off-by: Laura Abbott > > This commit in linux-next () breaks the build for metag: > > drivers/base/dma-mapping.c: In function ‘dma_common_contiguous_remap’: > drivers/base/dma-mapping.c:294: error: implicit declaration of > function ‘dma_common_pages_remap’ > drivers/base/dma-mapping.c:294: warning: assignment makes pointer from > integer without a cast > drivers/base/dma-mapping.c: At top level: > drivers/base/dma-mapping.c:308: error: conflicting types for > ‘dma_common_pages_remap’ > drivers/base/dma-mapping.c:294: error: previous implicit declaration > of ‘dma_common_pages_remap’ was here > > Looks like metag isn't alone either: > > $ git grep -L dma-mapping-common arch/*/include/asm/dma-mapping.h > arch/arc/include/asm/dma-mapping.h > arch/avr32/include/asm/dma-mapping.h > arch/blackfin/include/asm/dma-mapping.h > arch/c6x/include/asm/dma-mapping.h > arch/cris/include/asm/dma-mapping.h > arch/frv/include/asm/dma-mapping.h > arch/m68k/include/asm/dma-mapping.h > arch/metag/include/asm/dma-mapping.h > arch/mn10300/include/asm/dma-mapping.h > arch/parisc/include/asm/dma-mapping.h > arch/xtensa/include/asm/dma-mapping.h > > I've checked a couple of these arches (blackfin, xtensa) which don't > include dma-mapping-common.h and their builds seem to be broken too. > > Cheers > James > Thanks for the report. Would you mind giving the following patch a test (this is theoretical only but I think it should work) -----8<------ From 81c9a5504cbc1d72ff1df084d48502b248cd79d0 Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Tue, 26 Aug 2014 09:50:49 -0700 Subject: [PATCH] common: dma-mapping: Swap function order Fix the order of dma_common_contiguous_remap and dma_common_pages_remap to avoid function declaration errors: drivers/base/dma-mapping.c: In function 'dma_common_contiguous_remap': drivers/base/dma-mapping.c:294: error: implicit declaration of function 'dma_common_pages_remap' drivers/base/dma-mapping.c:294: warning: assignment makes pointer from integer without a cast drivers/base/dma-mapping.c: At top level: drivers/base/dma-mapping.c:308: error: conflicting types for 'dma_common_pages_remap' drivers/base/dma-mapping.c:294: error: previous implicit declaration of 'dma_common_pages_remap' was here Change-Id: I65db739114e8f5816a24a279a2ff1a6dc92e2b83 Reported-by: James Hogan Reported-by: kbuild test robot Signed-off-by: Laura Abbott --- drivers/base/dma-mapping.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c index 1bc46df..056fd46 100644 --- a/drivers/base/dma-mapping.c +++ b/drivers/base/dma-mapping.c @@ -271,6 +271,28 @@ int dma_common_mmap(struct device *dev, struct vm_area_struct *vma, EXPORT_SYMBOL(dma_common_mmap); /* + * remaps an array of PAGE_SIZE pages into another vm_area + * Cannot be used in non-sleeping contexts + */ +void *dma_common_pages_remap(struct page **pages, size_t size, + unsigned long vm_flags, pgprot_t prot, + const void *caller) +{ + struct vm_struct *area; + + area = get_vm_area_caller(size, vm_flags, caller); + if (!area) + return NULL; + + if (map_vm_area(area, prot, pages)) { + vunmap(area->addr); + return NULL; + } + + return area->addr; +} + +/* * remaps an allocated contiguous region into another vm_area. * Cannot be used in non-sleeping contexts */ @@ -299,28 +321,6 @@ void *dma_common_contiguous_remap(struct page *page, size_t size, } /* - * remaps an array of PAGE_SIZE pages into another vm_area - * Cannot be used in non-sleeping contexts - */ -void *dma_common_pages_remap(struct page **pages, size_t size, - unsigned long vm_flags, pgprot_t prot, - const void *caller) -{ - struct vm_struct *area; - - area = get_vm_area_caller(size, vm_flags, caller); - if (!area) - return NULL; - - if (map_vm_area(area, prot, pages)) { - vunmap(area->addr); - return NULL; - } - - return area->addr; -} - -/* * unmaps a range previously mapped by dma_common_*_remap */ void dma_common_free_remap(void *cpu_addr, size_t size, unsigned long vm_flags)