From: "Laguna, Lukasz" <lukasz.laguna@intel.com>
To: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>,
<igt-dev@lists.freedesktop.org>
Cc: "Michał Winiarski" <michal.winiarski@intel.com>,
"Adam Miszczak" <adam.miszczak@linux.intel.com>,
"Jakub Kolakowski" <jakub1.kolakowski@intel.com>
Subject: Re: [PATCH v3 i-g-t 3/7] tests/intel/xe_sriov_flr: Attach VFs to xe-vfio-pci before initiating FLR
Date: Mon, 9 Feb 2026 11:17:51 +0100 [thread overview]
Message-ID: <4d112e94-a54a-46b0-8545-6bce858e6c34@intel.com> (raw)
In-Reply-To: <20260204163217.121305-4-marcin.bernatowicz@linux.intel.com>
On 2/4/2026 17:32, Marcin Bernatowicz wrote:
> Attach all VFs to the xe-vfio-pci driver before running the FLR scenario.
> This allows the test to rely on xe-vfio-pci’s FLR wait handling, which is
> triggered when writing to the VF reset sysfs attribute.
>
> Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
> Suggested-by: Michał Winiarski <michal.winiarski@intel.com>
> Cc: Adam Miszczak <adam.miszczak@linux.intel.com>
> Cc: Jakub Kolakowski <jakub1.kolakowski@intel.com>
> Cc: Lukasz Laguna <lukasz.laguna@intel.com>
Reviewed-by: Lukasz Laguna <lukasz.laguna@intel.com>
>
> ---
> v2:
> - Unbind VFs only if they were successfully bound.
>
> ---
> tests/intel/xe_sriov_flr.c | 65 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 65 insertions(+)
>
> diff --git a/tests/intel/xe_sriov_flr.c b/tests/intel/xe_sriov_flr.c
> index 12989d0f5..2f6b24cf0 100644
> --- a/tests/intel/xe_sriov_flr.c
> +++ b/tests/intel/xe_sriov_flr.c
> @@ -9,6 +9,8 @@
> #include "drmtest.h"
> #include "igt_core.h"
> #include "igt_device.h"
> +#include "igt_kmod.h"
> +#include "igt_pci.h"
> #include "igt_sriov_device.h"
> #include "intel_chipset.h"
> #include "intel_vram.h"
> @@ -57,6 +59,8 @@ static const char STOP_REASON_ABORT[] = "ABORT";
> static const char STOP_REASON_FAIL[] = "FAIL";
> static const char STOP_REASON_SKIP[] = "SKIP";
>
> +#define DRIVER_OVERRIDE_TIMEOUT_MS 200
> +
> static struct g_mmio {
> struct xe_mmio *mmio;
> unsigned int num_vfs;
> @@ -276,6 +280,47 @@ static void subchecks_report_results(struct subcheck *checks, int num_checks)
> igt_skip_on(skips == num_checks);
> }
>
> +static bool vf_bind_driver_override(int pf_fd, unsigned int vf_id,
> + const char *driver)
> +{
> + char *slot = igt_sriov_get_vf_pci_slot_alloc(pf_fd, vf_id);
> + int ret;
> + char bound[64] = "none";
> + int bound_ret;
> +
> + igt_assert(slot);
> + igt_assert(driver);
> +
> + ret = igt_pci_bind_driver_override(slot, driver, DRIVER_OVERRIDE_TIMEOUT_MS);
> + if (ret < 0) {
> + bound_ret = igt_pci_get_bound_driver_name(slot, bound, sizeof(bound));
> + if (bound_ret <= 0)
> + snprintf(bound, sizeof(bound), "%s", "none");
> +
> + igt_warn_on_f(true,
> + "bind %s (VF%u) to %s ret=%d (currently bound: %s)\n",
> + slot, vf_id, driver, ret, bound);
> + }
> +
> + free(slot);
> +
> + return ret >= 0;
> +}
> +
> +static void vf_unbind_driver_override(int pf_fd, unsigned int vf_id)
> +{
> + char *slot = igt_sriov_get_vf_pci_slot_alloc(pf_fd, vf_id);
> + int ret;
> +
> + igt_assert(slot);
> +
> + ret = igt_pci_unbind_driver_override(slot, DRIVER_OVERRIDE_TIMEOUT_MS);
> + igt_warn_on_f(ret < 0, "unbind %s (VF%u) driver_override ret=%d\n",
> + slot, vf_id, ret);
> +
> + free(slot);
> +}
> +
> /**
> * flr_exec_strategy - Function pointer for FLR execution strategy
> * @pf_fd: File descriptor for the Physical Function (PF).
> @@ -325,6 +370,8 @@ static void verify_flr(int pf_fd, int num_vfs, struct subcheck *checks,
> {
> const int wait_flr_ms = 200;
> int i, vf_id, flr_vf_id = -1;
> + bool xe_vfio_loaded;
> + bool *vf_bound = NULL;
>
> igt_sriov_disable_driver_autoprobe(pf_fd);
> igt_sriov_enable_vfs(pf_fd, num_vfs);
> @@ -335,6 +382,16 @@ static void verify_flr(int pf_fd, int num_vfs, struct subcheck *checks,
> if (igt_warn_on(igt_pci_system_reinit()))
> goto disable_vfs;
>
> + xe_vfio_loaded = igt_kmod_load("xe_vfio_pci", NULL) >= 0;
> + if (xe_vfio_loaded) {
> + vf_bound = calloc(num_vfs + 1, sizeof(*vf_bound));
> + igt_assert(vf_bound);
> +
> + igt_sriov_enable_driver_autoprobe(pf_fd);
> + for (vf_id = 1; vf_id <= num_vfs; vf_id++)
> + vf_bound[vf_id] = vf_bind_driver_override(pf_fd, vf_id, "xe-vfio-pci");
> + }
> +
> init_mmio(pf_fd, num_vfs);
>
> for (i = 0; i < num_checks; ++i)
> @@ -357,6 +414,14 @@ cleanup:
>
> cleanup_mmio();
>
> + if (xe_vfio_loaded) {
> + for (vf_id = 1; vf_id <= num_vfs; vf_id++)
> + if (vf_bound && vf_bound[vf_id])
> + vf_unbind_driver_override(pf_fd, vf_id);
> + }
> +
> + free(vf_bound);
> +
> disable_vfs:
> igt_sriov_disable_vfs(pf_fd);
>
next prev parent reply other threads:[~2026-02-09 10:17 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-04 16:32 [PATCH v3 i-g-t 0/7] PCI driver helpers and xe-vfio-pci FLR improvement Marcin Bernatowicz
2026-02-04 16:32 ` [PATCH v3 i-g-t 1/7] lib/igt_sriov_device: Add helper to get VF PCI slot address Marcin Bernatowicz
2026-02-04 16:32 ` [PATCH v3 i-g-t 2/7] lib/igt_pci: Add generic PCI driver override and bind/unbind helpers Marcin Bernatowicz
2026-02-09 10:16 ` Laguna, Lukasz
2026-02-10 10:19 ` Bernatowicz, Marcin
2026-02-11 6:39 ` Laguna, Lukasz
2026-02-11 11:21 ` Bernatowicz, Marcin
2026-02-04 16:32 ` [PATCH v3 i-g-t 3/7] tests/intel/xe_sriov_flr: Attach VFs to xe-vfio-pci before initiating FLR Marcin Bernatowicz
2026-02-09 10:17 ` Laguna, Lukasz [this message]
2026-02-04 16:32 ` [PATCH v3 i-g-t 4/7] lib/igt_kmod: Fix PCI bind/unbind for module/driver name mismatch Marcin Bernatowicz
2026-02-04 16:32 ` [PATCH v3 i-g-t 5/7] tests/intel/xe_sriov_flr: Add --wait-flr-ms option Marcin Bernatowicz
2026-02-09 10:18 ` Laguna, Lukasz
2026-02-04 16:32 ` [PATCH v3 i-g-t 6/7] tests/intel/xe_sriov_flr: Add --no-xe-vfio-pci option Marcin Bernatowicz
2026-02-09 10:18 ` Laguna, Lukasz
2026-02-04 16:32 ` [PATCH v3 i-g-t 7/7] tests/intel/xe_sriov_flr: Skip xe-vfio-pci load/bind when IOMMU is off Marcin Bernatowicz
2026-02-09 10:42 ` Laguna, Lukasz
2026-02-10 11:23 ` Bernatowicz, Marcin
2026-02-11 6:43 ` Laguna, Lukasz
2026-02-04 18:27 ` ✓ Xe.CI.BAT: success for PCI driver helpers and xe-vfio-pci FLR improvement (rev3) Patchwork
2026-02-04 18:41 ` ✓ i915.CI.BAT: " Patchwork
2026-02-05 5:02 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-02-05 10:13 ` Bernatowicz, Marcin
2026-02-05 8:13 ` ✓ i915.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=4d112e94-a54a-46b0-8545-6bce858e6c34@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@linux.intel.com \
--cc=michal.winiarski@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