From 3b3f1b1c61fff5cc15f15cd62e8a7cf2e9587a9a Mon Sep 17 00:00:00 2001 From: jsg Date: Mon, 8 Jul 2024 02:08:07 +0000 Subject: [PATCH] drm/amdgpu: Fix pci state save during mode-1 reset From Lijo Lazar f16c10e05f1406576ddcb8dc598a661522959f75 in linux-6.6.y/6.6.37 74fa02c4a5ea1ade5156a6ce494d3ea83881c2d8 in mainline linux --- sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c index 2d96609911e..7e894d9a70b 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c @@ -4803,11 +4803,14 @@ int amdgpu_device_mode1_reset(struct amdgpu_device *adev) dev_info(adev->dev, "GPU mode1 reset\n"); + /* Cache the state before bus master disable. The saved config space + * values are used in other cases like restore after mode-2 reset. + */ + amdgpu_device_cache_pci_state(adev->pdev); + /* disable BM */ pci_clear_master(adev->pdev); - amdgpu_device_cache_pci_state(adev->pdev); - if (amdgpu_dpm_is_mode1_reset_supported(adev)) { dev_info(adev->dev, "GPU smu mode1 reset\n"); ret = amdgpu_dpm_mode1_reset(adev); -- 2.20.1