Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	igt-dev@lists.freedesktop.org, 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: Thu, 23 May 2024 10:36:44 +0200	[thread overview]
Message-ID: <20240523103558.42876c98@maurocar-mobl2> (raw)
In-Reply-To: <87r0dtouhu.fsf@intel.com>

On Thu, 23 May 2024 10:30:37 +0300
Jani Nikula <jani.nikula@intel.com> wrote:

> On Wed, 22 May 2024, Kamil Konieczny <kamil.konieczny@linux.intel.com> wrote:
> > Looks like a good idea but this is also dependancy, btw  
> 
> [snip]
> 
> > But this one is creating one more dependancy, one should have
> > modules compiled in current running kernel.  
> 
> Reading the comments about dependencies, I think this needs a different
> perspective.
> 
> What is the target audience of the tool? What are they expected to have
> around? What is the easiest for them to install?

The target audience for the submitted changeset is to provide a way for
IGT developers to generate a script to detect the presence and the GPU
model for Device Under Test (DUT) machines.

It was written to be generic enough to use different directories for Xe
and for i915 (or the same one). So, it should work properly when different
versions of the drivers would be used, during driver's development.

On other words, the way it is, this is not focused on the end user. 

The way it works is that a C file read the i915 and Xe macros, creating
a PCI ID database, stored as hash(dict):

	my %intel_pci_id = (
		"8086:46d0" => "ADLN",
		"8086:46d1" => "ADLN",
		"8086:46d2" => "ADLN",
		...
	)
	...
	my %intel_pci_id_alt_name = (
		# AML_CFL_GT2 alternative names
		"8086:87ca" => "CFL",

		# AML_KBL_GT2 alternative names
		"8086:591c" => "KBL",
		"8086:87c0" => "KBL",
		...
	)

	Typically, most GPUs have two entries:

	$ grep 8086:9b41 ./intel_detect_gpu.pl
		"8086:9b41" => "CFL",
		"8086:9b41" => "CML_U_GT2",

	The first one is the generic name, the second one contains
	an alternate name, with has additional GPU version details
	(in this case, CML-U GT2). All of that obtained from the
	driver's source code.

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

> lspci and modinfo are trivial to install, and most people have them
> installed already. modinfo does not require the modules to be probed,
> you can also point it at the .ko under /usr/lib/modules. For a user,
> this gives information about the modules they actually have on their
> system, which may be different from kernel or igt sources.

Once generated, intel_detect_gpu.pl would be trivial to install and
to be used, as the only requirements are to have perl and pci-tools
(due to lspci dependency) installed.

> OTOH most people won't have kernel or igt sources available. (Let alone
> specific versions of the source, which match the expectations of the
> patch at hand.) Indeed, you can install igt via the distro package
> manager, with no need to check out the sources.

If IGT maintainers think it is worth targeting end users in the future,
the best is for them to periodically generate the script (for example,
when releasing a new IGT version), adding it to scripts/ and adding a
target at Meson to install it under ${installprefix}/bin directory.

Regards,
Mauro

  reply	other threads:[~2024-05-23  8:36 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
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 [this message]
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=20240523103558.42876c98@maurocar-mobl2 \
    --to=mauro.chehab@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=kamil.konieczny@intel.com \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=katarzyna.piecielska@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