drm/amdgpu: use pcie_bandwidth_available rather than open coding it
Subsystems (2)
PATCH 1/1 drm/amdgpu: use pcie_bandwidth_available rather than open coding it
It does the same thing we were doing already. I though it needed work for gen3/4 speeds, but that seems to be covered already.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 41 ++-------------------- 1 file changed, 2 insertions(+), 39 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -39
@@ -3650,43 +3650,6 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,return r; } -static void amdgpu_device_get_min_pci_speed_width (struct amdgpu_device *adev, -enum pci_bus_speed *speed, -enum pcie_link_width *width) -{ -struct pci_dev *pdev = adev->pdev; -enum pci_bus_speed cur_speed; -enum pcie_link_width cur_width; -u32 ret =1 ; - - *speed =PCI_SPEED_UNKNOWN ; - *width =PCIE_LNK_WIDTH_UNKNOWN ; - -while (pdev) { - cur_speed =pcie_get_speed_cap (pdev); - cur_width =pcie_get_width_cap (pdev); - ret =pcie_bandwidth_available (adev->pdev,NULL , -NULL , &cur_width); -if (!ret) - cur_width =PCIE_LNK_WIDTH_RESRV ; - -if (cur_speed !=PCI_SPEED_UNKNOWN ) { -if (*speed ==PCI_SPEED_UNKNOWN ) - *speed = cur_speed; -else if (cur_speed < *speed) - *speed = cur_speed; - } - -if (cur_width !=PCIE_LNK_WIDTH_UNKNOWN ) { -if (*width ==PCIE_LNK_WIDTH_UNKNOWN ) - *width = cur_width; -else if (cur_width < *width) - *width = cur_width; - } - pdev =pci_upstream_bridge (pdev); - } -} -/** * amdgpu_device_get_pcie_info - fence pcie info about the PCIE slot *
@@ -3720,8 +3683,8 @@ static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev)if (adev->pm.pcie_gen_mask && adev->pm.pcie_mlw_mask)return ; -amdgpu_device_get_min_pci_speed_width (adev, &platform_speed_cap, - &platform_link_width); +pcie_bandwidth_available (adev->pdev,NULL , + &platform_speed_cap, &platform_link_width);if (adev->pm.pcie_gen_mask ==0 ) {/* asic caps */
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20190411135942.22533-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org
Michel Dänzer
Acked-byQuoted 58 lines · Alex Deucher
It does the same thing we were doing already. I though it needed work for gen3/4 speeds, but that seems to be covered already.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 41 ++-------------------- 1 file changed, 2 insertions(+), 39 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-37@@ -3650,43 +3650,6 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,return r; } -static void amdgpu_device_get_min_pci_speed_width (struct amdgpu_device *adev, -enum pci_bus_speed *speed, -enum pcie_link_width *width) -{ -struct pci_dev *pdev = adev->pdev; -enum pci_bus_speed cur_speed; -enum pcie_link_width cur_width; -u32 ret =1 ; - - *speed =PCI_SPEED_UNKNOWN ; - *width =PCIE_LNK_WIDTH_UNKNOWN ; - -while (pdev) { - cur_speed =pcie_get_speed_cap (pdev); - cur_width =pcie_get_width_cap (pdev); - ret =pcie_bandwidth_available (adev->pdev,NULL , -NULL , &cur_width); -if (!ret) - cur_width =PCIE_LNK_WIDTH_RESRV ; - -if (cur_speed !=PCI_SPEED_UNKNOWN ) { -if (*speed ==PCI_SPEED_UNKNOWN ) - *speed = cur_speed; -else if (cur_speed < *speed) - *speed = cur_speed; - } - -if (cur_width !=PCIE_LNK_WIDTH_UNKNOWN ) { -if (*width ==PCIE_LNK_WIDTH_UNKNOWN ) - *width = cur_width; -else if (cur_width < *width) - *width = cur_width; - } - pdev =pci_upstream_bridge (pdev); - } -} -/** * amdgpu_device_get_pcie_info - fence pcie info about the PCIE slot *
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev) · line 3690
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-2@@ -3720,8 +3683,8 @@ static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev)if (adev->pm.pcie_gen_mask && adev->pm.pcie_mlw_mask)return ; -amdgpu_device_get_min_pci_speed_width (adev, &platform_speed_cap, - &platform_link_width); +pcie_bandwidth_available (adev->pdev,NULL , + &platform_speed_cap, &platform_link_width);if (adev->pm.pcie_gen_mask ==0 ) {/* asic caps */
Signature · 6 lines
Earthling Michel Dänzer | https://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quan, Evan
Reviewed-by Evan QuanQuoted 87 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Thursday, April 11, 2019 10:00 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu: usepcie_bandwidth_availablerather than open coding itIt does the same thing we were doing already. I though it needed work for gen3/4 speeds, but that seems to be covered already.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 41 ++-------------------- 1 file changed, 2 insertions(+), 39 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-3@@ -3650,43 +3650,6 @@ int amdgpu_device_gpu_recover(structamdgpu_device *adev, return r; } -static void amdgpu_device_get_min_pci_speed_width (struct amdgpu_device *adev, -enum pci_bus_speed *speed, - enum pcie_link_width*width)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-36-{ -struct pci_dev *pdev = adev->pdev; -enum pci_bus_speed cur_speed; -enum pcie_link_width cur_width; -u32 ret =1 ; - - *speed =PCI_SPEED_UNKNOWN ; - *width =PCIE_LNK_WIDTH_UNKNOWN ; - -while (pdev) { - cur_speed =pcie_get_speed_cap (pdev); - cur_width =pcie_get_width_cap (pdev); - ret =pcie_bandwidth_available (adev->pdev,NULL , -NULL , &cur_width); -if (!ret) - cur_width =PCIE_LNK_WIDTH_RESRV ; - -if (cur_speed !=PCI_SPEED_UNKNOWN ) { -if (*speed ==PCI_SPEED_UNKNOWN ) - *speed = cur_speed; -else if (cur_speed < *speed) - *speed = cur_speed; - } - -if (cur_width !=PCIE_LNK_WIDTH_UNKNOWN ) { -if (*width ==PCIE_LNK_WIDTH_UNKNOWN ) - *width = cur_width; -else if (cur_width < *width) - *width = cur_width; - } - pdev =pci_upstream_bridge (pdev); - } -} -/** * amdgpu_device_get_pcie_info - fence pcie info about the PCIE slot * @@ -3720,8 +3683,8 @@ static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev)if (adev->pm.pcie_gen_mask && adev->pm.pcie_mlw_mask)return ; -amdgpu_device_get_min_pci_speed_width (adev, &platform_speed_cap, - &platform_link_width); +pcie_bandwidth_available (adev->pdev,NULL , + &platform_speed_cap, &platform_link_width);drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-1if (adev->pm.pcie_gen_mask ==0 ) {/* asic caps */ --2.20.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx