From patchwork Fri Oct 9 22:15:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 7364561 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E5941BFD59 for ; Fri, 9 Oct 2015 22:23:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E912320760 for ; Fri, 9 Oct 2015 22:23:48 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EC28D207DA for ; Fri, 9 Oct 2015 22:23:47 +0000 (UTC) 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 1Zkg32-00011c-WB; Fri, 09 Oct 2015 22:21:57 +0000 Received: from mga14.intel.com ([192.55.52.115]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zkg2x-0000xi-Ng for linux-arm-kernel@lists.infradead.org; Fri, 09 Oct 2015 22:21:52 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 09 Oct 2015 15:21:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,660,1437462000"; d="scan'208";a="788865163" Received: from dwillia2-desk3.jf.intel.com ([10.54.39.39]) by orsmga001.jf.intel.com with ESMTP; 09 Oct 2015 15:21:30 -0700 Subject: [PATCH 02/20] arm: introduce arch_memremap() From: Dan Williams To: linux-kernel@vger.kernel.org Date: Fri, 09 Oct 2015 18:15:48 -0400 Message-ID: <20151009221548.32203.75285.stgit@dwillia2-desk3.jf.intel.com> In-Reply-To: <20151009221537.32203.5867.stgit@dwillia2-desk3.jf.intel.com> References: <20151009221537.32203.5867.stgit@dwillia2-desk3.jf.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151009_152151_967518_780EBBC9 X-CRM114-Status: GOOD ( 11.20 ) X-Spam-Score: -6.9 (------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Russell King , Ross Zwisler , Arnd Bergmann , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In preparation for removing ioremap_cache() introduce arch_memremap() for arm. For now, arch_memremap(..., MEMREMAP_WB) is an alias for ioremap_cache(). Note that arch_memremap() is relying on memremap() to handle remap requests to "System RAM". Cc: Arnd Bergmann Cc: Russell King Cc: Ross Zwisler Signed-off-by: Dan Williams --- arch/arm/Kconfig | 1 + arch/arm/include/asm/io.h | 1 + arch/arm/mm/ioremap.c | 11 +++++++++++ arch/arm/mm/nommu.c | 10 ++++++++++ arch/arm64/Kconfig | 1 + arch/arm64/mm/ioremap.c | 10 ++++++++++ 6 files changed, 34 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 72ad724c67ae..882771cfc63c 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -3,6 +3,7 @@ config ARM default y select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE select ARCH_HAS_ELF_RANDOMIZE + select ARCH_HAS_MEMREMAP select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAVE_CUSTOM_GPIO_H select ARCH_HAS_GCOV_PROFILE_ALL diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index 485982084fe9..ca76d59cb6f3 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -356,6 +356,7 @@ static inline void memcpy_toio(volatile void __iomem *to, const void *from, * ioremap() Device n/a n/a * ioremap_nocache() Device n/a n/a * ioremap_cache() Normal Writeback Read allocate + * memremap(WB) Normal Writeback Read allocate * ioremap_wc() Normal Non-cacheable n/a * ioremap_wt() Normal Non-cacheable n/a * diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c index 0c81056c1dd7..f6249b98ed16 100644 --- a/arch/arm/mm/ioremap.c +++ b/arch/arm/mm/ioremap.c @@ -385,6 +385,17 @@ void __iomem *ioremap_cache(resource_size_t res_cookie, size_t size) } EXPORT_SYMBOL(ioremap_cache); +void *arch_memremap(resource_size_t res_cookie, size_t size, + unsigned long flags) +{ + if ((flags & MEMREMAP_WB) == 0) + return NULL; + + return (void __force *) arch_ioremap_caller(res_cookie, size, + MT_DEVICE_CACHED, __builtin_return_address(0)); +} +EXPORT_SYMBOL(arch_memremap); + void __iomem *ioremap_wc(resource_size_t res_cookie, size_t size) { return arch_ioremap_caller(res_cookie, size, MT_DEVICE_WC, diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c index 1dd10936d68d..d88353e1fe80 100644 --- a/arch/arm/mm/nommu.c +++ b/arch/arm/mm/nommu.c @@ -373,6 +373,16 @@ void __iomem *ioremap_cache(resource_size_t res_cookie, size_t size) } EXPORT_SYMBOL(ioremap_cache); +void *arch_memremap(resource_size_t res_cookie, size_t size, unsigned long flags) +{ + if ((flags & MEMREMAP_WB) == 0) + return NULL; + + return (void __force *) __arm_ioremap_caller(res_cookie, size, + MT_DEVICE_CACHED, __builtin_return_address(0)); +} +EXPORT_SYMBOL(arch_memremap); + void __iomem *ioremap_wc(resource_size_t res_cookie, size_t size) { return __arm_ioremap_caller(res_cookie, size, MT_DEVICE_WC, diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 07d1811aa03f..54ea0688586f 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -6,6 +6,7 @@ config ARM64 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_GCOV_PROFILE_ALL + select ARCH_HAS_MEMREMAP select ARCH_HAS_SG_CHAIN select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_USE_CMPXCHG_LOCKREF diff --git a/arch/arm64/mm/ioremap.c b/arch/arm64/mm/ioremap.c index 01e88c8bcab0..9db5a12654a0 100644 --- a/arch/arm64/mm/ioremap.c +++ b/arch/arm64/mm/ioremap.c @@ -104,6 +104,16 @@ void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size) } EXPORT_SYMBOL(ioremap_cache); +void *arch_memremap(phys_addr_t phys_addr, size_t size, unsigned long flags) +{ + if ((flags & MEMREMAP_WB) == 0) + return NULL; + + return (void __force *) __ioremap_caller(phys_addr, size, + __pgprot(PROT_NORMAL), __builtin_return_address(0)); +} +EXPORT_SYMBOL(arch_memremap); + /* * Must be called after early_fixmap_init */