Skip to content

Commit 9b608fe

Browse files
Lijo Lazaralexdeucher
authored andcommitted
drm/amdgpu: Check swus/ds for switch state save
For saving switch state, check if the GPU is having SWUS/DS architecture. Otherwise, skip saving. Reported-by: Roman Elshin <[email protected]> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4602 Fixes: 1dd2fa0 ("drm/amdgpu: Save and restore switch state") Signed-off-by: Lijo Lazar <[email protected]> Acked-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 1f086d2 commit 9b608fe

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7157,28 +7157,35 @@ void amdgpu_pci_resume(struct pci_dev *pdev)
71577157

71587158
static void amdgpu_device_cache_switch_state(struct amdgpu_device *adev)
71597159
{
7160-
struct pci_dev *parent = pci_upstream_bridge(adev->pdev);
7160+
struct pci_dev *swus, *swds;
71617161
int r;
71627162

7163-
if (!parent || parent->vendor != PCI_VENDOR_ID_ATI)
7163+
swds = pci_upstream_bridge(adev->pdev);
7164+
if (!swds || swds->vendor != PCI_VENDOR_ID_ATI ||
7165+
pci_pcie_type(swds) != PCI_EXP_TYPE_DOWNSTREAM)
7166+
return;
7167+
swus = pci_upstream_bridge(swds);
7168+
if (!swus ||
7169+
(swus->vendor != PCI_VENDOR_ID_ATI &&
7170+
swus->vendor != PCI_VENDOR_ID_AMD) ||
7171+
pci_pcie_type(swus) != PCI_EXP_TYPE_UPSTREAM)
71647172
return;
71657173

71667174
/* If already saved, return */
71677175
if (adev->pcie_reset_ctx.swus)
71687176
return;
71697177
/* Upstream bridge is ATI, assume it's SWUS/DS architecture */
7170-
r = pci_save_state(parent);
7178+
r = pci_save_state(swds);
71717179
if (r)
71727180
return;
7173-
adev->pcie_reset_ctx.swds_pcistate = pci_store_saved_state(parent);
7181+
adev->pcie_reset_ctx.swds_pcistate = pci_store_saved_state(swds);
71747182

7175-
parent = pci_upstream_bridge(parent);
7176-
r = pci_save_state(parent);
7183+
r = pci_save_state(swus);
71777184
if (r)
71787185
return;
7179-
adev->pcie_reset_ctx.swus_pcistate = pci_store_saved_state(parent);
7186+
adev->pcie_reset_ctx.swus_pcistate = pci_store_saved_state(swus);
71807187

7181-
adev->pcie_reset_ctx.swus = parent;
7188+
adev->pcie_reset_ctx.swus = swus;
71827189
}
71837190

71847191
static void amdgpu_device_load_switch_state(struct amdgpu_device *adev)

0 commit comments

Comments
 (0)