env_dpdk: Fix error when using vfio with noiommu

When using vfio with enable_unsafe_noiommu_mode=Y, force iova-mode
as "pa" here for DPDK guesses it's "va", which cause the following
error: "EAL:   Expecting 'PA' IOVA mode but current mode is 'VA',
not initializing".

Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Change-Id: I7c343498c5d6976a7c75d75438d6f9c35f1b6160
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1071
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Richael Zhuang 2020-03-02 13:24:43 +08:00 committed by Tomasz Zawadzki
parent bdbe33e663
commit a9c79c3337

View File

@ -41,6 +41,7 @@
#include <rte_config.h>
#include <rte_eal.h>
#include <rte_errno.h>
#include <rte_vfio.h>
#define SPDK_ENV_DPDK_DEFAULT_NAME "spdk"
#define SPDK_ENV_DPDK_DEFAULT_SHM_ID -1
@ -410,6 +411,16 @@ spdk_build_eal_cmdline(const struct spdk_env_opts *opts)
#ifdef __linux__
/* When using vfio with enable_unsafe_noiommu_mode=Y, we need iova-mode=pa,
* but DPDK guesses it should be iova-mode=va. Add a check and force
* iova-mode=pa here. */
if (rte_vfio_noiommu_is_enabled()) {
args = spdk_push_arg(args, &argcount, _sprintf_alloc("--iova-mode=pa"));
if (args == NULL) {
return -1;
}
}
#if defined(__x86_64__)
/* DPDK by default guesses that it should be using iova-mode=va so that it can
* support running as an unprivileged user. However, some systems (especially