[PATCH 5/5] drm/xe/configfs: Allow adding configurations for future VFs
Michal Wajdeczko
michal.wajdeczko at intel.com
Thu Jul 17 18:48:25 UTC 2025
Since we are expecting that all configuration directory names
will match some of the existing devices, we can't provide any
configuration for the VFs until they are actually enabled.
But we can relax that restriction by just checking if there
is a PF device that could create given VF. This is easy since
all our PF devices are always present at function 0 and we can
query PF device for number of VFs it could support.
Then for some system with PF device at 0000:00:02.0 we can add
configs for all VFs:
/sys/kernel/config/xe/
├── 0000:00:02.0
│ └── ...
├── 0000:00:02.1
│ └── ...
├── 0000:00:02.2
│ └── ...
:
└── 0000:00:02.7
└── ...
Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
Cc: Lucas De Marchi <lucas.demarchi at intel.com>
---
drivers/gpu/drm/xe/xe_configfs.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_configfs.c
index 1df8cce78f13..e6246f1761cf 100644
--- a/drivers/gpu/drm/xe/xe_configfs.c
+++ b/drivers/gpu/drm/xe/xe_configfs.c
@@ -274,10 +274,17 @@ static struct config_group *xe_config_make_device_group(struct config_group *gro
return ERR_PTR(-EINVAL);
pdev = pci_get_domain_bus_and_slot(domain, bus, PCI_DEVFN(slot, function));
+ if (!pdev && function)
+ pdev = pci_get_domain_bus_and_slot(domain, bus, PCI_DEVFN(slot, 0));
+ if (!pdev && slot)
+ pdev = pci_get_domain_bus_and_slot(domain, bus, PCI_DEVFN(0, 0));
if (!pdev)
return ERR_PTR(-ENODEV);
- match = pci_is_vga(pdev) && pdev->vendor == PCI_VENDOR_ID_INTEL;
+ match = pci_is_vga(pdev) && pdev->vendor == PCI_VENDOR_ID_INTEL &&
+ (PCI_DEVFN(slot, function) == pdev->devfn ||
+ function <= pci_sriov_get_totalvfs(pdev) ||
+ PCI_DEVFN(slot, function) <= pci_sriov_get_totalvfs(pdev));
pci_dev_put(pdev);
--
2.47.1
More information about the Intel-xe
mailing list