Skip to contentSkip to conversation

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

PATCH New Mario Limonciello 1 participant 1 message Nov 18, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -2
index 5224077bbdd8..1df6796e323d 100644
@@ -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);
 }
 
Signature · 1 line
2.34.1