Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>,
	igt-dev@lists.freedesktop.org
Cc: kamil.konieczny@intel.com, katarzyna.piecielska@intel.com
Subject: Re: [PATCH i-g-t v4] tools/mk_detect_intel_gpu: add a tool to detect Intel GPUs from their PCI IDs
Date: Wed, 22 May 2024 16:26:44 +0300	[thread overview]
Message-ID: <875xv6q8ob.fsf@intel.com> (raw)
In-Reply-To: <87a5kiqa6l.fsf@intel.com>

On Wed, 22 May 2024, Jani Nikula <jani.nikula@intel.com> wrote:
> On Wed, 22 May 2024, Mauro Carvalho Chehab <mauro.chehab@linux.intel.com> wrote:
>> From: Mauro Carvalho Chehab <mchehab@kernel.org>
>>
>> Such tool parses the Kernel drivers for both i915 and Xe and
>> generates a script that helps detecting Intel GPU models.
>
> I acknowledge the usefulness of such a tool, but to be brutally honest,
> this implementation is horrible in so many levels.
>
> IGT uses meson and avoids perl.
>
> This has a makefile with perl to generate a header that's included in a
> C program that is built and executed to generate a perl script that's
> then the tool, and the generated perl script runs lspci(8).
>
> I think there's really only one reasonable way to implement this in the
> IGT context, and that's pure C, leveraging all the stuff in IGT, using
> the PCI IDs listed in the IGT repo.
>
> Or you can turn this into a separate pet project, because what you have
> here does not fit IGT.
>
> The i915_pciids.h parsing below is already stale, and you really can't
> expect to get this merged and be kept up-to-date by folks updating
> i915_pciids.h. IMO it's not maintainable.

An alternative is a pure bash or Python script to run something like:

	lspci -d 8086::0300 -nn

and annotate/filter the results based on the PCI IDs from:

	modinfo -F alias i915
	modinfo -F alias xe

You get the fancy marketing names directly from lspci, supported kernel
modules from modinfo, available on the system, with zero dependency on
PCI ID macros or names in source code.

That's like a 100 lines of script that should need virtually zero
maintenance.

Additionally, the script could match the modinfo PCI IDs against
/usr/share/misc/pci.ids (see man pci.ds) to show the marketing names.


BR,
Jani.

-- 
Jani Nikula, Intel

  reply	other threads:[~2024-05-22 13:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22 12:02 [PATCH i-g-t v4] tools/mk_detect_intel_gpu: add a tool to detect Intel GPUs from their PCI IDs Mauro Carvalho Chehab
2024-05-22 12:54 ` Jani Nikula
2024-05-22 13:26   ` Jani Nikula [this message]
2024-05-22 14:46     ` Kamil Konieczny
2024-05-23  5:03       ` Mauro Carvalho Chehab
2024-05-23  7:26         ` Jani Nikula
2024-05-23  7:30       ` Jani Nikula
2024-05-23  8:36         ` Mauro Carvalho Chehab
2024-05-23  9:10           ` Jani Nikula
2024-05-23 17:31             ` Kamil Konieczny
2024-05-24  8:49               ` Jani Nikula
2024-05-25  5:44                 ` Mauro Carvalho Chehab
2024-06-03  7:35             ` Zbigniew Kempczyński
2024-06-04  8:05               ` Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875xv6q8ob.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@intel.com \
    --cc=katarzyna.piecielska@intel.com \
    --cc=mauro.chehab@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox