From 75209b1d53f29443163b556bc2578186abac6894 Mon Sep 17 00:00:00 2001 From: paul luse Date: Fri, 4 Mar 2022 07:22:47 -0700 Subject: [PATCH] lib/idxd: fail init if IOMMU is not enabled Currently the idxd driver requires VFIO so avoid unexpected errors if someone tries without it (with UIO). Temp workaround for issue #2316 Signed-off-by: paul luse Change-Id: I430cd2193bc8dbd6939af7d0ca799832e7a73213 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11816 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Tomasz Zawadzki --- lib/idxd/idxd.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/idxd/idxd.c b/lib/idxd/idxd.c index ff518efcb..172b0ad82 100644 --- a/lib/idxd/idxd.c +++ b/lib/idxd/idxd.c @@ -296,6 +296,14 @@ spdk_idxd_probe(void *cb_ctx, spdk_idxd_attach_cb attach_cb) return -1; } + /* The idxd library doesn't support UIO at the moment, so fail init + * if the IOMMU is disabled. TODO: remove once driver supports UIO. + */ + if (spdk_iommu_is_enabled() == false) { + SPDK_ERRLOG("The IDXD driver currently requires the IOMMU which is disabled. Please re-enable to use IDXD\n"); + return -EINVAL; + } + return g_idxd_impl->probe(cb_ctx, attach_cb); }