]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Revert "drm/amd: Stop evicting resources on APUs in suspend"
authorAlex Deucher <alexander.deucher@amd.com>
Thu, 1 May 2025 17:00:16 +0000 (13:00 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 May 2025 12:12:14 +0000 (14:12 +0200)
[ Upstream commit d0ce1aaa8531a4a4707711cab5721374751c51b0 ]

This reverts commit 3a9626c816db901def438dc2513622e281186d39.

This breaks S4 because we end up setting the s3/s0ix flags
even when we are entering s4 since prepare is used by both
flows.  The causes both the S3/s0ix and s4 flags to be set
which breaks several checks in the driver which assume they
are mutually exclusive.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3634
Cc: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit ce8f7d95899c2869b47ea6ce0b3e5bf304b2fff4)
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

index 9cda2ecaf69b558102e881011fb695e29d3cc021..c5d706a4c7b4a756585c43b4093d970347c2e22a 100644 (file)
@@ -1459,11 +1459,9 @@ static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev,
 #if defined(CONFIG_ACPI) && defined(CONFIG_SUSPEND)
 bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev);
 bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev);
-void amdgpu_choose_low_power_state(struct amdgpu_device *adev);
 #else
 static inline bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) { return false; }
 static inline bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev) { return false; }
-static inline void amdgpu_choose_low_power_state(struct amdgpu_device *adev) { }
 #endif
 
 #if defined(CONFIG_DRM_AMD_DC)
index a6fd52aed91ab297728c5d991c1aebcfc84a2e3d..8b2f2b921d9de31ed8b39aa5615b71bd2a9f50c4 100644 (file)
@@ -1525,22 +1525,4 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
 #endif /* CONFIG_AMD_PMC */
 }
 
-/**
- * amdgpu_choose_low_power_state
- *
- * @adev: amdgpu_device_pointer
- *
- * Choose the target low power state for the GPU
- */
-void amdgpu_choose_low_power_state(struct amdgpu_device *adev)
-{
-       if (adev->in_runpm)
-               return;
-
-       if (amdgpu_acpi_is_s0ix_active(adev))
-               adev->in_s0ix = true;
-       else if (amdgpu_acpi_is_s3_active(adev))
-               adev->in_s3 = true;
-}
-
 #endif /* CONFIG_SUSPEND */
index 9fd9424ec8f71d1d06fcd17b6312fe6c2fa872ea..814142844197a68c35c7e15ccc0fb5087060ffc5 100644 (file)
@@ -4167,15 +4167,13 @@ int amdgpu_device_prepare(struct drm_device *dev)
        struct amdgpu_device *adev = drm_to_adev(dev);
        int i, r;
 
-       amdgpu_choose_low_power_state(adev);
-
        if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
                return 0;
 
        /* Evict the majority of BOs before starting suspend sequence */
        r = amdgpu_device_evict_resources(adev);
        if (r)
-               goto unprepare;
+               return r;
 
        flush_delayed_work(&adev->gfx.gfx_off_delay_work);
 
@@ -4186,15 +4184,10 @@ int amdgpu_device_prepare(struct drm_device *dev)
                        continue;
                r = adev->ip_blocks[i].version->funcs->prepare_suspend((void *)adev);
                if (r)
-                       goto unprepare;
+                       return r;
        }
 
        return 0;
-
-unprepare:
-       adev->in_s0ix = adev->in_s3 = adev->in_s4 = false;
-
-       return r;
 }
 
 /**