From patchwork Tue Oct 10 14:50:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 9996467 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0A74D603FF for ; Tue, 10 Oct 2017 14:56:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE0552863B for ; Tue, 10 Oct 2017 14:56:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E27E328643; Tue, 10 Oct 2017 14:56:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, SUSPICIOUS_RECIPS autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A85B2863E for ; Tue, 10 Oct 2017 14:56:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932328AbdJJO4p (ORCPT ); Tue, 10 Oct 2017 10:56:45 -0400 Received: from mga06.intel.com ([134.134.136.31]:38548 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932325AbdJJO4m (ORCPT ); Tue, 10 Oct 2017 10:56:42 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP; 10 Oct 2017 07:56:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,505,1500966000"; d="scan'208";a="1229194434" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.125]) by fmsmga002.fm.intel.com with ESMTP; 10 Oct 2017 07:56:41 -0700 Subject: [PATCH v8 14/14] tools/testing/nvdimm: enable rdma unit tests From: Dan Williams To: linux-nvdimm@lists.01.org Cc: linux-rdma@vger.kernel.org, linux-api@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org Date: Tue, 10 Oct 2017 07:50:17 -0700 Message-ID: <150764701713.16882.9840394340145664403.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <150764693502.16882.15848797003793552156.stgit@dwillia2-desk3.amr.corp.intel.com> References: <150764693502.16882.15848797003793552156.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Provide a mock dma_get_iommu_domain() for the ibverbs core. Enable ib_umem_get() to satisfy its DAX safety checks for a controlled test. Signed-off-by: Dan Williams --- tools/testing/nvdimm/Kbuild | 31 +++++++++++++++++++++++++++++++ tools/testing/nvdimm/config_check.c | 2 ++ tools/testing/nvdimm/test/iomap.c | 14 ++++++++++++++ 3 files changed, 47 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/tools/testing/nvdimm/Kbuild b/tools/testing/nvdimm/Kbuild index d870520da68b..f4a007090950 100644 --- a/tools/testing/nvdimm/Kbuild +++ b/tools/testing/nvdimm/Kbuild @@ -15,11 +15,13 @@ ldflags-y += --wrap=insert_resource ldflags-y += --wrap=remove_resource ldflags-y += --wrap=acpi_evaluate_object ldflags-y += --wrap=acpi_evaluate_dsm +ldflags-y += --wrap=dma_get_iommu_domain DRIVERS := ../../../drivers NVDIMM_SRC := $(DRIVERS)/nvdimm ACPI_SRC := $(DRIVERS)/acpi/nfit DAX_SRC := $(DRIVERS)/dax +IBCORE := $(DRIVERS)/infiniband/core ccflags-y := -I$(src)/$(NVDIMM_SRC)/ obj-$(CONFIG_LIBNVDIMM) += libnvdimm.o @@ -33,6 +35,7 @@ obj-$(CONFIG_DAX) += dax.o endif obj-$(CONFIG_DEV_DAX) += device_dax.o obj-$(CONFIG_DEV_DAX_PMEM) += dax_pmem.o +obj-$(CONFIG_INFINIBAND) += ib_core.o nfit-y := $(ACPI_SRC)/core.o nfit-$(CONFIG_X86_MCE) += $(ACPI_SRC)/mce.o @@ -75,4 +78,32 @@ libnvdimm-$(CONFIG_NVDIMM_PFN) += $(NVDIMM_SRC)/pfn_devs.o libnvdimm-$(CONFIG_NVDIMM_DAX) += $(NVDIMM_SRC)/dax_devs.o libnvdimm-y += config_check.o +ib_core-y := $(IBCORE)/packer.o +ib_core-y += $(IBCORE)/ud_header.o +ib_core-y += $(IBCORE)/verbs.o +ib_core-y += $(IBCORE)/cq.o +ib_core-y += $(IBCORE)/rw.o +ib_core-y += $(IBCORE)/sysfs.o +ib_core-y += $(IBCORE)/device.o +ib_core-y += $(IBCORE)/fmr_pool.o +ib_core-y += $(IBCORE)/cache.o +ib_core-y += $(IBCORE)/netlink.o +ib_core-y += $(IBCORE)/roce_gid_mgmt.o +ib_core-y += $(IBCORE)/mr_pool.o +ib_core-y += $(IBCORE)/addr.o +ib_core-y += $(IBCORE)/sa_query.o +ib_core-y += $(IBCORE)/multicast.o +ib_core-y += $(IBCORE)/mad.o +ib_core-y += $(IBCORE)/smi.o +ib_core-y += $(IBCORE)/agent.o +ib_core-y += $(IBCORE)/mad_rmpp.o +ib_core-y += $(IBCORE)/security.o +ib_core-y += $(IBCORE)/nldev.o + +ib_core-$(CONFIG_INFINIBAND_USER_MEM) += $(IBCORE)/umem.o +ib_core-$(CONFIG_INFINIBAND_ON_DEMAND_PAGING) += $(IBCORE)/umem_odp.o +ib_core-$(CONFIG_INFINIBAND_ON_DEMAND_PAGING) += $(IBCORE)/umem_rbtree.o +ib_core-$(CONFIG_CGROUP_RDMA) += $(IBCORE)/cgroup.o +ib_core-y += config_check.o + obj-m += test/ diff --git a/tools/testing/nvdimm/config_check.c b/tools/testing/nvdimm/config_check.c index 7dc5a0af9b54..33e7c805bfd6 100644 --- a/tools/testing/nvdimm/config_check.c +++ b/tools/testing/nvdimm/config_check.c @@ -14,4 +14,6 @@ void check(void) BUILD_BUG_ON(!IS_MODULE(CONFIG_ACPI_NFIT)); BUILD_BUG_ON(!IS_MODULE(CONFIG_DEV_DAX)); BUILD_BUG_ON(!IS_MODULE(CONFIG_DEV_DAX_PMEM)); + BUILD_BUG_ON(!IS_ENABLED(CONFIG_INFINIBAND_USER_MEM)); + BUILD_BUG_ON(!IS_MODULE(CONFIG_INFINIBAND)); } diff --git a/tools/testing/nvdimm/test/iomap.c b/tools/testing/nvdimm/test/iomap.c index e1f75a1914a1..1e439b2b01e7 100644 --- a/tools/testing/nvdimm/test/iomap.c +++ b/tools/testing/nvdimm/test/iomap.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -388,4 +389,17 @@ union acpi_object * __wrap_acpi_evaluate_dsm(acpi_handle handle, const guid_t *g } EXPORT_SYMBOL(__wrap_acpi_evaluate_dsm); +/* + * This assumes that any iommu api routine we would call with this + * domain checks for NULL ops and either returns an error or does + * nothing. + */ +struct iommu_domain *__wrap_dma_get_iommu_domain(struct device *dev) +{ + static struct iommu_domain domain; + + return &domain; +} +EXPORT_SYMBOL(__wrap_dma_get_iommu_domain); + MODULE_LICENSE("GPL v2");