Skip to content

Commit 1520bf6

Browse files
Lijo Lazargregkh
authored andcommitted
drm/amdgpu: Reset dGPU if suspend got aborted
commit 8b2be55 upstream. 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 <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Yang Wang <[email protected]> Reviewed-by: Hawking Zhang <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2708354 commit 1520bf6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

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

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

807+
static bool soc21_need_reset_on_resume(struct amdgpu_device *adev)
808+
{
809+
u32 sol_reg1, sol_reg2;
810+
811+
/* Will reset for the following suspend abort cases.
812+
* 1) Only reset dGPU side.
813+
* 2) S3 suspend got aborted and TOS is active.
814+
*/
815+
if (!(adev->flags & AMD_IS_APU) && adev->in_s3 &&
816+
!adev->suspend_complete) {
817+
sol_reg1 = RREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_81);
818+
msleep(100);
819+
sol_reg2 = RREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_81);
820+
821+
return (sol_reg1 != sol_reg2);
822+
}
823+
824+
return false;
825+
}
826+
807827
static int soc21_common_resume(void *handle)
808828
{
809829
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
810830

831+
if (soc21_need_reset_on_resume(adev)) {
832+
dev_info(adev->dev, "S3 suspend aborted, resetting...");
833+
soc21_asic_reset(adev);
834+
}
835+
811836
return soc21_common_hw_init(adev);
812837
}
813838

0 commit comments

Comments
 (0)