Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Bernatowicz, Marcin" <marcin.bernatowicz@linux.intel.com>
To: Jakub Kolakowski <jakub1.kolakowski@intel.com>,
	igt-dev@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@intel.com>,
	Adam Miszczak <adam.miszczak@linux.intel.com>,
	Lukasz Laguna <lukasz.laguna@intel.com>,
	Katarzyna Piecielska <katarzyna.piecielska@intel.com>
Subject: Re: [PATCH i-g-t v2] lib/igt_sriov_device: Update igt_sriov_enable_vfs helper
Date: Mon, 11 May 2026 09:47:26 +0200	[thread overview]
Message-ID: <34763254-1e38-4a07-9cb0-19c60b4f6399@linux.intel.com> (raw)
In-Reply-To: <20260506173811.157330-1-jakub1.kolakowski@intel.com>


On 5/6/2026 7:38 PM, Jakub Kolakowski 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.
>
> V2:
>   - replace __pf_attr_set_u32() with igt_sysfs_printf to reduce layers of
>     helper functions and increase reliability of checking for errno
>
> Cc: Jani Nikula <jani.nikula@intel.com>
> 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 | 14 +++++++++++++-
>   1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/lib/igt_sriov_device.c b/lib/igt_sriov_device.c
> index 1f4c3ac04..4be57deea 100644
> --- a/lib/igt_sriov_device.c
> +++ b/lib/igt_sriov_device.c
> @@ -174,10 +174,22 @@ unsigned int igt_sriov_get_enabled_vfs(int pf)
>    */
>   void igt_sriov_enable_vfs(int pf, unsigned int num_vfs)
>   {
> +	int sysfs;
> +	int ret;
> +
> +	igt_assert(igt_sriov_is_pf(pf));
>   	igt_assert(num_vfs > 0);
>   
> +	sysfs = igt_sysfs_open(pf);
> +	igt_assert_fd(sysfs);
> +
>   	igt_debug("Enabling %u VFs\n", num_vfs);
> -	pf_attr_set_u32(pf, "device/sriov_numvfs", num_vfs);
> +	ret = igt_sysfs_printf(sysfs, "device/sriov_numvfs", "%u", num_vfs);
> +	close(sysfs);
> +
> +	igt_require_f(ret != -ENOENT, "SR-IOV not supported\n");
> +	igt_assert_f(ret > 0, "Failed to write %u to device/sriov_numvfs (%s)\n",
> +		     num_vfs, strerror(abs(ret)));

strerror(-ret),

Missing Closes: 
https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12910 tag ?

with that,

Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>

>   }
>   
>   /**

      parent reply	other threads:[~2026-05-11  7:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06 17:38 [PATCH i-g-t v2] lib/igt_sriov_device: Update igt_sriov_enable_vfs helper Jakub Kolakowski
2026-05-06 18:39 ` ✓ Xe.CI.BAT: success for lib/igt_sriov_device: Update igt_sriov_enable_vfs helper (rev2) Patchwork
2026-05-06 18:44 ` ✓ i915.CI.BAT: " Patchwork
2026-05-06 20:35 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-05-07  1:08 ` ✗ i915.CI.Full: " Patchwork
2026-05-11  7:47 ` Bernatowicz, Marcin [this message]

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=34763254-1e38-4a07-9cb0-19c60b4f6399@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=jani.nikula@intel.com \
    --cc=katarzyna.piecielska@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