Hi, Commenting myself again, sorry.
On Tuesday, 27 January 2026 10:54:23 CET Janusz Krzysztofik wrote: > In a short listing, lsgpu prints a sysfs path of a PCI GPU parent as a > local attribute of a DRM device. However, if that's a discrete GPU and > its associated PCIe upstream bridge port has been identified, no > information on that bridge is listed among the GPU attributes. Follow the > pattern used with DRM devices and also show a PCI slot of the bridge port > as a local attribute of the discrete GPU device. > > Moreover, in both short and detailed listings, local attributes intended > for providing device names of GPU associated DRM devices and the GPU > codename are also printed as attributes of related PCIe upstream bridge > port, however, the DRM device names are shown as (null), and the codename > attribute provides raw vendor:device codes of the bridge itself. Replace > those with PCI slot and codename of the GPU device. > > v2: Allocate memory to local attributes of a bridge for safety (Sebastian), > - merge with a formerly separate patch "lib/igt_device_scan: Don't print > bridge not applicable attributes" (Sebastian), > - no need for DEVTYPE_BRIDGE, just skip attributes if NULL. I missed the fact that without setting dev_type of the bridge, by default classified as DEVTYPE_INTEGRATED, to e.g. DEVTYPE_BRIDGE, link bandwith attributes of the bridge, which all this series is about, are dropped from printouts. In fact, that should be addressed already in patch 3 "lib/ igt_device_scan: Include PCIe bridge upstream port if available". Let me fix it in next iteration of the series. Thanks, Janusz > > Cc: Sebastian Brzezinka <[email protected]> > Signed-off-by: Janusz Krzysztofik <[email protected]> > --- > lib/igt_device_scan.c | 19 +++++++++++++++++-- > 1 file changed, 17 insertions(+), 2 deletions(-) > > diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c > index cdd735e994..4ce64b93fe 100644 > --- a/lib/igt_device_scan.c > +++ b/lib/igt_device_scan.c > @@ -249,6 +249,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; > }; > > @@ -1060,6 +1062,10 @@ static void update_or_add_parent(struct udev *udev, > > bridge_idev = find_or_add_igt_device(udev, bridge_dev, limit_attrs); > igt_assert(bridge_idev); > + > + bridge_idev->pci_gpu = strdup(parent_idev->pci_slot_name); > + bridge_idev->codename = strdup(parent_idev->codename); > + parent_idev->parent = bridge_idev; > } > > static struct igt_device *duplicate_device(struct igt_device *dev) { > @@ -1231,6 +1237,7 @@ static void igt_device_free(struct igt_device *dev) > free(dev->device); > free(dev->driver); > free(dev->pci_slot_name); > + free(dev->pci_gpu); > igt_map_destroy(dev->attrs_map, free_key_value); > igt_map_destroy(dev->props_map, free_key_value); > } > @@ -1327,7 +1334,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->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"); > @@ -1480,8 +1491,12 @@ igt_devs_print_detail(struct igt_list_head *view, > printf("========== %s:%s ==========\n", > dev->subsystem, dev->syspath); > if (!is_drm_subsystem(dev)) { > - _print_key_value("card device", dev->drm_card); > - _print_key_value("render device", dev->drm_render); > + if (dev->drm_card) > + _print_key_value("card device", dev->drm_card); > + if (dev->drm_render) > + _print_key_value("render device", > dev->drm_render); > + if (dev->pci_gpu) > + _print_key_value("GPU device", dev->pci_gpu); > _print_key_value("codename", dev->codename); > } > >
