DPDK patches and discussions
 help / color / mirror / Atom feed
From: eric zhang <eric.zhang@windriver.com>
To: <anatoly.burakov@intel.com>, <santosh.shukla@caviumnetworks.com>
Cc: <dev@dpdk.org>, <Allain.Legacy@windriver.com>,
	<Matt.Peters@windriver.com>
Subject: [dpdk-dev] [PATCH v2 2/2] eal: force IOVA to particular mode
Date: Tue, 18 Sep 2018 15:10:07 -0400	[thread overview]
Message-ID: <1537297807-19584-2-git-send-email-eric.zhang@windriver.com> (raw)
In-Reply-To: <1537297807-19584-1-git-send-email-eric.zhang@windriver.com>

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

  reply	other threads:[~2018-09-18 19:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2018-09-24 20:42   ` [dpdk-dev] [PATCH v2 2/2] eal: force IOVA to particular mode 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1537297807-19584-2-git-send-email-eric.zhang@windriver.com \
    --to=eric.zhang@windriver.com \
    --cc=Allain.Legacy@windriver.com \
    --cc=Matt.Peters@windriver.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=santosh.shukla@caviumnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).