From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: igt-dev@lists.freedesktop.org, Intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH i-g-t 3/5] lib/igt_device_scan: Remember PCI card index after scanning
Date: Mon, 16 Nov 2020 18:58:17 +0100 [thread overview]
Message-ID: <20201116175817.GA3946@zkempczy-mobl2> (raw)
In-Reply-To: <20201116172653.4030093-3-tvrtko.ursulin@linux.intel.com>
On Mon, Nov 16, 2020 at 05:26:51PM +0000, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> After devices are sorted post scanning, assing a card index to each so it
> can be easily accessed if PCI filter for a card needs to be printed out.
>
> v2:
> * Preserve existing pci:..card=N behaviour. (Zbigniew)
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Petri Latvala <petri.latvala@intel.com>
> Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> ---
> lib/igt_device_scan.c | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
> index c0cd6757fc27..ecb8db297f86 100644
> --- a/lib/igt_device_scan.c
> +++ b/lib/igt_device_scan.c
> @@ -166,6 +166,7 @@ struct igt_device {
> char *vendor;
> char *device;
> char *pci_slot_name;
> + int gpu_index; /* For more than one GPU with same vendor and device. */
>
> struct igt_list_head link;
> };
> @@ -601,6 +602,33 @@ static void sort_all_devices(void)
> free(devs);
> }
>
> +static void index_pci_devices(void)
> +{
> + struct igt_device *dev;
> +
> + igt_list_for_each_entry(dev, &igt_devs.all, link) {
> + struct igt_device *dev2;
> + int index = 0;
> +
> + if (!is_pci_subsystem(dev))
> + continue;
> +
> + igt_list_for_each_entry(dev2, &igt_devs.all, link) {
> + if (!is_pci_subsystem(dev2))
> + continue;
> +
> + if (dev2 == dev)
> + break;
> +
> + if (!strcasecmp(dev->vendor, dev2->vendor) &&
> + !strcasecmp(dev->device, dev2->device))
> + index++;
> + }
> +
> + dev->gpu_index = index;
> + }
> +}
> +
> /* Core scanning function.
> *
> * All scanned devices are kept inside igt_devs.all pointer array.
> @@ -657,6 +685,7 @@ static void scan_drm_devices(void)
> udev_unref(udev);
>
> sort_all_devices();
> + index_pci_devices();
>
> igt_list_for_each_entry(dev, &igt_devs.all, link) {
> struct igt_device *dev_dup = duplicate_device(dev);
> --
> 2.25.1
>
Yes, it is ok now.
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
--
Zbigniew
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-11-16 17:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-16 17:26 [Intel-gfx] [PATCH i-g-t 1/5] intel_gpu_top: User friendly device listing Tvrtko Ursulin
2020-11-16 17:26 ` [Intel-gfx] [PATCH i-g-t 2/5] lsgpu: " Tvrtko Ursulin
2020-11-16 17:26 ` [Intel-gfx] [PATCH i-g-t 3/5] lib/igt_device_scan: Remember PCI card index after scanning Tvrtko Ursulin
2020-11-16 17:58 ` Zbigniew Kempczyński [this message]
2020-11-16 17:26 ` [Intel-gfx] [PATCH i-g-t 4/5] lsgpu: Add filter type print-out selection Tvrtko Ursulin
2020-11-16 18:45 ` Zbigniew Kempczyński
2020-11-16 17:26 ` [Intel-gfx] [PATCH i-g-t 5/5] intel_gpu_top: Default GPU list to PCI mode Tvrtko Ursulin
2020-11-16 18:40 ` [Intel-gfx] [igt-dev] " Zbigniew Kempczyński
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=20201116175817.GA3946@zkempczy-mobl2 \
--to=zbigniew.kempczynski@intel.com \
--cc=Intel-gfx@lists.freedesktop.org \
--cc=igt-dev@lists.freedesktop.org \
--cc=tvrtko.ursulin@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