Hi, Before I submit patches, I'd like you to have a look at the below provided example of proposed output from a modified lsgpu tool and share your comments.
Users complain about PCIe link bandwith of their Intel discrete GPU devices limited to 2.5 GT/s x1, unable to utilize capabilities of their motherboards, see https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/10753. So far Intel has provided the following explanation: https://www.intel.com/content/www/us/en/support/articles/000094587/graphics.html That's not true. While PCI devices associated directly with Intel discrete GPUs provide fake data about link speed and width capabilities and status, their upstream PCIe bridges report correct, actual values of those link bandwidth attributes. While users may use lspci tool to examine bridge devices manually themselves, there is an idea of extending our lsgpu tool with support for printing that data. In order for the tool to show correct link bandwidth of a discrete GPU, we need to identify its PCIe upstream bridge and get that information from that bridge. For consistency with lspci output, we are not going to replace silently the fake data with those obtained from the bridge, only omit that data from our list of the GPU PCI device attributes, and complement the printout with more or less complete information about the bridge itself. Please have a look at the example output provided below and share your comments, if any. $ sudo ./build/tools/lsgpu -s sys:/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/0000:03:00.0/drm/card0 subsystem : drm drm card : /dev/dri/card0 parent : sys:/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/0000:03:00.0 sys:/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/0000:03:00.0/drm/renderD128 subsystem : drm drm render : /dev/dri/renderD128 parent : sys:/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/0000:03:00.0 sys:/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/0000:03:00.0 subsystem : pci drm card : /dev/dri/card0 drm render : /dev/dri/renderD128 vendor : 8086 device : 56A0 codename : dg2 bridge : sys:/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 sys:/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 subsystem : pci vendor : 8086 device : 4FA0 $ sudo ./build/tools/lsgpu -p ========== drm:/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/0000:03:00.0/drm/card0 ========== [properties] DEVPATH : /devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/0000:03:00.0/drm/card0 ID_PATH_TAG : pci-0000_03_00_0 CURRENT_TAGS : :seat:uaccess:master-of-seat: TAGS : :seat:uaccess:master-of-seat: MINOR : 0 DEVNAME : /dev/dri/card0 ID_PATH : pci-0000:03:00.0 SUBSYSTEM : drm DEVTYPE : drm_minor DEVLINKS : /dev/dri/by-path/pci-0000:03:00.0-card ID_FOR_SEAT : drm-pci-0000_03_00_0 USEC_INITIALIZED : 7056426 MAJOR : 226 [attributes] gt_cur_freq_mhz : 600 gt_act_freq_mhz : 0 subsystem : drm gt_max_freq_mhz : 2400 gt_RP1_freq_mhz : 600 gt_RPn_freq_mhz : 300 device : 0000:03:00.0 gt_boost_freq_mhz : 2400 gt_RP0_freq_mhz : 2400 error : No error state collected gt_min_freq_mhz : 300 dev : 226:0 ========== drm:/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/0000:03:00.0/drm/renderD128 ========== [properties] DEVPATH : /devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/0000:03:00.0/drm/renderD128 ID_PATH : pci-0000:03:00.0 MINOR : 128 DEVNAME : /dev/dri/renderD128 ID_PATH_TAG : pci-0000_03_00_0 SUBSYSTEM : drm DEVTYPE : drm_minor DEVLINKS : /dev/dri/by-path/pci-0000:03:00.0-render USEC_INITIALIZED : 7057304 MAJOR : 226 [attributes] subsystem : drm dev : 226:128 device : 0000:03:00.0 ========== pci:/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/0000:03:00.0 ========== card device : /dev/dri/card0 render device : /dev/dri/renderD128 codename : dg2 [properties] PCI_ID : 8086:56A0 DEVPATH : /devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/0000:03:00.0 ID_PCI_INTERFACE_FROM_DATABASE : VGA controller ID_PATH_TAG : pci-0000_03_00_0 PCI_CLASS : 30000 ID_PCI_CLASS_FROM_DATABASE : Display controller ID_PCI_SUBCLASS_FROM_DATABASE : VGA compatible controller PCI_SUBSYS_ID : 8086:1029 MODALIAS : pci:v00008086d000056A0sv00008086sd00001029bc03sc00i00 PCI_SLOT_NAME : 0000:03:00.0 USEC_INITIALIZED : 7056140 DRIVER : i915 ID_PATH : pci-0000:03:00.0 SUBSYSTEM : pci [attributes] consistent_dma_mask_bits : 46 power_state : D0 class : 0x030000 subsystem : pci iommu_group : 17 enable : 1 subsystem_vendor : 0x8086 reset_method : flr bus vendor : 0x8086 boot_vga : 1 resource2_resize : 0000000000007f00 subsystem_device : 0x1029 driver : i915 iommu : dmar0 d3cold_allowed : 1 local_cpulist : 0-23 ari_enabled : 1 numa_node : -1 dma_mask_bits : 46 irq : 124 driver_override : (null) device : 0x56a0 local_cpus : ffffff revision : 0x08 msi_bus : 1 broken_parity_status : 0 devspec : ========== pci:/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ========== [properties] PCI_ID : 8086:4FA0 DEVPATH : /devices/pci0000:00/0000:00:01.0/0000:01:00.0 ID_PCI_INTERFACE_FROM_DATABASE : Normal decode ID_PATH_TAG : pci-0000_01_00_0 PCI_CLASS : 60400 ID_PCI_CLASS_FROM_DATABASE : Bridge ID_PCI_SUBCLASS_FROM_DATABASE : PCI bridge PCI_SUBSYS_ID : 0000:0000 MODALIAS : pci:v00008086d00004FA0sv00000000sd00000000bc06sc04i00 PCI_SLOT_NAME : 0000:01:00.0 USEC_INITIALIZED : 7055925 DRIVER : pcieport ID_PATH : pci-0000:01:00.0 SUBSYSTEM : pci [attributes] firmware_node : device:04 irq : 16 iommu_group : 14 reset_method : bus device : 0x4fa0 d3cold_allowed : 1 broken_parity_status : 0 consistent_dma_mask_bits : 32 numa_node : -1 local_cpus : ffffff subsystem : pci iommu : dmar0 enable : 1 subsystem_vendor : 0x0000 secondary_bus_number : 2 current_link_speed : 16.0 GT/s PCIe max_link_width : 16 vendor : 0x8086 max_link_speed : 16.0 GT/s PCIe msi_bus : 1 current_link_width : 16 dma_mask_bits : 32 driver_override : (null) ari_enabled : 0 class : 0x060400 local_cpulist : 0-23 revision : 0x01 subordinate_bus_number : 4 subsystem_device : 0x0000 driver : pcieport devspec : power_state : D0 A few AER related attributes that provide error statistics in the form of hard to format lists of multiple key-values pairs each have been omitted form the printout. Thanks, Janusz
