DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal: add option --iso-cmem for external custom memory
@ 2019-10-15  5:30 Ajit Khaparde
  2019-10-17 15:45 ` Burakov, Anatoly
  0 siblings, 1 reply; 18+ messages in thread
From: Ajit Khaparde @ 2019-10-15  5:30 UTC (permalink / raw)
  To: dev
  Cc: Rajesh Ravi, Jonathan Richardson, Scott Branden, Vikram Mysore Prakash

From: Rajesh Ravi <rajesh.ravi@broadcom.com>

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 <rajesh.ravi@broadcom.com>
Reviewed-by: Jonathan Richardson <jonathan.richardson@broadcom.com>
Reviewed-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Vikram Mysore Prakash <vikram.prakash@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 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)


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2019-11-08 16:17 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-15  5:30 [dpdk-dev] [PATCH] eal: add option --iso-cmem for external custom memory Ajit Khaparde
2019-10-17 15:45 ` Burakov, Anatoly
2019-10-18 10:54   ` Rajesh Ravi
2019-10-18 16:53     ` Burakov, Anatoly
2019-10-21 15:46       ` Rajesh Ravi
2019-10-22  7:56         ` Rajesh Ravi
2019-10-24 11:43           ` Burakov, Anatoly
2019-10-25 12:53             ` Rajesh Ravi
2019-10-25 15:02               ` Burakov, Anatoly
2019-10-30 19:50                 ` Rajesh Ravi
2019-11-04 10:25                   ` Burakov, Anatoly
2019-11-05 11:41                     ` Burakov, Anatoly
2019-11-05 14:10                       ` Rajesh Ravi
2019-11-05 15:18                         ` Burakov, Anatoly
2019-11-05 17:13                           ` Burakov, Anatoly
2019-11-06 13:55                             ` David Marchand
2019-11-07 15:51                               ` David Marchand
2019-11-07 16:16                                 ` Rajesh Ravi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).