]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/display: Stop storing failures into adev->dm.cached_state
authorMario Limonciello <mario.limonciello@amd.com>
Mon, 2 Jun 2025 01:44:31 +0000 (20:44 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 18 Jun 2025 16:19:18 +0000 (12:19 -0400)
If drm_atomic_helper_suspend() has failed for any reason, it's stored
in adev->dm.cached_state.  This isn't expected because the resume
(or complete()) sequence will attempt to use the stored state to
resume.

Reviewed-by: Alex Hung <alex.hung@amd.com>
Link: https://lore.kernel.org/r/20250602014432.3538345-3-superm1@kernel.org
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 19d38357f508eaa6844907bfade9f0bc54b0f9ee..922ad64df8616327c7a7d206074319c4e2db87da 100644 (file)
@@ -3063,6 +3063,19 @@ static void hpd_rx_irq_work_suspend(struct amdgpu_display_manager *dm)
        }
 }
 
+static int dm_cache_state(struct amdgpu_device *adev)
+{
+       int r;
+
+       adev->dm.cached_state = drm_atomic_helper_suspend(adev_to_drm(adev));
+       if (IS_ERR(adev->dm.cached_state)) {
+               r = PTR_ERR(adev->dm.cached_state);
+               adev->dm.cached_state = NULL;
+       }
+
+       return adev->dm.cached_state ? 0 : r;
+}
+
 static int dm_prepare_suspend(struct amdgpu_ip_block *ip_block)
 {
        struct amdgpu_device *adev = ip_block->adev;
@@ -3071,11 +3084,8 @@ static int dm_prepare_suspend(struct amdgpu_ip_block *ip_block)
                return 0;
 
        WARN_ON(adev->dm.cached_state);
-       adev->dm.cached_state = drm_atomic_helper_suspend(adev_to_drm(adev));
-       if (IS_ERR(adev->dm.cached_state))
-               return PTR_ERR(adev->dm.cached_state);
 
-       return 0;
+       return dm_cache_state(adev);
 }
 
 static int dm_suspend(struct amdgpu_ip_block *ip_block)
@@ -3109,9 +3119,10 @@ static int dm_suspend(struct amdgpu_ip_block *ip_block)
        }
 
        if (!adev->dm.cached_state) {
-               adev->dm.cached_state = drm_atomic_helper_suspend(adev_to_drm(adev));
-               if (IS_ERR(adev->dm.cached_state))
-                       return PTR_ERR(adev->dm.cached_state);
+               int r = dm_cache_state(adev);
+
+               if (r)
+                       return r;
        }
 
        s3_handle_hdmi_cec(adev_to_drm(adev), true);