public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] lib/igt_sriov_device: Update igt_sriov_enable_vfs helper
@ 2026-04-20 10:47 Jakub Kolakowski
  2026-04-21 13:01 ` Jani Nikula
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Jakub Kolakowski @ 2026-04-20 10:47 UTC (permalink / raw)
  To: igt-dev
  Cc: Jakub Kolakowski, Adam Miszczak, Lukasz Laguna,
	Marcin Bernatowicz, Katarzyna Piecielska

Some platforms may expose sriov capability and sriov_totalvfs will be
greater than 0 while the driver actually doesn't support the platform.
In such case igt_sriov_is_pf() helper that checks for sriov_totalvfs
will pass.
Add additional check within igt_sriov_enable_vfs() function to check if
writing to sriov_numvfs was successfull and what errno was returned
during this operation. ENOENT will mean that SR-IOV isn't supported for
given configuration. In such case test will skip instead of failing.

Cc: Adam Miszczak <adam.miszczak@linux.intel.com>
Cc: Lukasz Laguna <lukasz.laguna@intel.com>
Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Cc: Katarzyna Piecielska <katarzyna.piecielska@intel.com>
Signed-off-by: Jakub Kolakowski <jakub1.kolakowski@intel.com>
---
 lib/igt_sriov_device.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/igt_sriov_device.c b/lib/igt_sriov_device.c
index 1f4c3ac04..3fadcf0aa 100644
--- a/lib/igt_sriov_device.c
+++ b/lib/igt_sriov_device.c
@@ -174,10 +174,16 @@ unsigned int igt_sriov_get_enabled_vfs(int pf)
  */
 void igt_sriov_enable_vfs(int pf, unsigned int num_vfs)
 {
+	bool ret;
+
 	igt_assert(num_vfs > 0);
 
 	igt_debug("Enabling %u VFs\n", num_vfs);
-	pf_attr_set_u32(pf, "device/sriov_numvfs", num_vfs);
+	ret = __pf_attr_set_u32(pf, "device/sriov_numvfs", num_vfs);
+
+	igt_require_f(!(ret == false && errno == ENOENT), "SR-IOV not supported\n");
+
+	igt_assert_f(ret, "Failed to write %u to device/sriov_numvfs (%s)\n", num_vfs, strerror(errno));
 }
 
 /**
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-04-21 22:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-20 10:47 [PATCH i-g-t] lib/igt_sriov_device: Update igt_sriov_enable_vfs helper Jakub Kolakowski
2026-04-21 13:01 ` Jani Nikula
2026-04-21 17:26 ` ✓ i915.CI.BAT: success for " Patchwork
2026-04-21 18:11 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-21 21:13 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-21 22:42 ` ✗ i915.CI.Full: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox