[PATCH] drm/amd: Fail the suspend sequence if GPU is not going to s0i3 or s3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Before commit ca47518663973 ("drm/amd: Don't allow s0ix on APUs
older than Raven") there were combinations allowed where a user could
attempt to put a device into s2idle even if the platform was misconfigured.

The idea was just skip the whole amdgpu suspend and resume sequence.  This
however doesn't work properly for dGPUs.  This is commonly triggered by
a behavior in systemd that it will first try "deep" followed by "s2idle"
if "deep" fails for any reason.

In this fail the suspend so that the system doesn't get put into a bad
state.

Link: https://github.com/systemd/systemd/issues/25151
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/3476
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2599
Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 5224077bbdd8..1df6796e323d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -2506,8 +2506,10 @@ static int amdgpu_pmops_suspend(struct device *dev)
 		adev->in_s0ix = true;
 	else if (amdgpu_acpi_is_s3_active(adev))
 		adev->in_s3 = true;
-	if (!adev->in_s0ix && !adev->in_s3)
-		return 0;
+	if (!adev->in_s0ix && !adev->in_s3) {
+		drm_warn_once(drm_dev, "Unsupported suspend state for device");
+		return -EINVAL;
+	}
 	return amdgpu_device_suspend(drm_dev, true);
 }
 
-- 
2.34.1




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux