Re: [PATCH] tests/intel/xe_pm: include PCI domain in i2c adapter name

Raag Jadav <[email protected]> Fri, 24 Jul 2026 09:53:36 +0200
Newsgroups org.freedesktop.lists.igt-dev
Message-ID <[email protected]>
On Thu, Jul 23, 2026 at 02:05:37AM +0530, Sk Anirban wrote:
> The i2c_designware adapter name only encoded bus and device, which
> fails on non-zero PCI domains. Include the full domain/bus/device and
> widen the format specifier.
> 
> Also fix IGT by using the devfn in the adapter id to match the kernel.
> 
> kernel implementation:
> https://patchwork.freedesktop.org/series/170812/

Add this as a Link: tag.

> Signed-off-by: Sk Anirban <[email protected]>
> ---
>  tests/intel/xe_pm.c            | 5 +++--
>  tests/intel/xe_survivability.c | 5 +++--
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/intel/xe_pm.c b/tests/intel/xe_pm.c
> index 6fbc13e43..840e3f0be 100644
> --- a/tests/intel/xe_pm.c
> +++ b/tests/intel/xe_pm.c
> @@ -866,8 +866,9 @@ static int find_i2c_adapter(device_t device, int sysfs_fd)
>  	/* Make sure the /dev/i2c-* files exist */
>  	igt_require(igt_kmod_load("i2c-dev", NULL) == 0);
>  
> -	snprintf(adapter, sizeof(adapter), "%s.%hu", "device/i2c_designware",
> -		 (device.pci_xe->bus << 8) | (device.pci_xe->dev));
> +	snprintf(adapter, sizeof(adapter), "%s.%u", "device/i2c_designware",
> +		 (device.pci_xe->domain << 16 | device.pci_xe->bus << 8 |
> +		  (device.pci_xe->dev << 3 | device.pci_xe->func)));

Align this with above line.

>  	adapter_fd = openat(sysfs_fd, adapter, O_RDONLY);
>  	igt_require_fd(adapter_fd);
>  
> diff --git a/tests/intel/xe_survivability.c b/tests/intel/xe_survivability.c
> index 74488bbea..d72884e70 100644
> --- a/tests/intel/xe_survivability.c
> +++ b/tests/intel/xe_survivability.c
> @@ -126,8 +126,9 @@ static int find_i2c_adapter(struct pci_device *pci_xe)
>  
>  	igt_require(igt_kmod_load("i2c-dev", NULL) == 0);
>  
> -	snprintf(device_path, sizeof(device_path), "/sys/bus/pci/devices/%s/%s.%hu", bus_addr,
> -		 "i2c_designware", (pci_xe->bus << 8) | (pci_xe->dev));
> +	snprintf(device_path, sizeof(device_path), "/sys/bus/pci/devices/%s/%s.%u", bus_addr,
> +		 "i2c_designware", (pci_xe->domain << 16 | pci_xe->bus << 8 |
> +		  (pci_xe->dev << 3 | pci_xe->func)));

Ditto.

Reviewed-by: Raag Jadav <[email protected]>

>  	device_dir = opendir(device_path);
>  
>  	if (!device_dir)
> -- 
> 2.43.0
>