[v2,2/2] eal: force IOVA to particular mode

Message ID 1537297807-19584-2-git-send-email-eric.zhang@windriver.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v2,1/2] eal: add eal option to configure iova mode |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply issues

Commit Message

eric zhang Sept. 18, 2018, 7:10 p.m. UTC
  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(-)
  

Comments

eric zhang Sept. 24, 2018, 8:42 p.m. UTC | #1
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 &&
  
Santosh Shukla Sept. 25, 2018, 7:16 a.m. UTC | #2
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
>
  
eric zhang Sept. 25, 2018, 8:11 p.m. UTC | #3
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
>
  
Hemant Agrawal Sept. 26, 2018, 7:11 a.m. UTC | #4
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>
  
Anatoly Burakov Sept. 26, 2018, 12:43 p.m. UTC | #5
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>
  

Patch

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 &&