* [dpdk-dev] [PATCH v2 1/2] eal: add eal option to configure iova mode
@ 2018-09-18 19:10 eric zhang
2018-09-18 19:10 ` [dpdk-dev] [PATCH v2 2/2] eal: force IOVA to particular mode eric zhang
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: eric zhang @ 2018-09-18 19:10 UTC (permalink / raw)
To: anatoly.burakov, santosh.shukla; +Cc: dev, Allain.Legacy, Matt.Peters
From: Santosh Shukla <santosh.shukla@caviumnetworks.com>
In the case of user don't want to use bus iova scheme and want
to override.
For that, Adding eal option --iova-mode=<string> where valid input
string is 'pa' or 'va'.
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
lib/librte_eal/common/eal_common_options.c | 30 ++++++++++++++++++++++++++++++
lib/librte_eal/common/eal_internal_cfg.h | 1 +
lib/librte_eal/common/eal_options.h | 2 ++
3 files changed, 33 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 996a034..ab2a28c 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -82,6 +82,7 @@
{OPT_HELP, 0, NULL, OPT_HELP_NUM },
{OPT_HUGE_DIR, 1, NULL, OPT_HUGE_DIR_NUM },
{OPT_HUGE_UNLINK, 0, NULL, OPT_HUGE_UNLINK_NUM },
+ {OPT_IOVA_MODE, 1, NULL, OPT_IOVA_MODE_NUM },
{OPT_LCORES, 1, NULL, OPT_LCORES_NUM },
{OPT_LOG_LEVEL, 1, NULL, OPT_LOG_LEVEL_NUM },
{OPT_MASTER_LCORE, 1, NULL, OPT_MASTER_LCORE_NUM },
@@ -218,6 +219,7 @@ struct device_option {
#endif
internal_cfg->vmware_tsc_map = 0;
internal_cfg->create_uio_dev = 0;
+ internal_cfg->iova_mode = -1;
internal_cfg->mbuf_pool_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
}
@@ -994,6 +996,25 @@ static int xdigit2val(unsigned char c)
return RTE_PROC_INVALID;
}
+static int
+eal_parse_iova_mode(const char *name)
+{
+ int mode;
+
+ if (name == NULL)
+ return -1;
+
+ if (!strcmp("pa", name))
+ mode = RTE_IOVA_PA;
+ else if (!strcmp("va", name))
+ mode = RTE_IOVA_VA;
+ else
+ return -1;
+
+ internal_config.iova_mode = mode;
+ return 0;
+}
+
int
eal_parse_common_option(int opt, const char *optarg,
struct internal_config *conf)
@@ -1158,6 +1179,13 @@ static int xdigit2val(unsigned char c)
}
core_parsed = 1;
break;
+ case OPT_IOVA_MODE_NUM:
+ if (eal_parse_iova_mode(optarg) < 0) {
+ RTE_LOG(ERR, EAL, "invalid parameters for --"
+ OPT_IOVA_MODE "\n");
+ return -1;
+ }
+ break;
/* don't know what to do, leave this to caller */
default:
@@ -1306,6 +1334,8 @@ static int xdigit2val(unsigned char c)
" -h, --help This help\n"
"\nEAL options for DEBUG use only:\n"
" --"OPT_HUGE_UNLINK" Unlink hugepage files after init\n"
+ " --"OPT_IOVA_MODE" Set iova mode. 'pa' for IOVA_PA\n"
+ " 'va' for IOVA_VA\n"
" --"OPT_NO_HUGE" Use malloc instead of hugetlbfs\n"
" --"OPT_NO_PCI" Disable PCI\n"
" --"OPT_NO_HPET" Disable HPET\n"
diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
index fa6ccbe..29bf53f 100644
--- a/lib/librte_eal/common/eal_internal_cfg.h
+++ b/lib/librte_eal/common/eal_internal_cfg.h
@@ -83,6 +83,7 @@ struct internal_config {
const char *hugepage_dir; /**< specific hugetlbfs directory to use */
const char *mbuf_pool_ops_name; /**< mbuf pool ops name */
unsigned num_hugepage_sizes; /**< how many sizes on this system */
+ enum rte_iova_mode iova_mode ; /**< Set iova mode on this system */
struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
};
extern struct internal_config internal_config; /**< Global EAL configuration. */
diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h
index 30e6bb4..7786189 100644
--- a/lib/librte_eal/common/eal_options.h
+++ b/lib/librte_eal/common/eal_options.h
@@ -83,6 +83,8 @@ enum {
OPT_VFIO_INTR_NUM,
#define OPT_VMWARE_TSC_MAP "vmware-tsc-map"
OPT_VMWARE_TSC_MAP_NUM,
+#define OPT_IOVA_MODE "iova-mode"
+ OPT_IOVA_MODE_NUM,
OPT_LONG_MAX_NUM
};
--
1.8.3.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v2 2/2] eal: force IOVA to particular mode
2018-09-18 19:10 [dpdk-dev] [PATCH v2 1/2] eal: add eal option to configure iova mode eric zhang
@ 2018-09-18 19:10 ` eric zhang
2018-09-24 20:42 ` Zhang, Qing Long (Eric)
` (2 more replies)
2018-09-26 7:10 ` [dpdk-dev] [PATCH v2 1/2] eal: add eal option to configure iova mode Hemant
2018-09-26 12:42 ` Burakov, Anatoly
2 siblings, 3 replies; 11+ messages in thread
From: eric zhang @ 2018-09-18 19:10 UTC (permalink / raw)
To: anatoly.burakov, santosh.shukla; +Cc: dev, Allain.Legacy, Matt.Peters
This patch uses EAL option "--iova-mode" to force the IOVA mode to a
particular value. There exists virtual devices that are not directly
attached to the PCI bus, and therefore the auto detectioni of the IOVA
mode based on probing the PCI bus and IOMMU configuration may not
report the required addressing mode. Using the EAL option permits the
mode to be explicitly configured in this scenario.
Signed-off-by: eric zhang <eric.zhang@windriver.com>
---
v2:
* use eal option instead of compilation option to configure IOVA
* apply http://patchwork.dpdk.org/patch/25192/
---
lib/librte_eal/bsdapp/eal/eal.c | 11 +++++++++--
lib/librte_eal/linuxapp/eal/eal.c | 27 +++++++++++++++++----------
2 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 369a682..52a1547 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -569,8 +569,15 @@ static void rte_eal_init_alert(const char *msg)
return -1;
}
- /* autodetect the iova mapping mode (default is iova_pa) */
- rte_eal_get_configuration()->iova_mode = rte_bus_get_iommu_class();
+ /* if no eal option "--iova-mode=<pa/va>", use bus iova scheme */
+ if (internal_config.iova_mode == -1) {
+ /* autodetect the iova mapping mode (default is iova_pa) */
+ rte_eal_get_configuration()->iova_mode =
+ rte_bus_get_iommu_class();
+ } else {
+ rte_eal_get_configuration()->iova_mode =
+ internal_config.iova_mode;
+ }
if (internal_config.no_hugetlbfs == 0 &&
internal_config.process_type != RTE_PROC_SECONDARY &&
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index e0b5ae1..51208df 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -805,16 +805,23 @@ static void rte_eal_init_alert(const char *msg)
return -1;
}
- /* autodetect the iova mapping mode (default is iova_pa) */
- rte_eal_get_configuration()->iova_mode = rte_bus_get_iommu_class();
-
- /* Workaround for KNI which requires physical address to work */
- if (rte_eal_get_configuration()->iova_mode == RTE_IOVA_VA &&
- rte_eal_check_module("rte_kni") == 1) {
- rte_eal_get_configuration()->iova_mode = RTE_IOVA_PA;
- RTE_LOG(WARNING, EAL,
- "Some devices want IOVA as VA but PA will be used because.. "
- "KNI module inserted\n");
+ /* if no eal option "--iova-mode=<pa/va>", use bus iova scheme */
+ if (internal_config.iova_mode == -1) {
+ /* autodetect the iova mapping mode (default is iova_pa) */
+ rte_eal_get_configuration()->iova_mode =
+ rte_bus_get_iommu_class();
+
+ /* Workaround for KNI which requires physical address to work */
+ if (rte_eal_get_configuration()->iova_mode == RTE_IOVA_VA &&
+ rte_eal_check_module("rte_kni") == 1) {
+ rte_eal_get_configuration()->iova_mode = RTE_IOVA_PA;
+ RTE_LOG(WARNING, EAL,
+ "Some devices want IOVA as VA but PA will be used because.. "
+ "KNI module inserted\n");
+ }
+ } else {
+ rte_eal_get_configuration()->iova_mode =
+ internal_config.iova_mode;
}
if (internal_config.no_hugetlbfs == 0 &&
--
1.8.3.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v2 2/2] eal: force IOVA to particular mode
2018-09-18 19:10 ` [dpdk-dev] [PATCH v2 2/2] eal: force IOVA to particular mode eric zhang
@ 2018-09-24 20:42 ` Zhang, Qing Long (Eric)
2018-09-25 7:16 ` Santosh Shukla
2018-09-26 7:11 ` Hemant
2018-09-26 12:43 ` Burakov, Anatoly
2 siblings, 1 reply; 11+ messages in thread
From: Zhang, Qing Long (Eric) @ 2018-09-24 20:42 UTC (permalink / raw)
To: anatoly.burakov, santosh.shukla; +Cc: dev, Legacy, Allain, Peters, Matt
Hi Santosh/Anatoly,
Any comments on the v2 patch which uses EAL option to let user configure
iova mode as suggested?
Thanks
Eric
-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of eric zhang
Sent: Tuesday, September 18, 2018 3:10 PM
To: anatoly.burakov@intel.com; santosh.shukla@caviumnetworks.com
Cc: dev@dpdk.org; Legacy, Allain; Peters, Matt
Subject: [dpdk-dev] [PATCH v2 2/2] eal: force IOVA to particular mode
This patch uses EAL option "--iova-mode" to force the IOVA mode to a
particular value. There exists virtual devices that are not directly
attached to the PCI bus, and therefore the auto detectioni of the IOVA
mode based on probing the PCI bus and IOMMU configuration may not
report the required addressing mode. Using the EAL option permits the
mode to be explicitly configured in this scenario.
Signed-off-by: eric zhang <eric.zhang@windriver.com>
---
v2:
* use eal option instead of compilation option to configure IOVA
* apply http://patchwork.dpdk.org/patch/25192/
---
lib/librte_eal/bsdapp/eal/eal.c | 11 +++++++++--
lib/librte_eal/linuxapp/eal/eal.c | 27 +++++++++++++++++----------
2 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 369a682..52a1547 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -569,8 +569,15 @@ static void rte_eal_init_alert(const char *msg)
return -1;
}
- /* autodetect the iova mapping mode (default is iova_pa) */
- rte_eal_get_configuration()->iova_mode = rte_bus_get_iommu_class();
+ /* if no eal option "--iova-mode=<pa/va>", use bus iova scheme */
+ if (internal_config.iova_mode == -1) {
+ /* autodetect the iova mapping mode (default is iova_pa) */
+ rte_eal_get_configuration()->iova_mode =
+ rte_bus_get_iommu_class();
+ } else {
+ rte_eal_get_configuration()->iova_mode =
+ internal_config.iova_mode;
+ }
if (internal_config.no_hugetlbfs == 0 &&
internal_config.process_type != RTE_PROC_SECONDARY &&
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index e0b5ae1..51208df 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -805,16 +805,23 @@ static void rte_eal_init_alert(const char *msg)
return -1;
}
- /* autodetect the iova mapping mode (default is iova_pa) */
- rte_eal_get_configuration()->iova_mode = rte_bus_get_iommu_class();
-
- /* Workaround for KNI which requires physical address to work */
- if (rte_eal_get_configuration()->iova_mode == RTE_IOVA_VA &&
- rte_eal_check_module("rte_kni") == 1) {
- rte_eal_get_configuration()->iova_mode = RTE_IOVA_PA;
- RTE_LOG(WARNING, EAL,
- "Some devices want IOVA as VA but PA will be used because.. "
- "KNI module inserted\n");
+ /* if no eal option "--iova-mode=<pa/va>", use bus iova scheme */
+ if (internal_config.iova_mode == -1) {
+ /* autodetect the iova mapping mode (default is iova_pa) */
+ rte_eal_get_configuration()->iova_mode =
+ rte_bus_get_iommu_class();
+
+ /* Workaround for KNI which requires physical address to work */
+ if (rte_eal_get_configuration()->iova_mode == RTE_IOVA_VA &&
+ rte_eal_check_module("rte_kni") == 1) {
+ rte_eal_get_configuration()->iova_mode = RTE_IOVA_PA;
+ RTE_LOG(WARNING, EAL,
+ "Some devices want IOVA as VA but PA will be used because.. "
+ "KNI module inserted\n");
+ }
+ } else {
+ rte_eal_get_configuration()->iova_mode =
+ internal_config.iova_mode;
}
if (internal_config.no_hugetlbfs == 0 &&
--
1.8.3.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v2 2/2] eal: force IOVA to particular mode
2018-09-24 20:42 ` Zhang, Qing Long (Eric)
@ 2018-09-25 7:16 ` Santosh Shukla
2018-09-25 20:11 ` Zhang, Qing Long (Eric)
0 siblings, 1 reply; 11+ messages in thread
From: Santosh Shukla @ 2018-09-25 7:16 UTC (permalink / raw)
To: Zhang, Qing Long (Eric), anatoly.burakov
Cc: dev, Legacy, Allain, Peters, Matt
Hi Eric,
On Tuesday 25 September 2018 02:12 AM, Zhang, Qing Long (Eric) wrote:
> External Email
>
> Hi Santosh/Anatoly,
> Any comments on the v2 patch which uses EAL option to let user configure
> iova mode as suggested?
>
> Thanks
> Eric
>
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of eric zhang
> Sent: Tuesday, September 18, 2018 3:10 PM
> To: anatoly.burakov@intel.com; santosh.shukla@caviumnetworks.com
> Cc: dev@dpdk.org; Legacy, Allain; Peters, Matt
> Subject: [dpdk-dev] [PATCH v2 2/2] eal: force IOVA to particular mode
>
> This patch uses EAL option "--iova-mode" to force the IOVA mode to a
> particular value. There exists virtual devices that are not directly
> attached to the PCI bus, and therefore the auto detectioni of the IOVA
> mode based on probing the PCI bus and IOMMU configuration may not
> report the required addressing mode. Using the EAL option permits the
> mode to be explicitly configured in this scenario.
>
> Signed-off-by: eric zhang <eric.zhang@windriver.com>
No Special comment, v2 LGTM.
For series:
Acked-by: Santosh Shukla <Santosh.Shukla@caviumnetworks.com>
Thanks.
> ---
> v2:
> * use eal option instead of compilation option to configure IOVA
> * apply http://patchwork.dpdk.org/patch/25192/
> ---
> lib/librte_eal/bsdapp/eal/eal.c | 11 +++++++++--
> lib/librte_eal/linuxapp/eal/eal.c | 27 +++++++++++++++++----------
> 2 files changed, 26 insertions(+), 12 deletions(-)
>
> diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
> index 369a682..52a1547 100644
> --- a/lib/librte_eal/bsdapp/eal/eal.c
> +++ b/lib/librte_eal/bsdapp/eal/eal.c
> @@ -569,8 +569,15 @@ static void rte_eal_init_alert(const char *msg)
> return -1;
> }
>
> - /* autodetect the iova mapping mode (default is iova_pa) */
> - rte_eal_get_configuration()->iova_mode = rte_bus_get_iommu_class();
> + /* if no eal option "--iova-mode=<pa/va>", use bus iova scheme */
> + if (internal_config.iova_mode == -1) {
> + /* autodetect the iova mapping mode (default is iova_pa) */
> + rte_eal_get_configuration()->iova_mode =
> + rte_bus_get_iommu_class();
> + } else {
> + rte_eal_get_configuration()->iova_mode =
> + internal_config.iova_mode;
> + }
>
> if (internal_config.no_hugetlbfs == 0 &&
> internal_config.process_type != RTE_PROC_SECONDARY &&
> diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
> index e0b5ae1..51208df 100644
> --- a/lib/librte_eal/linuxapp/eal/eal.c
> +++ b/lib/librte_eal/linuxapp/eal/eal.c
> @@ -805,16 +805,23 @@ static void rte_eal_init_alert(const char *msg)
> return -1;
> }
>
> - /* autodetect the iova mapping mode (default is iova_pa) */
> - rte_eal_get_configuration()->iova_mode = rte_bus_get_iommu_class();
> -
> - /* Workaround for KNI which requires physical address to work */
> - if (rte_eal_get_configuration()->iova_mode == RTE_IOVA_VA &&
> - rte_eal_check_module("rte_kni") == 1) {
> - rte_eal_get_configuration()->iova_mode = RTE_IOVA_PA;
> - RTE_LOG(WARNING, EAL,
> - "Some devices want IOVA as VA but PA will be used because.. "
> - "KNI module inserted\n");
> + /* if no eal option "--iova-mode=<pa/va>", use bus iova scheme */
> + if (internal_config.iova_mode == -1) {
> + /* autodetect the iova mapping mode (default is iova_pa) */
> + rte_eal_get_configuration()->iova_mode =
> + rte_bus_get_iommu_class();
> +
> + /* Workaround for KNI which requires physical address to work */
> + if (rte_eal_get_configuration()->iova_mode == RTE_IOVA_VA &&
> + rte_eal_check_module("rte_kni") == 1) {
> + rte_eal_get_configuration()->iova_mode = RTE_IOVA_PA;
> + RTE_LOG(WARNING, EAL,
> + "Some devices want IOVA as VA but PA will be used because.. "
> + "KNI module inserted\n");
> + }
> + } else {
> + rte_eal_get_configuration()->iova_mode =
> + internal_config.iova_mode;
> }
>
> if (internal_config.no_hugetlbfs == 0 &&
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v2 2/2] eal: force IOVA to particular mode
2018-09-25 7:16 ` Santosh Shukla
@ 2018-09-25 20:11 ` Zhang, Qing Long (Eric)
0 siblings, 0 replies; 11+ messages in thread
From: Zhang, Qing Long (Eric) @ 2018-09-25 20:11 UTC (permalink / raw)
To: Santosh Shukla, anatoly.burakov, bruce.richardson
Cc: dev, Legacy, Allain, Peters, Matt
Hi Anatoly/Bruce,
Need your comments since you are the maintainers.
Thanks
Eric
-----Original Message-----
From: Santosh Shukla [mailto:santosh.shukla@caviumnetworks.com]
Sent: Tuesday, September 25, 2018 3:16 AM
To: Zhang, Qing Long (Eric); anatoly.burakov@intel.com
Cc: dev@dpdk.org; Legacy, Allain; Peters, Matt
Subject: Re: [dpdk-dev] [PATCH v2 2/2] eal: force IOVA to particular mode
Hi Eric,
On Tuesday 25 September 2018 02:12 AM, Zhang, Qing Long (Eric) wrote:
> External Email
>
> Hi Santosh/Anatoly,
> Any comments on the v2 patch which uses EAL option to let user configure
> iova mode as suggested?
>
> Thanks
> Eric
>
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of eric zhang
> Sent: Tuesday, September 18, 2018 3:10 PM
> To: anatoly.burakov@intel.com; santosh.shukla@caviumnetworks.com
> Cc: dev@dpdk.org; Legacy, Allain; Peters, Matt
> Subject: [dpdk-dev] [PATCH v2 2/2] eal: force IOVA to particular mode
>
> This patch uses EAL option "--iova-mode" to force the IOVA mode to a
> particular value. There exists virtual devices that are not directly
> attached to the PCI bus, and therefore the auto detectioni of the IOVA
> mode based on probing the PCI bus and IOMMU configuration may not
> report the required addressing mode. Using the EAL option permits the
> mode to be explicitly configured in this scenario.
>
> Signed-off-by: eric zhang <eric.zhang@windriver.com>
No Special comment, v2 LGTM.
For series:
Acked-by: Santosh Shukla <Santosh.Shukla@caviumnetworks.com>
Thanks.
> ---
> v2:
> * use eal option instead of compilation option to configure IOVA
> * apply http://patchwork.dpdk.org/patch/25192/
> ---
> lib/librte_eal/bsdapp/eal/eal.c | 11 +++++++++--
> lib/librte_eal/linuxapp/eal/eal.c | 27 +++++++++++++++++----------
> 2 files changed, 26 insertions(+), 12 deletions(-)
>
> diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
> index 369a682..52a1547 100644
> --- a/lib/librte_eal/bsdapp/eal/eal.c
> +++ b/lib/librte_eal/bsdapp/eal/eal.c
> @@ -569,8 +569,15 @@ static void rte_eal_init_alert(const char *msg)
> return -1;
> }
>
> - /* autodetect the iova mapping mode (default is iova_pa) */
> - rte_eal_get_configuration()->iova_mode = rte_bus_get_iommu_class();
> + /* if no eal option "--iova-mode=<pa/va>", use bus iova scheme */
> + if (internal_config.iova_mode == -1) {
> + /* autodetect the iova mapping mode (default is iova_pa) */
> + rte_eal_get_configuration()->iova_mode =
> + rte_bus_get_iommu_class();
> + } else {
> + rte_eal_get_configuration()->iova_mode =
> + internal_config.iova_mode;
> + }
>
> if (internal_config.no_hugetlbfs == 0 &&
> internal_config.process_type != RTE_PROC_SECONDARY &&
> diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
> index e0b5ae1..51208df 100644
> --- a/lib/librte_eal/linuxapp/eal/eal.c
> +++ b/lib/librte_eal/linuxapp/eal/eal.c
> @@ -805,16 +805,23 @@ static void rte_eal_init_alert(const char *msg)
> return -1;
> }
>
> - /* autodetect the iova mapping mode (default is iova_pa) */
> - rte_eal_get_configuration()->iova_mode = rte_bus_get_iommu_class();
> -
> - /* Workaround for KNI which requires physical address to work */
> - if (rte_eal_get_configuration()->iova_mode == RTE_IOVA_VA &&
> - rte_eal_check_module("rte_kni") == 1) {
> - rte_eal_get_configuration()->iova_mode = RTE_IOVA_PA;
> - RTE_LOG(WARNING, EAL,
> - "Some devices want IOVA as VA but PA will be used because.. "
> - "KNI module inserted\n");
> + /* if no eal option "--iova-mode=<pa/va>", use bus iova scheme */
> + if (internal_config.iova_mode == -1) {
> + /* autodetect the iova mapping mode (default is iova_pa) */
> + rte_eal_get_configuration()->iova_mode =
> + rte_bus_get_iommu_class();
> +
> + /* Workaround for KNI which requires physical address to work */
> + if (rte_eal_get_configuration()->iova_mode == RTE_IOVA_VA &&
> + rte_eal_check_module("rte_kni") == 1) {
> + rte_eal_get_configuration()->iova_mode = RTE_IOVA_PA;
> + RTE_LOG(WARNING, EAL,
> + "Some devices want IOVA as VA but PA will be used because.. "
> + "KNI module inserted\n");
> + }
> + } else {
> + rte_eal_get_configuration()->iova_mode =
> + internal_config.iova_mode;
> }
>
> if (internal_config.no_hugetlbfs == 0 &&
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v2 2/2] eal: force IOVA to particular mode
2018-09-18 19:10 ` [dpdk-dev] [PATCH v2 2/2] eal: force IOVA to particular mode eric zhang
2018-09-24 20:42 ` Zhang, Qing Long (Eric)
@ 2018-09-26 7:11 ` Hemant
2018-09-26 12:43 ` Burakov, Anatoly
2 siblings, 0 replies; 11+ messages in thread
From: Hemant @ 2018-09-26 7:11 UTC (permalink / raw)
To: eric zhang, anatoly.burakov, santosh.shukla
Cc: dev, Allain.Legacy, Matt.Peters
On 9/19/2018 12:40 AM, eric zhang wrote:
> This patch uses EAL option "--iova-mode" to force the IOVA mode to a
> particular value. There exists virtual devices that are not directly
> attached to the PCI bus, and therefore the auto detectioni of the IOVA
> mode based on probing the PCI bus and IOMMU configuration may not
> report the required addressing mode. Using the EAL option permits the
> mode to be explicitly configured in this scenario.
>
> Signed-off-by: eric zhang <eric.zhang@windriver.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v2 2/2] eal: force IOVA to particular mode
2018-09-18 19:10 ` [dpdk-dev] [PATCH v2 2/2] eal: force IOVA to particular mode eric zhang
2018-09-24 20:42 ` Zhang, Qing Long (Eric)
2018-09-26 7:11 ` Hemant
@ 2018-09-26 12:43 ` Burakov, Anatoly
2 siblings, 0 replies; 11+ messages in thread
From: Burakov, Anatoly @ 2018-09-26 12:43 UTC (permalink / raw)
To: eric zhang, santosh.shukla; +Cc: dev, Allain.Legacy, Matt.Peters
On 18-Sep-18 8:10 PM, eric zhang wrote:
> This patch uses EAL option "--iova-mode" to force the IOVA mode to a
> particular value. There exists virtual devices that are not directly
> attached to the PCI bus, and therefore the auto detectioni of the IOVA
> mode based on probing the PCI bus and IOMMU configuration may not
> report the required addressing mode. Using the EAL option permits the
> mode to be explicitly configured in this scenario.
>
> Signed-off-by: eric zhang <eric.zhang@windriver.com>
>
> ---
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
--
Thanks,
Anatoly
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/2] eal: add eal option to configure iova mode
2018-09-18 19:10 [dpdk-dev] [PATCH v2 1/2] eal: add eal option to configure iova mode eric zhang
2018-09-18 19:10 ` [dpdk-dev] [PATCH v2 2/2] eal: force IOVA to particular mode eric zhang
@ 2018-09-26 7:10 ` Hemant
2018-09-26 12:42 ` Burakov, Anatoly
2 siblings, 0 replies; 11+ messages in thread
From: Hemant @ 2018-09-26 7:10 UTC (permalink / raw)
To: eric zhang, anatoly.burakov, santosh.shukla
Cc: dev, Allain.Legacy, Matt.Peters
On 9/19/2018 12:40 AM, eric zhang wrote:
> From: Santosh Shukla <santosh.shukla@caviumnetworks.com>
>
> In the case of user don't want to use bus iova scheme and want
> to override.
>
> For that, Adding eal option --iova-mode=<string> where valid input
> string is 'pa' or 'va'.
>
> Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Just wondering if you want to add some description in:
1. Prog Guide - EAL section
2. EAL Command line options for testpmd
(https://doc.dpdk.org/guides/testpmd_app_ug/run_app.html?highlight=eal)
Otherwise LGTM
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
> lib/librte_eal/common/eal_common_options.c | 30 ++++++++++++++++++++++++++++++
> lib/librte_eal/common/eal_internal_cfg.h | 1 +
> lib/librte_eal/common/eal_options.h | 2 ++
> 3 files changed, 33 insertions(+)
>
> diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
> index 996a034..ab2a28c 100644
> --- a/lib/librte_eal/common/eal_common_options.c
> +++ b/lib/librte_eal/common/eal_common_options.c
> @@ -82,6 +82,7 @@
> {OPT_HELP, 0, NULL, OPT_HELP_NUM },
> {OPT_HUGE_DIR, 1, NULL, OPT_HUGE_DIR_NUM },
> {OPT_HUGE_UNLINK, 0, NULL, OPT_HUGE_UNLINK_NUM },
> + {OPT_IOVA_MODE, 1, NULL, OPT_IOVA_MODE_NUM },
> {OPT_LCORES, 1, NULL, OPT_LCORES_NUM },
> {OPT_LOG_LEVEL, 1, NULL, OPT_LOG_LEVEL_NUM },
> {OPT_MASTER_LCORE, 1, NULL, OPT_MASTER_LCORE_NUM },
> @@ -218,6 +219,7 @@ struct device_option {
> #endif
> internal_cfg->vmware_tsc_map = 0;
> internal_cfg->create_uio_dev = 0;
> + internal_cfg->iova_mode = -1;
> internal_cfg->mbuf_pool_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
> }
>
> @@ -994,6 +996,25 @@ static int xdigit2val(unsigned char c)
> return RTE_PROC_INVALID;
> }
>
> +static int
> +eal_parse_iova_mode(const char *name)
> +{
> + int mode;
> +
> + if (name == NULL)
> + return -1;
> +
> + if (!strcmp("pa", name))
> + mode = RTE_IOVA_PA;
> + else if (!strcmp("va", name))
> + mode = RTE_IOVA_VA;
> + else
> + return -1;
> +
> + internal_config.iova_mode = mode;
> + return 0;
> +}
> +
> int
> eal_parse_common_option(int opt, const char *optarg,
> struct internal_config *conf)
> @@ -1158,6 +1179,13 @@ static int xdigit2val(unsigned char c)
> }
> core_parsed = 1;
> break;
> + case OPT_IOVA_MODE_NUM:
> + if (eal_parse_iova_mode(optarg) < 0) {
> + RTE_LOG(ERR, EAL, "invalid parameters for --"
> + OPT_IOVA_MODE "\n");
> + return -1;
> + }
> + break;
>
> /* don't know what to do, leave this to caller */
> default:
> @@ -1306,6 +1334,8 @@ static int xdigit2val(unsigned char c)
> " -h, --help This help\n"
> "\nEAL options for DEBUG use only:\n"
> " --"OPT_HUGE_UNLINK" Unlink hugepage files after init\n"
> + " --"OPT_IOVA_MODE" Set iova mode. 'pa' for IOVA_PA\n"
> + " 'va' for IOVA_VA\n"
> " --"OPT_NO_HUGE" Use malloc instead of hugetlbfs\n"
> " --"OPT_NO_PCI" Disable PCI\n"
> " --"OPT_NO_HPET" Disable HPET\n"
> diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
> index fa6ccbe..29bf53f 100644
> --- a/lib/librte_eal/common/eal_internal_cfg.h
> +++ b/lib/librte_eal/common/eal_internal_cfg.h
> @@ -83,6 +83,7 @@ struct internal_config {
> const char *hugepage_dir; /**< specific hugetlbfs directory to use */
> const char *mbuf_pool_ops_name; /**< mbuf pool ops name */
> unsigned num_hugepage_sizes; /**< how many sizes on this system */
> + enum rte_iova_mode iova_mode ; /**< Set iova mode on this system */
> struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
> };
> extern struct internal_config internal_config; /**< Global EAL configuration. */
> diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h
> index 30e6bb4..7786189 100644
> --- a/lib/librte_eal/common/eal_options.h
> +++ b/lib/librte_eal/common/eal_options.h
> @@ -83,6 +83,8 @@ enum {
> OPT_VFIO_INTR_NUM,
> #define OPT_VMWARE_TSC_MAP "vmware-tsc-map"
> OPT_VMWARE_TSC_MAP_NUM,
> +#define OPT_IOVA_MODE "iova-mode"
> + OPT_IOVA_MODE_NUM,
> OPT_LONG_MAX_NUM
> };
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/2] eal: add eal option to configure iova mode
2018-09-18 19:10 [dpdk-dev] [PATCH v2 1/2] eal: add eal option to configure iova mode eric zhang
2018-09-18 19:10 ` [dpdk-dev] [PATCH v2 2/2] eal: force IOVA to particular mode eric zhang
2018-09-26 7:10 ` [dpdk-dev] [PATCH v2 1/2] eal: add eal option to configure iova mode Hemant
@ 2018-09-26 12:42 ` Burakov, Anatoly
2018-10-01 16:00 ` Eric Zhang
2 siblings, 1 reply; 11+ messages in thread
From: Burakov, Anatoly @ 2018-09-26 12:42 UTC (permalink / raw)
To: eric zhang, santosh.shukla; +Cc: dev, Allain.Legacy, Matt.Peters
On 18-Sep-18 8:10 PM, eric zhang wrote:
> From: Santosh Shukla <santosh.shukla@caviumnetworks.com>
>
> In the case of user don't want to use bus iova scheme and want
> to override.
>
> For that, Adding eal option --iova-mode=<string> where valid input
> string is 'pa' or 'va'.
>
> Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
Needs documentation update in Programmer's Guide to explain why such a
thing might be needed, and update EAL parameter guides.
For the patch itself,
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
--
Thanks,
Anatoly
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/2] eal: add eal option to configure iova mode
2018-09-26 12:42 ` Burakov, Anatoly
@ 2018-10-01 16:00 ` Eric Zhang
2018-10-02 8:30 ` Ferruh Yigit
0 siblings, 1 reply; 11+ messages in thread
From: Eric Zhang @ 2018-10-01 16:00 UTC (permalink / raw)
To: Burakov, Anatoly, santosh.shukla; +Cc: dev, Allain.Legacy, Matt.Peters
On 09/26/2018 08:42 AM, Burakov, Anatoly wrote:
> On 18-Sep-18 8:10 PM, eric zhang wrote:
>> From: Santosh Shukla <santosh.shukla@caviumnetworks.com>
>>
>> In the case of user don't want to use bus iova scheme and want
>> to override.
>>
>> For that, Adding eal option --iova-mode=<string> where valid input
>> string is 'pa' or 'va'.
>>
>> Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
>> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
>> ---
>
> Needs documentation update in Programmer's Guide to explain why such a
> thing might be needed, and update EAL parameter guides.
>
> For the patch itself,
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Thanks Anatoly. Documentations were updated and patch is at
http://patchwork.dpdk.org/patch/45785/. Would you please give a review?
Eric
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/2] eal: add eal option to configure iova mode
2018-10-01 16:00 ` Eric Zhang
@ 2018-10-02 8:30 ` Ferruh Yigit
0 siblings, 0 replies; 11+ messages in thread
From: Ferruh Yigit @ 2018-10-02 8:30 UTC (permalink / raw)
To: Eric Zhang, Burakov, Anatoly, santosh.shukla
Cc: dev, Allain.Legacy, Matt.Peters
On 10/1/2018 5:00 PM, Eric Zhang wrote:
>
>
> On 09/26/2018 08:42 AM, Burakov, Anatoly wrote:
>> On 18-Sep-18 8:10 PM, eric zhang wrote:
>>> From: Santosh Shukla <santosh.shukla@caviumnetworks.com>
>>>
>>> In the case of user don't want to use bus iova scheme and want
>>> to override.
>>>
>>> For that, Adding eal option --iova-mode=<string> where valid input
>>> string is 'pa' or 'va'.
>>>
>>> Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
>>> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
>>> ---
>>
>> Needs documentation update in Programmer's Guide to explain why such a
>> thing might be needed, and update EAL parameter guides.
>>
>> For the patch itself,
>> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
> Thanks Anatoly. Documentations were updated and patch is at
> http://patchwork.dpdk.org/patch/45785/. Would you please give a review?
I suggest sending a new version of this patchset with that patch included,
instead of two separate patches.
Makes life easy for people that needs to follow that dependency and good for
keeping record for future.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2018-10-02 8:30 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-18 19:10 [dpdk-dev] [PATCH v2 1/2] eal: add eal option to configure iova mode eric zhang
2018-09-18 19:10 ` [dpdk-dev] [PATCH v2 2/2] eal: force IOVA to particular mode eric zhang
2018-09-24 20:42 ` Zhang, Qing Long (Eric)
2018-09-25 7:16 ` Santosh Shukla
2018-09-25 20:11 ` Zhang, Qing Long (Eric)
2018-09-26 7:11 ` Hemant
2018-09-26 12:43 ` Burakov, Anatoly
2018-09-26 7:10 ` [dpdk-dev] [PATCH v2 1/2] eal: add eal option to configure iova mode Hemant
2018-09-26 12:42 ` Burakov, Anatoly
2018-10-01 16:00 ` Eric Zhang
2018-10-02 8:30 ` Ferruh Yigit
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).