Commit 7f02c59e authored by Mingbao Sun's avatar Mingbao Sun Committed by Jim Harris
Browse files

env_dpdk: refactor IOMMU checking-related code



For an upcoming patch fixing the issue of AMD CPU IOMMU checking,
here refactor some IOMMU checking-related code.

Signed-off-by: default avatarMingbao Sun <tyler.sun@dell.com>
Change-Id: I6a602cb7ed0a97975ade50196d56f5b6f05a4828
Reviewed-on: https://review.spdk.io/c/spdk/spdk/+/26002


Tested-by: default avatarSPDK Automated Test System <spdkbot@gmail.com>
Reviewed-by: default avatarGangCao <gang.cao@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@nvidia.com>
Reviewed-by: default avatarBen Walker <ben@nvidia.com>
parent 7d97acd4
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -212,6 +212,12 @@ get_iommu_width(void)
	return width;
}

static bool
x86_cpu_support_iommu(void)
{
	return get_iommu_width() >= SPDK_IOMMU_VA_REQUIRED_WIDTH;
}

#endif

static int
@@ -471,7 +477,7 @@ build_eal_cmdline(const struct spdk_env_opts *opts)
		 * virtual machines) don't have an IOMMU capable of handling the full virtual
		 * address space and DPDK doesn't currently catch that. Add a check in SPDK
		 * and force iova-mode=pa here. */
		if (!no_huge && get_iommu_width() < SPDK_IOMMU_VA_REQUIRED_WIDTH) {
		if (!no_huge && !x86_cpu_support_iommu()) {
			args = push_arg(args, &argcount, _sprintf_alloc("--iova-mode=pa"));
			if (args == NULL) {
				return -1;