From patchwork Thu Jul 30 16:55:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 6905141 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 BB4E4C05AC for ; Thu, 30 Jul 2015 17:07:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C2D2720460 for ; Thu, 30 Jul 2015 17:07:55 +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 D7EEC20429 for ; Thu, 30 Jul 2015 17:07:54 +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 1ZKrHF-00065h-GI; Thu, 30 Jul 2015 17:05:53 +0000 Received: from mga01.intel.com ([192.55.52.88]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZKrDC-0000z8-Q3 for linux-arm-kernel@lists.infradead.org; Thu, 30 Jul 2015 17:01:45 +0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 30 Jul 2015 10:01:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,577,1432623600"; d="scan'208";a="774635816" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.11]) by orsmga002.jf.intel.com with ESMTP; 30 Jul 2015 10:01:06 -0700 Subject: [PATCH v3 19/24] pmem: switch from ioremap_wt to memremap From: Dan Williams To: tglx@linutronix.de, mingo@kernel.org, hpa@zytor.com Date: Thu, 30 Jul 2015 12:55:25 -0400 Message-ID: <20150730165524.33962.27724.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <20150730165155.33962.64121.stgit@dwillia2-desk3.amr.corp.intel.com> References: <20150730165155.33962.64121.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-8-g92dd MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150730_100143_112276_BEC2ECBD X-CRM114-Status: GOOD ( 11.29 ) X-Spam-Score: -8.3 (--------) 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, toshi.kani@hp.com, linux-nvdimm@lists.01.org, mcgrof@suse.com, linux-kernel@vger.kernel.org, rmk+kernel@arm.linux.org.uk, Ross Zwisler , hch@lst.de, 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=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 deprecating ioremap_wt() convert its usage in the PMEM API to memremap. Acked-by: Ross Zwisler Signed-off-by: Dan Williams --- include/linux/pmem.h | 2 +- tools/testing/nvdimm/Kbuild | 4 ++-- tools/testing/nvdimm/test/iomap.c | 34 +++++++++++++++++++++++++--------- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/include/linux/pmem.h b/include/linux/pmem.h index d2114045a6c4..1bf74c735fa0 100644 --- a/include/linux/pmem.h +++ b/include/linux/pmem.h @@ -94,7 +94,7 @@ static void default_memcpy_to_pmem(void __pmem *dst, const void *src, static void __pmem *default_memremap_pmem(resource_size_t offset, unsigned long size) { - return (void __pmem __force *)ioremap_wt(offset, size); + return (void __pmem *) memremap(offset, size, MEMREMAP_WT); } /** diff --git a/tools/testing/nvdimm/Kbuild b/tools/testing/nvdimm/Kbuild index de2912ea78e8..8032a49f7873 100644 --- a/tools/testing/nvdimm/Kbuild +++ b/tools/testing/nvdimm/Kbuild @@ -1,7 +1,7 @@ -ldflags-y += --wrap=ioremap_wt ldflags-y += --wrap=ioremap_wc ldflags-y += --wrap=devm_ioremap_nocache -ldflags-y += --wrap=arch_memremap_pmem +ldflags-y += --wrap=memremap +ldflags-y += --wrap=memunmap ldflags-y += --wrap=ioremap_nocache ldflags-y += --wrap=iounmap ldflags-y += --wrap=__request_region diff --git a/tools/testing/nvdimm/test/iomap.c b/tools/testing/nvdimm/test/iomap.c index f8486f98f860..21288f34a5ca 100644 --- a/tools/testing/nvdimm/test/iomap.c +++ b/tools/testing/nvdimm/test/iomap.c @@ -80,11 +80,20 @@ void __iomem *__wrap_devm_ioremap_nocache(struct device *dev, } EXPORT_SYMBOL(__wrap_devm_ioremap_nocache); -void *__wrap_arch_memremap_pmem(resource_size_t offset, size_t size) +void *__wrap_memremap(resource_size_t offset, size_t size, + unsigned long flags) { - return __nfit_test_ioremap(offset, size, arch_memremap_pmem); + struct nfit_test_resource *nfit_res; + + rcu_read_lock(); + nfit_res = get_nfit_res(offset); + rcu_read_unlock(); + if (nfit_res) + return (void __iomem *) nfit_res->buf + offset + - nfit_res->res->start; + return memremap(offset, size, flags); } -EXPORT_SYMBOL(__wrap_arch_memremap_pmem); +EXPORT_SYMBOL(__wrap_memremap); void __iomem *__wrap_ioremap_nocache(resource_size_t offset, unsigned long size) { @@ -92,12 +101,6 @@ void __iomem *__wrap_ioremap_nocache(resource_size_t offset, unsigned long size) } EXPORT_SYMBOL(__wrap_ioremap_nocache); -void __iomem *__wrap_ioremap_wt(resource_size_t offset, unsigned long size) -{ - return __nfit_test_ioremap(offset, size, ioremap_wt); -} -EXPORT_SYMBOL(__wrap_ioremap_wt); - void __iomem *__wrap_ioremap_wc(resource_size_t offset, unsigned long size) { return __nfit_test_ioremap(offset, size, ioremap_wc); @@ -117,6 +120,19 @@ void __wrap_iounmap(volatile void __iomem *addr) } EXPORT_SYMBOL(__wrap_iounmap); +void __wrap_memunmap(void *addr) +{ + struct nfit_test_resource *nfit_res; + + rcu_read_lock(); + nfit_res = get_nfit_res((unsigned long) addr); + rcu_read_unlock(); + if (nfit_res) + return; + return memunmap(addr); +} +EXPORT_SYMBOL(__wrap_memunmap); + struct resource *__wrap___request_region(struct resource *parent, resource_size_t start, resource_size_t n, const char *name, int flags)