From: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
To: dev@dpdk.org, Santosh Shukla <santosh.shukla@caviumnetworks.com>,
Hemant Agrawal <hemant.agrawal@nxp.com>,
Jerin Jacob <jerin.jacob@caviumnetworks.com>
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>,
Anatoly Burakov <anatoly.burakov@intel.com>,
Chas Williams <chas3@att.com>,
Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Subject: [dpdk-dev] [PATCH v2] eal/bus: use RTE_IOVA_PA only if phys addresses are available
Date: Fri, 7 Sep 2018 17:58:43 +0200 [thread overview]
Message-ID: <20180907155843.96465-1-dariusz.stojaczyk@intel.com> (raw)
In-Reply-To: <20180907154703.83316-1-dariusz.stojaczyk@intel.com>
When neither RTE_IOVA_VA nor RTE_IOVA_PA was explicitly
requested, DPDK would currently fallback to the default
RTE_IOVA_PA mode and possibly encounter a failure later
on if running as a non-priviledged user. Attempting to
use RTE_IOVA_VA if no phys addresses are available may
help in this case.
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
---
Changes since v1:
* added a missing rte_memory.h include
lib/librte_eal/common/eal_common_bus.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c
index 0943851cc..68c581b8a 100644
--- a/lib/librte_eal/common/eal_common_bus.c
+++ b/lib/librte_eal/common/eal_common_bus.c
@@ -37,6 +37,7 @@
#include <rte_bus.h>
#include <rte_debug.h>
#include <rte_string_fns.h>
+#include <rte_memory.h>
#include "eal_private.h"
@@ -236,9 +237,19 @@ rte_bus_get_iommu_class(void)
mode |= bus->get_iommu_class();
}
- if (mode != RTE_IOVA_VA) {
- /* Use default IOVA mode */
- mode = RTE_IOVA_PA;
+ if (mode == RTE_IOVA_VA)
+ return RTE_IOVA_VA;
+
+ if (mode & RTE_IOVA_PA) {
+ /* Not all buses support RTE_IOVA_VA, fallback to RTE_IOVA_PA */
+ return RTE_IOVA_PA;
+ }
+
+ if (rte_eal_using_phys_addrs()) {
+ /* Default to RTE_IOVA_PA only if it's supported */
+ return RTE_IOVA_PA;
}
- return mode;
+
+ /* Since RTE_IOVA_PA is unsupported, fallback to RTE_IOVA_VA */
+ return RTE_IOVA_VA;
}
--
2.17.1
next prev parent reply other threads:[~2018-09-07 16:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-07 15:47 [dpdk-dev] [PATCH] " Darek Stojaczyk
2018-09-07 15:58 ` Darek Stojaczyk [this message]
2018-09-17 10:33 ` [dpdk-dev] [PATCH v2] " Burakov, Anatoly
2018-09-17 13:06 ` Stojaczyk, Dariusz
2018-10-30 12:58 ` Alejandro Lucero
2018-10-28 23:11 ` Thomas Monjalon
2018-10-30 10:25 ` Burakov, Anatoly
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=20180907155843.96465-1-dariusz.stojaczyk@intel.com \
--to=dariusz.stojaczyk@intel.com \
--cc=anatoly.burakov@intel.com \
--cc=chas3@att.com \
--cc=dev@dpdk.org \
--cc=hemant.agrawal@nxp.com \
--cc=jerin.jacob@caviumnetworks.com \
--cc=maxime.coquelin@redhat.com \
--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).