Commit ad51c46e authored by Chengming Gui's avatar Chengming Gui Committed by Alex Deucher
Browse files

drm/amd/amdgpu: fix PCIe dpm feature issue (v3)



use pcie_bandwidth_available to get real link state
to update pcie table.

v2: fix incorrect initialized return value
v3: expand the fetching method about the link width to all asics.

Signed-off-by: default avatarChengming Gui <Jack.Gui@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 0ab925d3
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -3625,6 +3625,7 @@ static void amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev,
	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;
@@ -3632,6 +3633,10 @@ static void amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev,
	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)