Skip to contentSkip to conversation

drm/amdgpu: cancel gfx idle work in device suspend for s0ix

PATCH In review Alex Deucher 2 participants 2 messages Apr 6, 2025 – Apr 7, 2025

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/1 drm/amdgpu: cancel gfx idle work in device suspend for s0ix

This is normally handled in the gfx IP suspend callbacks, but for S0ix, those are skipped because we don't want to touch gfx. So handle it in device suspend.

Fixes b9467983b774 ("drm/amdgpu: add dynamic workload profile switching for gfx10")
Fixes 963537ca2325 ("drm/amdgpu: add dynamic workload profile switching for gfx11")
Fixes 5f95a1549555 ("drm/amdgpu: add dynamic workload profile switching for gfx12")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 -0
index c2c2ca7922d5c..8a14caeb808dd 100644
@@ -3641,6 +3641,13 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev)
 			    adev, adev->ip_blocks[i].version->type))
 			continue;
 
+		/* Since we skip suspend for S0i3, we need to cancel the delayed
+		 * idle work here as the suspend callback never gets called.
+		 */
+		if (adev->in_s0ix &&
+		    adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GFX &&
+		    amdgpu_ip_version(adev, GC_HWIP, 0) >= IP_VERSION(10, 0, 0))
+			cancel_delayed_work_sync(&adev->gfx.idle_work);
 		/* skip suspend of gfx/mes and psp for S0ix
 		 * gfx is in gfxoff state, so on resume it will exit gfxoff just
 		 * like at runtime. PSP is also part of the always on hardware
Signature · 1 line
2.49.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Alex Deucher

This is normally handled in the gfx IP suspend callbacks, but for S0ix, those are skipped because we don't want to touch gfx. So handle it in device suspend.

Fixes b9467983b774 ("drm/amdgpu: add dynamic workload profile switching for gfx10")
Fixes 963537ca2325 ("drm/amdgpu: add dynamic workload profile switching for gfx11")
Fixes 5f95a1549555 ("drm/amdgpu: add dynamic workload profile switching for gfx12")
Quoted 22 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 -0
index c2c2ca7922d5c..8a14caeb808dd 100644
@@ -3641,6 +3641,13 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev)
  			    adev, adev->ip_blocks[i].version->type))
  			continue;
 
+		/* Since we skip suspend for S0i3, we need to cancel the delayed
+		 * idle work here as the suspend callback never gets called.
+		 */
+		if (adev->in_s0ix &&
+		    adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GFX &&
+		    amdgpu_ip_version(adev, GC_HWIP, 0) >= IP_VERSION(10, 0, 0))
+			cancel_delayed_work_sync(&adev->gfx.idle_work);
  		/* skip suspend of gfx/mes and psp for S0ix
  		 * gfx is in gfxoff state, so on resume it will exit gfxoff just
  		 * like at runtime. PSP is also part of the always on hardware