From patchwork Wed May 30 08:59:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9044 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 4471723EB5 for ; Wed, 30 May 2012 09:00:24 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id E87DBA185DD for ; Wed, 30 May 2012 09:00:23 +0000 (UTC) Received: by yhpp61 with SMTP id p61so3660625yhp.11 for ; Wed, 30 May 2012 02:00:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:date:from :in-reply-to:to:message-id:x-mailer:references:x-tm-as-mml:cc :subject:x-beenthere:x-mailman-version:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:sender :errors-to:x-gm-message-state; bh=iGdVo2YusVDub4AHKF8MObJKzGBcQR02YOtRMozlXc0=; b=eKe9CypLsFdjOyYEnAOfc8UZEjr6Etp0OqCh6IlMfkZLdfiIc47Y3ajPX6huzGqYmp PgR4Ycy2aAzLgm6oH9b+fMO5GTWnQw+ekYzLqH66PswjU/8wgw3+ESmnhgS84humKnzt GII0U18SotljkABgoL7c5DiKVOsLhft2kIyEBySt97gLM5KunA2tEgC2cJigAHXdaPar LQY3Y7RWNKZx26lR4l+nz5j1pG0Cy5U0KLD2W2pXTm/lWiO7fmM/WAlnn5KMe/6hJ7tA VbRlaSMD6SufmngJ7EKLFMZBQTMhNzcD0sUG92LxmnP4SxjsrGOImzVy0sfrs31F57fD cl0A== Received: by 10.50.40.193 with SMTP id z1mr9903429igk.0.1338368423353; Wed, 30 May 2012 02:00:23 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp179384ibb; Wed, 30 May 2012 02:00:22 -0700 (PDT) Received: by 10.14.45.14 with SMTP id o14mr5741715eeb.189.1338368421515; Wed, 30 May 2012 02:00:21 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id ff6si16531519wib.47.2012.05.30.02.00.20; Wed, 30 May 2012 02:00:21 -0700 (PDT) Received-SPF: neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) client-ip=91.189.95.16; Authentication-Results: mx.google.com; spf=neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) smtp.mail=linaro-mm-sig-bounces@lists.linaro.org Received: from localhost ([127.0.0.1] helo=mombin.canonical.com) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SZelJ-00079y-Pq; Wed, 30 May 2012 09:00:14 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SZelH-00078v-LK for linaro-mm-sig@lists.linaro.org; Wed, 30 May 2012 09:00:12 +0000 Received: from euspt1 (mailout1.w1.samsung.com [210.118.77.11]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M4T002G1VP4TO40@mailout1.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Wed, 30 May 2012 10:00:40 +0100 (BST) Received: from linux.samsung.com ([106.116.38.10]) by spt1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0M4T00FXYVO7RC@spt1.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Wed, 30 May 2012 10:00:08 +0100 (BST) Received: from mcdsrvbld02.digital.local (unknown [106.116.37.23]) by linux.samsung.com (Postfix) with ESMTP id C0D8427004B; Wed, 30 May 2012 11:14:23 +0200 (CEST) Date: Wed, 30 May 2012 10:59:51 +0200 From: Marek Szyprowski In-reply-to: <20120529122932.GA24623@n2100.arm.linux.org.uk> To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-mm-sig@lists.linaro.org Message-id: <1338368391-25057-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.7.10 References: <20120529122932.GA24623@n2100.arm.linux.org.uk> X-TM-AS-MML: No Cc: Russell King , Arnd Bergmann , Michal Nazarewicz , Kyungmin Park , Andrew Morton , Linus Torvalds Subject: [Linaro-mm-sig] [PATCH] ARM: dma-mapping: remove unconditional dependency on CMA X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Unified memory management interest group." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linaro-mm-sig-bounces@lists.linaro.org Errors-To: linaro-mm-sig-bounces@lists.linaro.org X-Gm-Message-State: ALoCoQlTTTNlabwgrhkslEo4XPfzk3y5uFFFrIOBIglXREBmhvND03h8D5kPlu0WW+7XGuxV1D+i CMA has been enabled unconditionally on all ARMv6+ systems to solve the long standing issue of double kernel mappings for all dma coherent buffers. This however created a dependency on CONFIG_EXPERIMENTAL for the whole ARM architecture what should be really avoided. This patch removes this dependency and lets one use old, well-tested dma-mapping implementation also on ARMv6+ systems without the need to use EXPERIMENTAL stuff. Reported-by: Russell King Signed-off-by: Marek Szyprowski --- arch/arm/Kconfig | 1 - arch/arm/mm/dma-mapping.c | 10 ++++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 5e76013..ca7354f 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -7,7 +7,6 @@ config ARM select HAVE_IDE if PCI || ISA || PCMCIA select HAVE_DMA_ATTRS select HAVE_DMA_CONTIGUOUS if (CPU_V6 || CPU_V6K || CPU_V7) - select CMA if (CPU_V6 || CPU_V6K || CPU_V7) select HAVE_MEMBLOCK select RTC_LIB select SYS_SUPPORTS_APM_EMULATION diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index ea6b431..106c4c0 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -268,10 +268,8 @@ static int __init consistent_init(void) unsigned long base = consistent_base; unsigned long num_ptes = (CONSISTENT_END - base) >> PMD_SHIFT; -#ifndef CONFIG_ARM_DMA_USE_IOMMU - if (cpu_architecture() >= CPU_ARCH_ARMv6) + if (IS_ENABLED(CONFIG_CMA) && !IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) return 0; -#endif consistent_pte = kmalloc(num_ptes * sizeof(pte_t), GFP_KERNEL); if (!consistent_pte) { @@ -342,7 +340,7 @@ static int __init coherent_init(void) struct page *page; void *ptr; - if (cpu_architecture() < CPU_ARCH_ARMv6) + if (!IS_ENABLED(CONFIG_CMA)) return 0; ptr = __alloc_from_contiguous(NULL, size, prot, &page); @@ -704,7 +702,7 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, if (arch_is_coherent() || nommu()) addr = __alloc_simple_buffer(dev, size, gfp, &page); - else if (cpu_architecture() < CPU_ARCH_ARMv6) + else if (!IS_ENABLED(CONFIG_CMA)) addr = __alloc_remap_buffer(dev, size, gfp, prot, &page, caller); else if (gfp & GFP_ATOMIC) addr = __alloc_from_pool(dev, size, &page, caller); @@ -773,7 +771,7 @@ void arm_dma_free(struct device *dev, size_t size, void *cpu_addr, if (arch_is_coherent() || nommu()) { __dma_free_buffer(page, size); - } else if (cpu_architecture() < CPU_ARCH_ARMv6) { + } else if (!IS_ENABLED(CONFIG_CMA)) { __dma_free_remap(cpu_addr, size); __dma_free_buffer(page, size); } else {