[igt-dev] [RFC] IGT device scanning and selection

Daniel Vetter daniel at ffwll.ch
Wed Jun 5 12:35:28 UTC 2019


On Tue, Jun 04, 2019 at 08:09:55AM +0000, Kempczynski, Zbigniew wrote:
> Hi all.
> 
> IGT device management is a little bit old. More than one GPU on the machine 
> are available on the market from years so there's time to propose new device
> management in IGT.
> 
> Selection using bus-device or functional specifiers.
> ---
> 1. bus-device selection
>    Current devices are mostly PCI-Express devices, but we should be able to
>    open to specify device using any bus selection. For example:
>    --device PCI:00:02.0
>    would select PCI device on 00 bus, 02 device and function 0.
> 
>    --device USB:002:003
>    would select device 003 on bus 002.
>   
>    Future buses can be specified by extending --device argument parsing.

Please note that not everything is a pci device, and drm and igt work on
hw without any pci devices. So if you want to specify a device, I think it
needs to be the full sysfs path. Otherwise we'll write yet another custom
device id -> sysfs path parser, and libdrm already has a few of those and
they're all terrible :-)

Full sysfs path should be fairly easy to compare with drm nodes by chasing
the the sysfs device link. For simplicity I guess we could allow substring
matching, so for pci devices you wouldn't have to give the full path
(which is usually really long).
 
> 2. Functional selection
>    CI environments shouldn't rely on bus-device. Same devices (GPUs) may be 
>    inserted into different slots so functional selection is required. 
>    
>    Let's imagine machine have 5 cards:
>    00:02:0 - VendorX, product: A
>    00:03:0 - VendorY, product: B
>    00:04:0 - VendorX, product: A
>    00:05:0 - VendorY, product: C
>    00:06:0 - VendorX, product: D
> 
>    We should be able to select same device regardless order on the bus.
>    For example:
>    --device VendorX:A 
>    --device VendorX:A:0 
>    will select first A card of VendorX
> 
>    --device VendorY:A:1
>    will select second A card of VendorX
> 
>    If vendor would like to have its own parsing method for the product
>    overriding parsing will be possible. For example:
>    --device VendorX:GPU-Card:0
>    VendorX must then register its own function to handle 'GPU-Card:0'
>    string on his own. 

Udev has this idea of matching device properties. I think we should use
that, not reinvent our own wheel here. udev can give you a list of
property=value pairs for a given device, we could just again match again
those blindly. No new device parsing logic in libdrm or igt please :-)
-Daniel

> 
> ===
> 
> Device management
> ---
> New device management should allow user to see current devices. 
> I propose IGT tool called 'lsgpu' which would discover devices in 
> any registered bus topologies scanning methods.
> 
> ---
> Best,
> Zbigniew KempczyƄski
> 
> 
> 
> 
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the igt-dev mailing list