Skip to contentSkip to conversation

drm/amdgpu/isp: don't fail suspend/resume when hw callbacks are absent

PATCH In review Jiqian Chen 2 participants 2 messages Sep 10 – Sep 14

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

PATCH 1/1 drm/amdgpu/isp: don't fail suspend/resume when hw callbacks are absent

isp_suspend() and isp_resume() return -ENODEV when the ISP version does not implement the optional hw_suspend()/hw_resume() callbacks. Only isp_v4_1_1_funcs provides them, isp_v4_1_0_funcs defines just hw_init and hw_fini, so on ISP v4.1.0 both callbacks are NULL and every system suspend and resume fails.

amdgpu_ip_block_suspend() and amdgpu_ip_block_resume() treat an error returned by the IP block as fatal, so this aborts the whole amdgpu suspend/resume, for example:

amdgpu 0000:c5:00.0: amdgpu: resume of IP block <isp_ip> failed -19

Because amdgpu_ip_block_resume() bails out before updating the state, ip_block->status.hw is left stale and the GPU is only partially resumed, which also breaks subsequent suspend cycles.

An absent callback means there is nothing to do, not an error. This is how the IP block core itself treats a NULL amd_ip_funcs entry, it skips the call and reports success. Return 0 in that case so ISP versions without suspend/resume callbacks no longer break device suspend/resume.

Fixes 7ed51e3a1381 ("drm/amd/amdgpu: Fix SMU warning during isp suspend-resume")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +2 -2
index 976b65f90bc1..ad667b9fde84 100644
@@ -321,7 +321,7 @@ static int isp_resume(struct amdgpu_ip_block *ip_block)
 	if (isp->funcs->hw_resume)
 		return isp->funcs->hw_resume(isp);
 
-	return -ENODEV;
+	return 0;
 }
 
 static int isp_suspend(struct amdgpu_ip_block *ip_block)
@@ -332,7 +332,7 @@ static int isp_suspend(struct amdgpu_ip_block *ip_block)
 	if (isp->funcs->hw_suspend)
 		return isp->funcs->hw_suspend(isp);
 
-	return -ENODEV;
+	return 0;
 }
 
 static const struct amd_ip_funcs isp_ip_funcs = {
Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Jiqian Chen

isp_suspend() and isp_resume() return -ENODEV when the ISP version does not implement the optional hw_suspend()/hw_resume() callbacks. Only isp_v4_1_1_funcs provides them, isp_v4_1_0_funcs defines just hw_init and hw_fini, so on ISP v4.1.0 both callbacks are NULL and every system suspend and resume fails.

amdgpu_ip_block_suspend() and amdgpu_ip_block_resume() treat an error returned by the IP block as fatal, so this aborts the whole amdgpu suspend/resume, for example:

amdgpu 0000:c5:00.0: amdgpu: resume of IP block <isp_ip> failed -19

Because amdgpu_ip_block_resume() bails out before updating the state, ip_block->status.hw is left stale and the GPU is only partially resumed, which also breaks subsequent suspend cycles.

Quoted 7 lines

An absent callback means there is nothing to do, not an error. This is how the IP block core itself treats a NULL amd_ip_funcs entry, it skips the call and reports success. Return 0 in that case so ISP versions without suspend/resume callbacks no longer break device suspend/resume.

Fixes 7ed51e3a1381 ("drm/amd/amdgpu: Fix SMU warning during isp suspend-resume")
Quoted 26 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +2 -2
index 976b65f90bc1..ad667b9fde84 100644
@@ -321,7 +321,7 @@ static int isp_resume(struct amdgpu_ip_block *ip_block)
 	if (isp->funcs->hw_resume)
 		return isp->funcs->hw_resume(isp);
 
-	return -ENODEV;
+	return 0;
 }
 
 static int isp_suspend(struct amdgpu_ip_block *ip_block)
@@ -332,7 +332,7 @@ static int isp_suspend(struct amdgpu_ip_block *ip_block)
 	if (isp->funcs->hw_suspend)
 		return isp->funcs->hw_suspend(isp);
 
-	return -ENODEV;
+	return 0;
 }
 
 static const struct amd_ip_funcs isp_ip_funcs = {