[PATCH 5/5] drm/xe/configfs: Allow adding configurations for future VFs

Cavitt, Jonathan jonathan.cavitt at intel.com
Thu Jul 17 21:19:54 UTC 2025


-----Original Message-----
From: Intel-xe <intel-xe-bounces at lists.freedesktop.org> On Behalf Of Michal Wajdeczko
Sent: Thursday, July 17, 2025 11:48 AM
To: intel-xe at lists.freedesktop.org
Cc: Wajdeczko, Michal <Michal.Wajdeczko at intel.com>; De Marchi, Lucas <lucas.demarchi at intel.com>
Subject: [PATCH 5/5] drm/xe/configfs: Allow adding configurations for future VFs
> 
> 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));

In line with my comment on the previous patch, it might make sense to separate
this check into two parts.  Something like:

"""
	op_supported = pci_is_vga(pdev) && pdev->vendor == PCI_VENDOR_ID_INTEL;
	match = 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);

	if (!op_supported || !match)
		return ERR_PTR(-ENODEV);
"""

Again, though, this is a non-blocking suggestion.

Reviewed-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
-Jonathan Cavitt

>  
>  	pci_dev_put(pdev);
>  
> -- 
> 2.47.1
> 
> 


More information about the Intel-xe mailing list