public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Bernatowicz, Marcin" <marcin.bernatowicz@linux.intel.com>
To: "Laguna, Lukasz" <lukasz.laguna@intel.com>,
	igt-dev@lists.freedesktop.org
Cc: "Jakub Kolakowski" <jakub1.kolakowski@intel.com>,
	"Michał Winiarski" <michal.winiarski@intel.com>,
	"Piotr Piórkowski" <piotr.piorkowski@intel.com>
Subject: Re: [PATCH v3 i-g-t 7/7] tests/intel/xe_sriov_flr: Skip xe-vfio-pci load/bind when IOMMU is off
Date: Tue, 10 Feb 2026 12:23:48 +0100	[thread overview]
Message-ID: <bf66b0d7-d0d6-466e-ab9b-f6bc60cf8dec@linux.intel.com> (raw)
In-Reply-To: <17a502c4-87ec-40dd-b45f-72201485bc16@intel.com>


On 2/9/2026 11:42 AM, Laguna, Lukasz wrote:
>
> On 2/4/2026 17:32, Marcin Bernatowicz wrote:
>> When the IOMMU is disabled VFs typically lack an iommu_group, and
>> xe-vfio-pci binding may fail. Skip load/bind in that case.
>
> I'm not sure if checking for IOMMU groups is enough.
> I think it's possible that the device has the IOMMU group and vfio-pci 
> still fail to bind if e.g. CONFIG_VFIO_IOMMU_TYPE1 is disabled.
>
> We have a control on the environment where test is executed, so I'm 
> not sure if this patch is needed. We prefer to use the approach with 
> xe-vfio-pci, so if it fails because of the system configuration than I 
> think it would be better to fix the configuration.


Maybe it's good time to add xe_sriov_vfio test with some basic checks:

igt@xe_sriov_vfio@load-xe-vfio-pci
igt@xe_sriov_vfio@unload-xe-vfio-pci
igt@xe_sriov_vfio@bind-unbind-vf
igt@xe_sriov_vfio@open-basic

?

>> Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
>> Cc: Jakub Kolakowski <jakub1.kolakowski@intel.com>
>> Cc: Lukasz Laguna <lukasz.laguna@intel.com>
>> Cc: Michał Winiarski <michal.winiarski@intel.com>
>> Cc: Piotr Piórkowski <piotr.piorkowski@intel.com>
>> ---
>>   tests/intel/xe_sriov_flr.c | 43 +++++++++++++++++++++++++++++++++++---
>>   1 file changed, 40 insertions(+), 3 deletions(-)
>>
>> diff --git a/tests/intel/xe_sriov_flr.c b/tests/intel/xe_sriov_flr.c
>> index b73727787..3fc84bbf9 100644
>> --- a/tests/intel/xe_sriov_flr.c
>> +++ b/tests/intel/xe_sriov_flr.c
>> @@ -13,6 +13,7 @@
>>   #include "igt_kmod.h"
>>   #include "igt_pci.h"
>>   #include "igt_sriov_device.h"
>> +#include "igt_sysfs.h"
>>   #include "intel_chipset.h"
>>   #include "intel_vram.h"
>>   #include "linux_scaffold.h"
>> @@ -325,6 +326,44 @@ static void vf_unbind_driver_override(int pf_fd, 
>> unsigned int vf_id)
>>       free(slot);
>>   }
>>   +static bool vf_has_iommu_group(int pf_fd, unsigned int vf_id)
>> +{
>> +    int sysfs;
>> +    bool present;
>> +
>> +    sysfs = igt_sriov_device_sysfs_open(pf_fd, vf_id);
>> +    if (sysfs < 0)
>> +        return false;
>> +
>> +    present = igt_sysfs_has_attr(sysfs, "iommu_group");
>> +    close(sysfs);
>> +
>> +    return present;
>> +}
>> +
>> +static bool vfs_have_iommu_groups(int pf_fd, int num_vfs)
>> +{
>> +    for (int vf_id = 1; vf_id <= num_vfs; vf_id++)
>> +        if (!vf_has_iommu_group(pf_fd, vf_id))
>> +            return false;
>> +
>> +    return true;
>> +}
>> +
>> +static bool try_load_xe_vfio_pci(int pf_fd, int num_vfs)
>> +{
>> +    if (!g_use_xe_vfio_pci)
>> +        return false;
>> +
>> +    if (!vfs_have_iommu_groups(pf_fd, num_vfs)) {
>> +        igt_info("Disabling xe-vfio-pci binding: missing VF IOMMU 
>> group(s) (IOMMU off?)\n");
>> +        g_use_xe_vfio_pci = false;
>> +        return false;
>> +    }
>> +
>> +    return igt_kmod_load("xe_vfio_pci", NULL) >= 0;
>> +}
>> +
>>   /**
>>    * flr_exec_strategy - Function pointer for FLR execution strategy
>>    * @pf_fd: File descriptor for the Physical Function (PF).
>> @@ -386,9 +425,7 @@ 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 = false;
>> -    if (g_use_xe_vfio_pci)
>> -        xe_vfio_loaded = igt_kmod_load("xe_vfio_pci", NULL) >= 0;
>> +    xe_vfio_loaded = try_load_xe_vfio_pci(pf_fd, num_vfs);
>>       if (xe_vfio_loaded) {
>>           vf_bound = calloc(num_vfs + 1, sizeof(*vf_bound));
>>           igt_assert(vf_bound);

  reply	other threads:[~2026-02-10 11:23 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
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 [this message]
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=bf66b0d7-d0d6-466e-ab9b-f6bc60cf8dec@linux.intel.com \
    --to=marcin.bernatowicz@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jakub1.kolakowski@intel.com \
    --cc=lukasz.laguna@intel.com \
    --cc=michal.winiarski@intel.com \
    --cc=piotr.piorkowski@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