Commit a9c79c33 authored by Richael Zhuang's avatar Richael Zhuang Committed by Tomasz Zawadzki
Browse files

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: default avatarRichael Zhuang <richael.zhuang@arm.com>
Change-Id: I7c343498c5d6976a7c75d75438d6f9c35f1b6160
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1071


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent bdbe33e6
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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