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

Mauro Carvalho Chehab mauro.chehab at linux.intel.com
Sat May 25 05:44:30 UTC 2024


On Fri, 24 May 2024 11:49:36 +0300
Jani Nikula <jani.nikula at intel.com> wrote:

> On Thu, 23 May 2024, Kamil Konieczny <kamil.konieczny at linux.intel.com> wrote:
> > Maybe this should/may be added to scripts?
> > I do find it usefull to have a little script checks,
> > without much dependancy on other libs/tools. I would
> > also want to have a way to semi-automatically update
> > it later on, where new devices will be added.  
> 
> I never questioned the usefulness of such a tool. Only the
> implementation, and how perl/make are not aligned with the IGT project,
> and the constant maintenance burden all of this brings.

Maintenance is required only when the macros to define PCI IDs at the
i915 driver changes - or if Xe driver stops using INTEL_VGA_MACRO.
This is not frequent. The only changes such approach had since when it
was written, back in 2022 is when we added support for Xe driver, and
now that the PCI ID macros at drm-tip for i915 changed.

With regards to the latest change, the v5 of this patch solves it.
The only change to make it compatible with the new way is to add a
single line:

	if [ "$$(grep MACRO__ i915_pciids.h)" != "" ]; then sed -E "s/(INTEL_\S+_IDS\()/\1INTEL_VGA_DEVICE, /" -i i915_id.h; fi

As, up to the current upstream Kernel, the macro to define a PCI ID
inside i915_pciids.h were:

	#define INTEL_I815_IDS(info)					\
		INTEL_VGA_DEVICE(0x1132, info)  /* I815*/
	...

And, on current upstream, it now requires INTEL_VGA_DEVICE to be
passed on its first argument:

	#define INTEL_I815_IDS(MACRO__, ...) \
		MACRO__(0x1132, ## __VA_ARGS__)  /* I815*/
	...

So, the generated list of PCI IDs should be changed from:

	static struct pci_device_id pci_ids[] = {
		INTEL_PVC_IDS("PVC"),
		INTEL_MTL_IDS("MTL"),
		INTEL_MTL_P_IDS("MTL_P"),
		INTEL_MTL_M_IDS("MTL_M"),
		...

to:

	static struct pci_device_id pci_ids[] = {
		INTEL_PVC_IDS(INTEL_VGA_DEVICE, "PVC"),
		INTEL_MTL_IDS(INTEL_VGA_DEVICE, "MTL"),
		INTEL_MTL_P_IDS(INTEL_VGA_DEVICE, "MTL_P"),
		INTEL_MTL_M_IDS(INTEL_VGA_DEVICE, "MTL_M"),
		...

Changing PCI ID macros is something that it is not frequent.

Regards,
Mauro


More information about the igt-dev mailing list