drm/amdgpu: Fix pci state save during mode-1 reset
authorjsg <jsg@openbsd.org>
Mon, 8 Jul 2024 02:08:07 +0000 (02:08 +0000)
committerjsg <jsg@openbsd.org>
Mon, 8 Jul 2024 02:08:07 +0000 (02:08 +0000)
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

index 2d96609..7e894d9 100644 (file)
@@ -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);