igt-dev.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Lukasz Laguna <lukasz.laguna@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: marcin.bernatowicz@intel.com, jakub1.kolakowski@intel.com,
	adam.miszczak@linux.intel.com, lukasz.laguna@intel.com
Subject: [PATCH v1 1/2] tests/intel/xe_sriov_ggtt: Support execution with pre-enabled VFs
Date: Tue, 25 Aug 2026 16:18:05 +0200	[thread overview]
Message-ID: <20260825141806.2278653-2-lukasz.laguna@intel.com> (raw)
In-Reply-To: <20260825141806.2278653-1-lukasz.laguna@intel.com>

Allow the pf-check-vfs-ids subtest to run in environment where VFs are
already enabled. To do that, the VFS_ENABLED=1 environment variable
needs to be set.

When VFs are pre-enabled, the pf-check-vfs-id subtest uses the existing
VF, while other subtests that require test managed VF enabling are
skipped.

Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
---
 tests/intel/xe_sriov_ggtt.c | 56 +++++++++++++++++++++++++++++--------
 1 file changed, 44 insertions(+), 12 deletions(-)

diff --git a/tests/intel/xe_sriov_ggtt.c b/tests/intel/xe_sriov_ggtt.c
index 2c2184930..bdce64c77 100644
--- a/tests/intel/xe_sriov_ggtt.c
+++ b/tests/intel/xe_sriov_ggtt.c
@@ -47,6 +47,8 @@ IGT_TEST_DESCRIPTION("Xe tests for SR-IOV GGTT");
 
 #define SRIOV_GGTT_TC(__name)	.test = __name, .name = #__name
 
+static bool use_existing_vfs;
+
 struct ggtt_test_data {
 	int pf_fd;
 	struct xe_mmio mmio;
@@ -399,8 +401,10 @@ static void init_subtest(int pf_fd, int vf_id, uint8_t tile,
 	uint16_t dev_id = intel_get_drm_devid(pf_fd);
 	unsigned int nr_ranges, main_gt;
 
-	igt_sriov_disable_driver_autoprobe(pf_fd);
-	igt_sriov_enable_vfs(pf_fd, num_vfs);
+	if (!use_existing_vfs) {
+		igt_sriov_disable_driver_autoprobe(pf_fd);
+		igt_sriov_enable_vfs(pf_fd, num_vfs);
+	}
 
 	/* refresh PCI state */
 	igt_pci_system_reinit();
@@ -437,7 +441,8 @@ static void fini_subtest(struct xe_sriov_provisioned_range *range,
 		xe_mmio_access_fini(&test_data->pf_mmio);
 	xe_mmio_access_fini(&test_data->mmio);
 
-	igt_sriov_disable_vfs(test_data->pf_fd);
+	if (!use_existing_vfs)
+		igt_sriov_disable_vfs(test_data->pf_fd);
 }
 
 #define for_each_pte_test(tc__, testcases__) \
@@ -663,6 +668,12 @@ static void skip_on_mtl_vf(int pf_fd)
 		      "On MTL VF there is no access to GGTT through MMIO, skip\n");
 }
 
