* [PATCH] drm/amdgpu: Adjust logic in amdgpu_device_partner_bandwidth()
@ 2024-05-16 15:05 Alex Deucher
2024-05-23 18:44 ` Alex Deucher
2024-05-24 8:04 ` Christian König
0 siblings, 2 replies; 3+ messages in thread
From: Alex Deucher @ 2024-05-16 15:05 UTC (permalink / raw)
To: amd-gfx; +Cc: Alex Deucher
Use current speed/width on devices which don't support
dynamic PCIe switching.
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3289
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index e72e774d17e6a..f0011dac589d2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -5946,13 +5946,18 @@ static void amdgpu_device_partner_bandwidth(struct amdgpu_device *adev,
*speed = PCI_SPEED_UNKNOWN;
*width = PCIE_LNK_WIDTH_UNKNOWN;
- while ((parent = pci_upstream_bridge(parent))) {
- /* skip upstream/downstream switches internal to dGPU*/
- if (parent->vendor == PCI_VENDOR_ID_ATI)
- continue;
- *speed = pcie_get_speed_cap(parent);
- *width = pcie_get_width_cap(parent);
- break;
+ if (amdgpu_device_pcie_dynamic_switching_supported(adev)) {
+ while ((parent = pci_upstream_bridge(parent))) {
+ /* skip upstream/downstream switches internal to dGPU*/
+ if (parent->vendor == PCI_VENDOR_ID_ATI)
+ continue;
+ *speed = pcie_get_speed_cap(parent);
+ *width = pcie_get_width_cap(parent);
+ break;
+ }
+ } else {
+ /* use the current speeds rather than max if switching is not supported */
+ pcie_bandwidth_available(adev->pdev, NULL, speed, width);
}
}
--
2.45.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/amdgpu: Adjust logic in amdgpu_device_partner_bandwidth()
2024-05-16 15:05 [PATCH] drm/amdgpu: Adjust logic in amdgpu_device_partner_bandwidth() Alex Deucher
@ 2024-05-23 18:44 ` Alex Deucher
2024-05-24 8:04 ` Christian König
1 sibling, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2024-05-23 18:44 UTC (permalink / raw)
To: Alex Deucher; +Cc: amd-gfx
Ping?
On Thu, May 16, 2024 at 11:42 AM Alex Deucher <alexander.deucher@amd.com> wrote:
>
> Use current speed/width on devices which don't support
> dynamic PCIe switching.
>
> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3289
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index e72e774d17e6a..f0011dac589d2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -5946,13 +5946,18 @@ static void amdgpu_device_partner_bandwidth(struct amdgpu_device *adev,
> *speed = PCI_SPEED_UNKNOWN;
> *width = PCIE_LNK_WIDTH_UNKNOWN;
>
> - while ((parent = pci_upstream_bridge(parent))) {
> - /* skip upstream/downstream switches internal to dGPU*/
> - if (parent->vendor == PCI_VENDOR_ID_ATI)
> - continue;
> - *speed = pcie_get_speed_cap(parent);
> - *width = pcie_get_width_cap(parent);
> - break;
> + if (amdgpu_device_pcie_dynamic_switching_supported(adev)) {
> + while ((parent = pci_upstream_bridge(parent))) {
> + /* skip upstream/downstream switches internal to dGPU*/
> + if (parent->vendor == PCI_VENDOR_ID_ATI)
> + continue;
> + *speed = pcie_get_speed_cap(parent);
> + *width = pcie_get_width_cap(parent);
> + break;
> + }
> + } else {
> + /* use the current speeds rather than max if switching is not supported */
> + pcie_bandwidth_available(adev->pdev, NULL, speed, width);
> }
> }
>
> --
> 2.45.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/amdgpu: Adjust logic in amdgpu_device_partner_bandwidth()
2024-05-16 15:05 [PATCH] drm/amdgpu: Adjust logic in amdgpu_device_partner_bandwidth() Alex Deucher
2024-05-23 18:44 ` Alex Deucher
@ 2024-05-24 8:04 ` Christian König
1 sibling, 0 replies; 3+ messages in thread
From: Christian König @ 2024-05-24 8:04 UTC (permalink / raw)
To: Alex Deucher, amd-gfx
Am 16.05.24 um 17:05 schrieb Alex Deucher:
> Use current speed/width on devices which don't support
> dynamic PCIe switching.
>
> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3289
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index e72e774d17e6a..f0011dac589d2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -5946,13 +5946,18 @@ static void amdgpu_device_partner_bandwidth(struct amdgpu_device *adev,
> *speed = PCI_SPEED_UNKNOWN;
> *width = PCIE_LNK_WIDTH_UNKNOWN;
>
> - while ((parent = pci_upstream_bridge(parent))) {
> - /* skip upstream/downstream switches internal to dGPU*/
> - if (parent->vendor == PCI_VENDOR_ID_ATI)
> - continue;
> - *speed = pcie_get_speed_cap(parent);
> - *width = pcie_get_width_cap(parent);
> - break;
> + if (amdgpu_device_pcie_dynamic_switching_supported(adev)) {
> + while ((parent = pci_upstream_bridge(parent))) {
> + /* skip upstream/downstream switches internal to dGPU*/
> + if (parent->vendor == PCI_VENDOR_ID_ATI)
> + continue;
> + *speed = pcie_get_speed_cap(parent);
> + *width = pcie_get_width_cap(parent);
> + break;
> + }
> + } else {
> + /* use the current speeds rather than max if switching is not supported */
> + pcie_bandwidth_available(adev->pdev, NULL, speed, width);
> }
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-24 8:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-16 15:05 [PATCH] drm/amdgpu: Adjust logic in amdgpu_device_partner_bandwidth() Alex Deucher
2024-05-23 18:44 ` Alex Deucher
2024-05-24 8:04 ` Christian König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox