In a short listing, information about PCI parents of DRM devices, as well
as about DRM children of PCI GPU devices is now printed.  In a long
listing in turn, the latter is also printed.  Apply a similar approach to
PCIe bridge upstream ports: print information about their PCI GPU children
and also their codenames in both formats, and inform about upstream ports
of PCIe bridges found on PCI discrete GPU cards in the short format.

Signed-off-by: Janusz Krzysztofik <[email protected]>
---
 lib/igt_device_scan.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
index e86da001a9..69ea8d2eaf 100644
--- a/lib/igt_device_scan.c
+++ b/lib/igt_device_scan.c
@@ -250,6 +250,8 @@ struct igt_device {
        char *codename; /* For grouping by codename */
        enum dev_type dev_type; /* For grouping by integrated/discrete */
 
+       char *pci_gpu; /* Filled for upstream bridge ports */
+
        struct igt_list_head link;
 };
 
@@ -1058,6 +1060,9 @@ static void update_or_add_parent(struct udev *udev,
        igt_assert(bridge_idev);
 
        bridge_idev->dev_type = DEVTYPE_BRIDGE;
+       bridge_idev->pci_gpu = parent_idev->pci_slot_name;
+       bridge_idev->codename = parent_idev->codename;
+       parent_idev->parent = bridge_idev;
 }
 
 static struct igt_device *duplicate_device(struct igt_device *dev) {
@@ -1316,8 +1321,11 @@ igt_devs_print_simple(struct igt_list_head *view,
                        if (is_pci_subsystem(dev)) {
                                _pr_simple("vendor", dev->vendor);
                                _pr_simple("device", dev->device);
-                               if (dev->dev_type != DEVTYPE_BRIDGE)
-                                       _pr_simple("codename", dev->codename);
+                               if (dev->pci_gpu)
+                                       _pr_simple("GPU device", dev->pci_gpu);
+                               _pr_simple("codename", dev->codename);
+                               if (dev->parent && dev->parent->pci_slot_name)
+                                       _pr_simple("upstream port", 
dev->parent->pci_slot_name);
                        }
                }
                printf("\n");
@@ -1469,9 +1477,13 @@ igt_devs_print_detail(struct igt_list_head *view,
        igt_list_for_each_entry(dev, view, link) {
                printf("========== %s:%s ==========\n",
                       dev->subsystem, dev->syspath);
-               if (!is_drm_subsystem(dev) && dev->dev_type != DEVTYPE_BRIDGE) {
-                       _print_key_value("card device", dev->drm_card);
-                       _print_key_value("render device", dev->drm_render);
+               if (!is_drm_subsystem(dev)) {
+                       if (dev->dev_type != DEVTYPE_BRIDGE) {
+                               _print_key_value("card device", dev->drm_card);
+                               _print_key_value("render device", 
dev->drm_render);
+                       } else {
+                               _print_key_value("GPU device", dev->pci_gpu);
+                       }
                        _print_key_value("codename", dev->codename);
                }
 
-- 
2.52.0

Reply via email to