From 7f75e1081a916e83bb5e9f762abdfde7ec334c59 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Mon, 6 Dec 2021 14:30:08 -0700 Subject: [PATCH] idxd: Do not allow calls to spdk_idxd_set_config after devices have been probed This can cause a mismatch of kernel vs user driver and isn't allowed. Signed-off-by: Ben Walker Change-Id: I9c572ea1fa1da89d7b41e31ab4719eec719fb50a Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10588 Community-CI: Broadcom CI Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris Reviewed-by: John Kariuki Reviewed-by: Paul Luse Tested-by: SPDK CI Jenkins --- lib/idxd/idxd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/idxd/idxd.c b/lib/idxd/idxd.c index 46376ed4a..779d1cbcc 100644 --- a/lib/idxd/idxd.c +++ b/lib/idxd/idxd.c @@ -265,6 +265,12 @@ idxd_get_impl_by_name(const char *impl_name) void spdk_idxd_set_config(bool kernel_mode) { + if (g_idxd_impl != NULL) { + SPDK_ERRLOG("Cannot change idxd implementation after devices are initialized\n"); + assert(false); + return; + } + if (kernel_mode) { g_idxd_impl = idxd_get_impl_by_name(KERNEL_DRIVER_NAME); } else {