drm/amd: flush any delayed gfxoff on suspend entry
authorjsg <jsg@openbsd.org>
Thu, 24 Aug 2023 06:19:20 +0000 (06:19 +0000)
committerjsg <jsg@openbsd.org>
Thu, 24 Aug 2023 06:19:20 +0000 (06:19 +0000)
From Mario Limonciello
e1cbd5637f37e7facfd38d19cda4a36a85780613 in linux-6.1.y/6.1.47
a7b7d9e8aee4f71b4c7151702fd74237b8cef989 in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c
sys/dev/pci/drm/amd/amdgpu/amdgpu_gfx.c

index 73fa47c..8bad65c 100644 (file)
@@ -4354,6 +4354,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
                drm_fb_helper_set_suspend_unlocked(adev_to_drm(adev)->fb_helper, true);
 
        cancel_delayed_work_sync(&adev->delayed_init_work);
+       flush_delayed_work(&adev->gfx.gfx_off_delay_work);
 
        amdgpu_ras_suspend(adev);
 
index df5255c..18578db 100644 (file)
@@ -587,15 +587,8 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable)
 
                if (adev->gfx.gfx_off_req_count == 0 &&
                    !adev->gfx.gfx_off_state) {
-                       /* If going to s2idle, no need to wait */
-                       if (adev->in_s0ix) {
-                               if (!amdgpu_dpm_set_powergating_by_smu(adev,
-                                               AMD_IP_BLOCK_TYPE_GFX, true))
-                                       adev->gfx.gfx_off_state = true;
-                       } else {
-                               schedule_delayed_work(&adev->gfx.gfx_off_delay_work,
+                       schedule_delayed_work(&adev->gfx.gfx_off_delay_work,
                                              delay);
-                       }
                }
        } else {
                if (adev->gfx.gfx_off_req_count == 0) {