From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 77C8CA2EFC for ; Tue, 15 Oct 2019 07:30:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 003FE1C21A; Tue, 15 Oct 2019 07:30:57 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id D03071C217 for ; Tue, 15 Oct 2019 07:30:55 +0200 (CEST) Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.242.48]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 51EAC30C175; Mon, 14 Oct 2019 22:29:04 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 51EAC30C175 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1571117344; bh=ALck2IMATl/5RVe50gLHhOJ/3N+7KEEaGmES0Td0qpk=; h=From:To:Cc:Subject:Date:From; b=DcUw6N0ZfIx8QjG5D75TjINuqxkn4KXk8MYAIYZdU0Z4NnFrgR5gzonIwEIGcqp10 61KuStf033TZvXkrzjiFlkVXuxTo62FmibbeFmyfN+KM4zJmNlqfj2G6ocXRv9+72R 0IcynHgf8WLth129XZo3I8RpiPdSIIwcAgOLgwwo= Received: from localhost.localdomain (unknown [10.230.30.225]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 879E914008D; Mon, 14 Oct 2019 22:30:51 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: Rajesh Ravi , Jonathan Richardson , Scott Branden , Vikram Mysore Prakash Date: Mon, 14 Oct 2019 22:30:47 -0700 Message-Id: <20191015053047.52260-1-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] eal: add option --iso-cmem for external custom memory X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Rajesh Ravi Support external custom memory added to heap to be used with vfio with --iso-cmem option.Type1 memory mapping was by passed for external memory. But an exception is added to allow external custom memory to be used with vfio. Signed-off-by: Rajesh Ravi Reviewed-by: Jonathan Richardson Reviewed-by: Scott Branden Reviewed-by: Vikram Mysore Prakash Reviewed-by: Ajit Khaparde --- lib/librte_eal/common/eal_common_options.c | 5 +++++ lib/librte_eal/common/eal_internal_cfg.h | 1 + lib/librte_eal/common/eal_options.h | 2 ++ lib/librte_eal/linux/eal/eal_vfio.c | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index 05cae5f75..b46fb3870 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -78,6 +78,7 @@ eal_long_options[] = { {OPT_VDEV, 1, NULL, OPT_VDEV_NUM }, {OPT_VFIO_INTR, 1, NULL, OPT_VFIO_INTR_NUM }, {OPT_VMWARE_TSC_MAP, 0, NULL, OPT_VMWARE_TSC_MAP_NUM }, + {OPT_ISO_CMEM, 0, NULL, OPT_ISO_CMEM_NUM }, {OPT_LEGACY_MEM, 0, NULL, OPT_LEGACY_MEM_NUM }, {OPT_SINGLE_FILE_SEGMENTS, 0, NULL, OPT_SINGLE_FILE_SEGMENTS_NUM}, {OPT_MATCH_ALLOCATIONS, 0, NULL, OPT_MATCH_ALLOCATIONS_NUM}, @@ -1327,6 +1328,10 @@ eal_parse_common_option(int opt, const char *optarg, conf->no_hpet = 1; break; + case OPT_ISO_CMEM_NUM: + conf->iso_cmem = 1; + break; + case OPT_VMWARE_TSC_MAP_NUM: conf->vmware_tsc_map = 1; break; diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h index a42f34923..fb64b5f79 100644 --- a/lib/librte_eal/common/eal_internal_cfg.h +++ b/lib/librte_eal/common/eal_internal_cfg.h @@ -43,6 +43,7 @@ struct internal_config { volatile unsigned no_hugetlbfs; /**< true to disable hugetlbfs */ unsigned hugepage_unlink; /**< true to unlink backing files */ volatile unsigned no_pci; /**< true to disable PCI */ + unsigned int iso_cmem; /**< true to enable isolated cmem */ volatile unsigned no_hpet; /**< true to disable HPET */ volatile unsigned vmware_tsc_map; /**< true to use VMware TSC mapping * instead of native TSC */ diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h index 9855429e5..f56e2536b 100644 --- a/lib/librte_eal/common/eal_options.h +++ b/lib/librte_eal/common/eal_options.h @@ -61,6 +61,8 @@ enum { OPT_VFIO_INTR_NUM, #define OPT_VMWARE_TSC_MAP "vmware-tsc-map" OPT_VMWARE_TSC_MAP_NUM, +#define OPT_ISO_CMEM "iso-cmem" + OPT_ISO_CMEM_NUM, #define OPT_LEGACY_MEM "legacy-mem" OPT_LEGACY_MEM_NUM, #define OPT_SINGLE_FILE_SEGMENTS "single-file-segments" diff --git a/lib/librte_eal/linux/eal/eal_vfio.c b/lib/librte_eal/linux/eal/eal_vfio.c index 501c74f23..8fbad63cc 100644 --- a/lib/librte_eal/linux/eal/eal_vfio.c +++ b/lib/librte_eal/linux/eal/eal_vfio.c @@ -1250,7 +1250,7 @@ type1_map(const struct rte_memseg_list *msl, const struct rte_memseg *ms, { int *vfio_container_fd = arg; - if (msl->external) + if (msl->external & !internal_config.iso_cmem) return 0; return vfio_type1_dma_mem_map(*vfio_container_fd, ms->addr_64, ms->iova, -- 2.20.1 (Apple Git-117)