[PATCH] drm/amdgpu: only save and restore GPU device config at GPU error

Prike Liang Prike.Liang at amd.com
Thu Jul 27 09:50:03 UTC 2023


There's need a check on the GPU error state before save and restore
GPU device config space.

Signed-off-by: Prike Liang <Prike.Liang at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 358dcc1070c5..5ef3c5c49bee 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -3946,7 +3946,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 		dev_err(adev->dev, "amdgpu_pmu_init failed\n");
 
 	/* Have stored pci confspace at hand for restore in sudden PCI error */
-	if (amdgpu_device_cache_pci_state(adev->pdev))
+	if (adev->pdev->error_state != pci_channel_io_normal &&
+			amdgpu_device_cache_pci_state(adev->pdev))
 		pci_restore_state(pdev);
 
 	/* if we have > 1 VGA cards, then disable the amdgpu VGA resources */
-- 
2.34.1



More information about the amd-gfx mailing list