+static void skip_when_using_existing_vfs(void)
+{
+	igt_skip_on_f(use_existing_vfs,
+		      "This subtest cannot be run with existing VFs\n");
+}
+
 static int opts_handler(int opt, int opt_index, void *data)
 {
 	switch (opt) {
@@ -691,6 +702,7 @@ static const char help_str[] =
 
 int igt_main_args("", long_opts, help_str, opts_handler, NULL)
 {
+	unsigned int enabled_vfs;
 	bool autoprobe;
 	uint8_t tile;
 	int pf_fd;
@@ -699,26 +711,39 @@ int igt_main_args("", long_opts, help_str, opts_handler, NULL)
 	{
 		pf_fd = drm_open_driver(DRIVER_XE);
 		igt_require(igt_sriov_is_pf(pf_fd));
-		igt_require(igt_sriov_get_enabled_vfs(pf_fd) == 0);
+		use_existing_vfs = igt_check_boolean_env_var("VFS_ENABLED", false);
+		enabled_vfs = igt_sriov_get_enabled_vfs(pf_fd);
+		igt_require(use_existing_vfs ? enabled_vfs > 0 : enabled_vfs == 0);
 		autoprobe = igt_sriov_is_driver_autoprobe_enabled(pf_fd);
 	}
 
 	igt_describe("Verify that the VF ID in the GGTT PTE has been correctly assigned");
-	igt_subtest_with_dynamic("pf-check-vfs-ids")
-		for_each_sriov_num_vfs(pf_fd, num_vfs)
+	igt_subtest_with_dynamic("pf-check-vfs-ids") {
+		if (use_existing_vfs) {
 			xe_for_each_tile(pf_fd, tile)
-				igt_dynamic_f("numvfs-%u-tile-%u", num_vfs, tile)
-					pf_check_vfs_ids(pf_fd, tile, num_vfs);
+				igt_dynamic_f("numvfs-%u-tile-%u", enabled_vfs, tile)
+					pf_check_vfs_ids(pf_fd, tile, enabled_vfs);
+		} else {
+			for_each_sriov_num_vfs(pf_fd, num_vfs) {
+				xe_for_each_tile(pf_fd, tile)
+					igt_dynamic_f("numvfs-%u-tile-%u", num_vfs, tile)
+						pf_check_vfs_ids(pf_fd, tile, num_vfs);
+			}
+		}
+	}
 
 	igt_describe("Verify on PF the modifiability of GGTT PTE assigned to VFs");
-	igt_subtest_with_dynamic("pf-check-vfs-pte")
+	igt_subtest_with_dynamic("pf-check-vfs-pte") {
+		skip_when_using_existing_vfs();
 		xe_for_each_tile(pf_fd, tile)
 			igt_dynamic_f("tile-%u", tile)
 				pf_check_vfs_pte(pf_fd, tile);
+	}
 
 	igt_describe("Verify of modifiability of GGTT PTE owned by VF");
 	igt_subtest_with_dynamic("vfs-check-own-pte") {
 		skip_on_mtl_vf(pf_fd);
+		skip_when_using_existing_vfs();
 		for_each_sriov_vf(pf_fd, vf_id)
 			xe_for_each_tile(pf_fd, tile)
 				igt_dynamic_f("vf%u-tile-%u", vf_id, tile)
@@ -729,6 +754,7 @@ int igt_main_args("", long_opts, help_str, opts_handler, NULL)
 	igt_subtest_with_dynamic("vfs-check-other-vfs-pte") {
 		igt_require(igt_sriov_get_total_vfs(pf_fd) > 1);
 		skip_on_mtl_vf(pf_fd);
+		skip_when_using_existing_vfs();
 		for_each_sriov_vf(pf_fd, vf_id)
 			xe_for_each_tile(pf_fd, tile)
 				igt_dynamic_f("vf%u-tile-%u", vf_id, tile)
@@ -738,6 +764,7 @@ int igt_main_args("", long_opts, help_str, opts_handler, NULL)
 	igt_describe("Verify the non-availability of VF to GGTT PTEs owned by PF");
 	igt_subtest_with_dynamic("vfs-check-pf-pte") {
 		skip_on_mtl_vf(pf_fd);
+		skip_when_using_existing_vfs();
 		for_each_sriov_vf(pf_fd, vf_id)
 			xe_for_each_tile(pf_fd, tile)
 				igt_dynamic_f("vf%u-tile-%u", vf_id, tile)
@@ -745,9 +772,14 @@ int igt_main_args("", long_opts, help_str, opts_handler, NULL)
 	}
 
 	igt_fixture() {
-		igt_sriov_disable_vfs(pf_fd);
-		/* abort to avoid execution of next tests with enabled VFs */
-		igt_abort_on_f(igt_sriov_get_enabled_vfs(pf_fd) > 0, "Failed to disable VF(s)");
+		if (use_existing_vfs) {
+			if (igt_sriov_get_enabled_vfs(pf_fd) != enabled_vfs)
+				igt_warn("Test modified number of enabled VFs\n");
+		} else {
+			igt_sriov_disable_vfs(pf_fd);
+			/* abort to avoid execution of next tests with enabled VFs */
+			igt_abort_on_f(igt_sriov_get_enabled_vfs(pf_fd) > 0, "Failed to disable VF(s)");
+		}
 		autoprobe ? igt_sriov_enable_driver_autoprobe(pf_fd) :
 			    igt_sriov_disable_driver_autoprobe(pf_fd);
 		igt_abort_on_f(autoprobe != igt_sriov_is_driver_autoprobe_enabled(pf_fd),
-- 
2.43.0


  reply	other threads:[~2026-08-25 14:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25 14:18 [PATCH v1 0/2] Support test execution with pre-enabled VFs Lukasz Laguna
2026-08-25 14:18 ` Lukasz Laguna [this message]
2026-09-07 10:48   ` [PATCH v1 1/2] tests/intel/xe_sriov_ggtt: Support " Bernatowicz, Marcin
2026-08-25 14:18 ` [PATCH v1 2/2] tests/intel/xe_sriov_vram: " Lukasz Laguna
2026-08-25 15:20 ` ✓ Xe.CI.BAT: success for Support test " Patchwork
2026-08-25 15:32 ` ✓ i915.CI.BAT: " Patchwork
2026-08-25 18:38 ` ✗ i915.CI.Full: failure " Patchwork
2026-08-25 19:19 ` ✓ Xe.CI.FULL: success " 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=20260825141806.2278653-2-lukasz.laguna@intel.com \
    --to=lukasz.laguna@intel.com \
    --cc=adam.miszczak@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jakub1.kolakowski@intel.com \
    --cc=marcin.bernatowicz@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;
as well as URLs for NNTP newsgroup(s).