[PATCH i-g-t v4] tools/mk_detect_intel_gpu: add a tool to detect Intel GPUs from their PCI IDs

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Mon Jun 3 07:35:18 UTC 2024


On Thu, May 23, 2024 at 12:10:05PM +0300, Jani Nikula wrote:
<cut>

> >
> > The generated script itself doesn't require anything other than lspci to
> > run, as what the script does, on its 35 lines of code (not including the
> > PCI ID database), is:
> >
> > 	1. run lspci -nm
> >
> > 	2. If the PCI ID device is at the database, it prints:
> >
> > 		print "Detected GPU PCI device: $id$subtype, PCI ID: $pci_id\n";
> >
> > 	   For the above example, the output is:
> >
> > 		Detected GPU PCI device: CFL (CML_U_GT2), PCI ID: 8086:9b41
> >
> > 	3. If multiple Intel GPUs are found, it prints a warning, as DUT
> > 	   tests may require an extra parameter to use the right GPU:
> >
> > 		Warning: More than one Intel GPUs detected
> >
> > 	4. if no Intel GPU is found, it will print:
> >
> > 		Warning: No Intel GPUs detected
> 
> The way I see it, intel_device_info.c and igt_device_scan.c have all the
> building blocks necessary to accomplish this. As long as
> intel_device_match[] is kept up-to-date, which naturally will be, it
> needs no further maintenance. It could be added to lsgpu as an option.
> 

Currently igt_device_scan.c is limited to devices which have drm driver
loaded (that was danvet requirement of udev scanning of drm devices, not
pci). But if I'm not wrong it would be relatively simple to add
scan_pci_devices() in which we would iterate over udev pci devices and
filter out 300 class then add some switch to display it lsgpu. We would
at least keep this simply in igt, without any additional scripting/tools
needed.

--
Zbigniew


More information about the igt-dev mailing list