drm/amd: Use the first non-dGPU PCI device for BW limits
authorMario Limonciello <mario.limonciello@amd.com>
Fri, 10 Nov 2023 22:34:51 +0000 (16:34 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 17 Nov 2023 14:30:50 +0000 (09:30 -0500)
commit466a7d115326ece682c2b60d1c77d1d0b9010b4f
tree1f044b1dddc6b3b881b6eb79a559011da7d66346
parent8a2553d5c7ade00d1b508bbd418d5c4803c12fdd
drm/amd: Use the first non-dGPU PCI device for BW limits

When bandwidth limits are looked up using pcie_bandwidth_available()
virtual links such as USB4 are analyzed which might not represent the
real speed. Furthermore devices may change speeds autonomously which
may introduce conditional variation to the results reported in the
status registers.

Instead look at the capabilities of first PCI device outside of
dGPU to decide upper limits that the dGPU will work at.

For eGPU this effectively means that it will use the speed of the link
partner.

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2925#note_2145860
Link: https://www.usb.org/document-library/usb4r-specification-v20
      USB4 V2 with Errata and ECN through June 2023
      Section 11.2.1
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c