public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jakub Kolakowski <jakub1.kolakowski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Jakub Kolakowski <jakub1.kolakowski@intel.com>,
	Adam Miszczak <adam.miszczak@linux.intel.com>,
	Lukasz Laguna <lukasz.laguna@intel.com>,
	Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>,
	Katarzyna Piecielska <katarzyna.piecielska@intel.com>
Subject: [PATCH i-g-t] lib/igt_sriov_device: Update igt_sriov_enable_vfs helper
Date: Mon, 20 Apr 2026 10:47:20 +0000	[thread overview]
Message-ID: <20260420104720.14881-1-jakub1.kolakowski@intel.com> (raw)

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


             reply	other threads:[~2026-04-20  9:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-20 10:47 Jakub Kolakowski [this message]
2026-04-21 13:01 ` [PATCH i-g-t] lib/igt_sriov_device: Update igt_sriov_enable_vfs helper 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

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=20260420104720.14881-1-jakub1.kolakowski@intel.com \
    --to=jakub1.kolakowski@intel.com \
    --cc=adam.miszczak@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=katarzyna.piecielska@intel.com \
    --cc=lukasz.laguna@intel.com \
    --cc=marcin.bernatowicz@linux.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