From: Jani Nikula <jani.nikula@intel.com>
To: Jakub Kolakowski <jakub1.kolakowski@intel.com>,
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: Re: [PATCH i-g-t] lib/igt_sriov_device: Update igt_sriov_enable_vfs helper
Date: Tue, 21 Apr 2026 16:01:25 +0300 [thread overview]
Message-ID: <4dfdb0cc3dd54263bdeee5fc9d1ac447b4b81603@intel.com> (raw)
In-Reply-To: <20260420104720.14881-1-jakub1.kolakowski@intel.com>
On Mon, 20 Apr 2026, Jakub Kolakowski <jakub1.kolakowski@intel.com> wrote:
> 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");
You can only trust errno immediately after the failing libc function.
There are so many things happening in __pf_attr_set_u32() and the IGT
functions it calls that this is completely unreliable.
The way the igt_sysfs_set_u32() stuff are written, you need to make them
propagate an int -errno return value from deep down to check for ENOENT.
Or check for SR-IOV separately some other way.
BR,
Jani.
> +
> + igt_assert_f(ret, "Failed to write %u to device/sriov_numvfs (%s)\n", num_vfs, strerror(errno));
> }
>
> /**
--
Jani Nikula, Intel
next prev parent reply other threads:[~2026-04-21 13:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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=4dfdb0cc3dd54263bdeee5fc9d1ac447b4b81603@intel.com \
--to=jani.nikula@intel.com \
--cc=adam.miszczak@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jakub1.kolakowski@intel.com \
--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