public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: kamil.konieczny@linux.intel.com, adam.miszczak@linux.intel.com,
	jakub1.kolakowski@intel.com, lukasz.laguna@intel.com,
	Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Subject: [PATCH v2 i-g-t 1/4] tests/intel/xe_sriov_vfio: Add VFIO module load/unload subtest
Date: Fri, 27 Mar 2026 15:06:24 +0100	[thread overview]
Message-ID: <20260327140627.64574-2-marcin.bernatowicz@linux.intel.com> (raw)
In-Reply-To: <20260327140627.64574-1-marcin.bernatowicz@linux.intel.com>

Introduce the load-unload-xe-vfio-pci subtest to verify that the
xe_vfio_pci module can be loaded and unloaded. Skip the test when the
module is already loaded.

Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Cc: Adam Miszczak <adam.miszczak@linux.intel.com>
Cc: Jakub Kolakowski <jakub1.kolakowski@intel.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Cc: Lukasz Laguna <lukasz.laguna@intel.com>
---
v2:
- Merge load/unload into a single subtest (Lukasz)
- Simplify restore_xe_vfio_module  (Lukasz)
---
 tests/intel/xe_sriov_vfio.c | 75 +++++++++++++++++++++++++++++++++++++
 tests/meson.build           |  1 +
 2 files changed, 76 insertions(+)
 create mode 100644 tests/intel/xe_sriov_vfio.c

diff --git a/tests/intel/xe_sriov_vfio.c b/tests/intel/xe_sriov_vfio.c
new file mode 100644
index 000000000..ef92fb233
--- /dev/null
+++ b/tests/intel/xe_sriov_vfio.c
@@ -0,0 +1,75 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright(c) 2026 Intel Corporation. All rights reserved.
+ */
+
+#include "igt_core.h"
+#include "igt_kmod.h"
+
+/**
+ * TEST: xe_sriov_vfio
+ * Category: Core
+ * Mega feature: SR-IOV
+ * Sub-category: SR-IOV VFIO
+ * Functionality: VFIO module
+ * Description: Verify basic xe-vfio-pci module operations.
+ *
+ * SUBTEST: load-unload-xe-vfio-pci
+ * Description: Attempt to load xe_vfio_pci module and then unload it.
+ */
+
+IGT_TEST_DESCRIPTION("Xe SR-IOV VFIO tests (xe-vfio-pci)");
+
+static const char *XE_VFIO_PCI_MOD = "xe_vfio_pci";
+
+static bool xe_vfio_loaded_initially;
+
+static void restore_xe_vfio_module(void)
+{
+	bool loaded;
+	int ret;
+
+	loaded = igt_kmod_is_loaded(XE_VFIO_PCI_MOD);
+
+	if (loaded != xe_vfio_loaded_initially) {
+		ret = xe_vfio_loaded_initially ?
+			igt_kmod_load(XE_VFIO_PCI_MOD, NULL) :
+			igt_kmod_unload(XE_VFIO_PCI_MOD);
+		igt_abort_on_f(ret,
+			       "Failed to %s %s during cleanup\n",
+			       xe_vfio_loaded_initially ? "load" : "unload",
+			       XE_VFIO_PCI_MOD);
+		loaded = igt_kmod_is_loaded(XE_VFIO_PCI_MOD);
+	}
+
+	igt_abort_on_f(loaded != xe_vfio_loaded_initially,
+		       "%s should be %s after cleanup\n",
+		       XE_VFIO_PCI_MOD,
+		       xe_vfio_loaded_initially ? "loaded" : "unloaded");
+}
+
+int igt_main()
+{
+	igt_fixture() {
+		xe_vfio_loaded_initially = igt_kmod_is_loaded(XE_VFIO_PCI_MOD);
+	}
+
+	igt_describe("Attempt to load xe_vfio_pci module and then unload it.");
+	igt_subtest("load-unload-xe-vfio-pci") {
+		int ret;
+
+		igt_skip_on(xe_vfio_loaded_initially);
+
+		ret = igt_kmod_load(XE_VFIO_PCI_MOD, NULL);
+		igt_assert_f(ret == 0, "Failed to load %s (%d)\n", XE_VFIO_PCI_MOD, ret);
+		igt_assert(igt_kmod_is_loaded(XE_VFIO_PCI_MOD));
+
+		ret = igt_kmod_unload(XE_VFIO_PCI_MOD);
+		igt_assert_f(ret == 0, "Failed to unload %s (%d)\n", XE_VFIO_PCI_MOD, ret);
+		igt_assert(igt_kmod_is_loaded(XE_VFIO_PCI_MOD) == false);
+	}
+
+	igt_fixture() {
+		restore_xe_vfio_module();
+	}
+}
diff --git a/tests/meson.build b/tests/meson.build
index cecb4a8ae..26d9345ec 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -337,6 +337,7 @@ intel_xe_progs = [
 	'xe_sriov_admin',
 	'xe_sriov_auto_provisioning',
 	'xe_sriov_flr',
+	'xe_sriov_vfio',
 	'xe_sriov_scheduling',
         'xe_survivability',
 	'xe_sriov_vram',
-- 
2.43.0


  reply	other threads:[~2026-03-27 14:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-27 14:06 [PATCH v2 i-g-t 0/4] tests/intel/xe_sriov_vfio: Add basic VFIO coverage Marcin Bernatowicz
2026-03-27 14:06 ` Marcin Bernatowicz [this message]
2026-03-30  8:18   ` [PATCH v2 i-g-t 1/4] tests/intel/xe_sriov_vfio: Add VFIO module load/unload subtest Laguna, Lukasz
2026-03-27 14:06 ` [PATCH v2 i-g-t 2/4] tests/intel/xe_sriov_vfio: Add dynamic bind-unbind-vfs subtest Marcin Bernatowicz
2026-03-30  8:18   ` Laguna, Lukasz
2026-03-27 14:06 ` [PATCH v2 i-g-t 3/4] tests/intel/xe_sriov_vfio: Add open-basic subtest Marcin Bernatowicz
2026-03-30  8:19   ` Laguna, Lukasz
2026-03-27 14:06 ` [PATCH v2 i-g-t 4/4] tests/intel/xe_sriov_vfio: Add region-info subtest Marcin Bernatowicz
2026-03-30  8:19   ` Laguna, Lukasz
2026-03-27 22:25 ` ✓ Xe.CI.BAT: success for tests/intel/xe_sriov_vfio: Add basic VFIO coverage (rev2) Patchwork
2026-03-27 22:57 ` ✓ i915.CI.BAT: " Patchwork
2026-03-28 15:53 ` ✓ Xe.CI.FULL: " Patchwork
2026-03-29  3:48 ` ✗ i915.CI.Full: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260327140627.64574-2-marcin.bernatowicz@linux.intel.com \
    --to=marcin.bernatowicz@linux.intel.com \
    --cc=adam.miszczak@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jakub1.kolakowski@intel.com \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=lukasz.laguna@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox