From patchwork Tue Aug 11 03:38:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 6987911 Return-Path: X-Original-To: patchwork-linux-nvdimm@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 39B4CC05AC for ; Tue, 11 Aug 2015 03:44:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5FBB520547 for ; Tue, 11 Aug 2015 03:44:13 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 91DAD20552 for ; Tue, 11 Aug 2015 03:44:11 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8603A1826E6; Mon, 10 Aug 2015 20:44:11 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by ml01.01.org (Postfix) with ESMTP id BE165182671 for ; Mon, 10 Aug 2015 20:44:10 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 10 Aug 2015 20:44:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,650,1432623600"; d="scan'208";a="539514579" Received: from dwillia2-desk3.jf.intel.com (HELO otcpl-bsw-rvp-2.jf.intel.com) ([10.54.39.137]) by FMSMGA003.fm.intel.com with ESMTP; 10 Aug 2015 20:44:11 -0700 Subject: [PATCH v4 07/10] pmem: switch from ioremap_wt to memremap From: Dan Williams To: linux-kernel@vger.kernel.org Date: Mon, 10 Aug 2015 23:38:28 -0400 Message-ID: <20150811033828.4987.46863.stgit@otcpl-bsw-rvp-2.jf.intel.com> In-Reply-To: <20150811033345.4987.17983.stgit@otcpl-bsw-rvp-2.jf.intel.com> References: <20150811033345.4987.17983.stgit@otcpl-bsw-rvp-2.jf.intel.com> User-Agent: StGit/0.17.1-8-g92dd MIME-Version: 1.0 Cc: linux-nvdimm@lists.01.org, hch@lst.de X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, 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 Signed-off-by: Christoph Hellwig --- 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)