Skip to content

Commit 8b2be55

Browse files
Lijo Lazaralexdeucher
authored andcommitted
drm/amdgpu: Reset dGPU if suspend got aborted
For SOC21 ASICs, there is an issue in re-enabling PM features if a suspend got aborted. In such cases, reset the device during resume phase. This is a workaround till a proper solution is finalized. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Yang Wang <kevinyang.wang@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
1 parent 0f1bbcc commit 8b2be55

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

drivers/gpu/drm/amd/amdgpu/soc21.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,10 +867,35 @@ static int soc21_common_suspend(void *handle)
867867
return soc21_common_hw_fini(adev);
868868
}
869869

870+
static bool soc21_need_reset_on_resume(struct amdgpu_device *adev)
871+
{
872+
u32 sol_reg1, sol_reg2;
873+
874+
/* Will reset for the following suspend abort cases.
875+
* 1) Only reset dGPU side.
876+
* 2) S3 suspend got aborted and TOS is active.
877+
*/
878+
if (!(adev->flags & AMD_IS_APU) && adev->in_s3 &&
879+
!adev->suspend_complete) {
880+
sol_reg1 = RREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_81);
881+
msleep(100);
882+
sol_reg2 = RREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_81);
883+
884+
return (sol_reg1 != sol_reg2);
885+
}
886+
887+
return false;
888+
}
889+
870890
static int soc21_common_resume(void *handle)
871891
{
872892
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
873893

894+
if (soc21_need_reset_on_resume(adev)) {
895+
dev_info(adev->dev, "S3 suspend aborted, resetting...");
896+
soc21_asic_reset(adev);
897+
}
898+
874899
return soc21_common_hw_init(adev);
875900
}
876901

0 commit comments

Comments
 (0)