drm/amdgpu: skip to program GFXDEC registers for suspend abort
Subsystems (2)
PATCH 1/2 drm/amdgpu: skip to program GFXDEC registers for suspend abort
In the suspend abort cases, the gfx power rail doesn't turn off so some GFXDEC registers/CSB can't reset to default value and at this moment reinitialize GFXDEC/CSB will result in an unexpected error. So let skip those program sequence for the suspend abort case.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 ++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 8 ++++++++ 3 files changed, 12 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
@@ -1079,6 +1079,8 @@ struct amdgpu_device {bool in_s3;bool in_s4;bool in_s0ix; +/* indicate amdgpu suspension status */ +bool suspend_complete;enum pp_mp1_state mp1_state;struct amdgpu_doorbell_index doorbell_index;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -0
@@ -2472,6 +2472,7 @@ static int amdgpu_pmops_suspend(struct device *dev)struct drm_device *drm_dev =dev_get_drvdata (dev);struct amdgpu_device *adev =drm_to_adev (drm_dev); + adev->suspend_complete = false;if (amdgpu_acpi_is_s0ix_active (adev)) adev->in_s0ix = true;else if (amdgpu_acpi_is_s3_active (adev))
@@ -2486,6 +2487,7 @@ static int amdgpu_pmops_suspend_noirq(struct device *dev)struct drm_device *drm_dev =dev_get_drvdata (dev);struct amdgpu_device *adev =drm_to_adev (drm_dev); + adev->suspend_complete = true;if (amdgpu_acpi_should_gpu_reset (adev))return amdgpu_asic_reset (adev);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +8 -0
@@ -3034,6 +3034,14 @@ static int gfx_v9_0_cp_gfx_start(struct amdgpu_device *adev)gfx_v9_0_cp_gfx_enable (adev, true); +/* Now only limit the quirk on the APU gfx9 series and already +* confirmed that the APU gfx10/gfx11 needn't such update. +*/ +if (adev->flags &AMD_IS_APU && + adev->in_s3 && !adev->suspend_complete) { +DRM_INFO (" Will skip the CSB packet resubmit\n" ); +return 0 ; + } r =amdgpu_ring_alloc (ring,gfx_v9_0_get_csb_size (adev) +4 +3 );if (r) {DRM_ERROR ("amdgpu: cp failed to lock ring (%d).\n" , r);
Signature · 1 line
2.34.1
PATCH 2/2 drm/amdgpu: reset gpu for s3 suspend abort case
In the s3 suspend abort case some type of gfx9 power rail not turn off from FCH side and this will put the GPU in an unknown power status, so let's reset the gpu to a known good power state before reinitialize gpu device.
--- drivers/gpu/drm/amd/amdgpu/soc15.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/gpu/drm/amd/amdgpu/soc15.c +22 -0
@@ -1298,10 +1298,32 @@ static int soc15_common_suspend(void *handle)return soc15_common_hw_fini (adev); } +static bool soc15_need_reset_on_resume (struct amdgpu_device *adev) +{ +u32 sol_reg; + + sol_reg =RREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_81); + +/* Will reset for the following suspend abort cases. +* 1) Only reset limit on APU side, dGPU hasn't checked yet. +* 2) S3 suspend abort and TOS already launched. +*/ +if (adev->flags &AMD_IS_APU && adev->in_s3 && + !adev->suspend_complete && + sol_reg) +return true; + +return false; +} +static int soc15_common_resume (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +if (soc15_need_reset_on_resume (adev)) { +dev_info (adev->dev,"S3 suspend abort case, let's reset ASIC.\n" ); +soc15_asic_reset (adev); + }return soc15_common_hw_init (adev); }
Signature · 1 line
2.34.1
RE: [PATCH 2/2] drm/amdgpu: reset gpu for s3 suspend abort case
[Public]
Quoted 8 lines
-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Thursday, February 1, 2024 3:58 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Sharma, Deepak <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: reset gpu for s3 suspend abort case
Quoted 5 lines
In the s3 suspend abort case some type of gfx9 power rail not turn off from FCH side and this will put the GPU in an unknown power status, so let's reset the gpu to a known good power state before reinitialize gpu device.
Signed-off-by Prike Liang <[email protected]>
Quoted 44 lines
--- drivers/gpu/drm/amd/amdgpu/soc15.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)drivers/gpu/drm/amd/amdgpu/soc15.c +21
-1@@ -1298,10 +1298,32 @@ static int soc15_common_suspend(void *handle)return soc15_common_hw_fini (adev); } +static bool soc15_need_reset_on_resume (struct amdgpu_device *adev) { +u32 sol_reg; + + sol_reg =RREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_81); + +/* Will reset for the following suspend abort cases. +* 1) Only reset limit on APU side, dGPU hasn't checked yet. +* 2) S3 suspend abort and TOS already launched. +*/ +if (adev->flags &AMD_IS_APU && adev->in_s3 && + !adev->suspend_complete && + sol_reg) +return true; + +return false; +} +static int soc15_common_resume (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +if (soc15_need_reset_on_resume (adev)) { + dev_info(adev->dev, "S3 suspend abort case, let's reset ASIC.\n"); +soc15_asic_reset (adev); + }return soc15_common_hw_init (adev); } --2.34.1
[AMD Official Use Only - General]
Quoted 9 lines
-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Thursday, February 1, 2024 3:58 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Sharma, Deepak <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: skip to program GFXDEC registers for suspend abort
Quoted 6 lines
In the suspend abort cases, the gfx power rail doesn't turn off so some GFXDEC registers/CSB can't reset to default value and at this moment reinitialize GFXDEC/CSB will result in an unexpected error. So let skip those program sequence for the suspend abort case.
Signed-off-by Prike Liang <[email protected]>
Quoted 65 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 ++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 8 ++++++++ 3 files changed, 12 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +2
-0@@ -1079,6 +1079,8 @@ struct amdgpu_device {bool in_s3;bool in_s4;bool in_s0ix; +/* indicate amdgpu suspension status */ +bool suspend_complete;enum pp_mp1_state mp1_state; struct amdgpu_doorbell_index doorbell_index; diff --git
a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.cb/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index475bd59c9ac2..59254144916c100644drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-0@@ -2472,6 +2472,7 @@ static int amdgpu_pmops_suspend(struct device *dev)struct drm_device *drm_dev =dev_get_drvdata (dev);struct amdgpu_device *adev =drm_to_adev (drm_dev); + adev->suspend_complete = false;if (amdgpu_acpi_is_s0ix_active (adev)) adev->in_s0ix = true;else if (amdgpu_acpi_is_s3_active(adev)) @@ -2486,6 +2487,7 @@ static int amdgpu_pmops_suspend_noirq(struct device *dev) struct drm_device *drm_dev = dev_get_drvdata(dev); struct amdgpu_device *adev = drm_to_adev(drm_dev);drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-0+ adev->suspend_complete = true;if (amdgpu_acpi_should_gpu_reset (adev))return amdgpu_asic_reset (adev);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +8
-0@@ -3034,6 +3034,14 @@ static int gfx_v9_0_cp_gfx_start(struct amdgpu_device *adev)gfx_v9_0_cp_gfx_enable (adev ,true ); +/* Now only limit the quirk on the APU gfx9 series and already +* confirmed that the APU gfx10/gfx11 needn't such update. +*/ +if (adev->flags &AMD_IS_APU && + adev->in_s3 && !adev->suspend_complete) { +DRM_INFO (" Will skip the CSB packet resubmit\n" ); +return 0 ; + } r =amdgpu_ring_alloc (ring,gfx_v9_0_get_csb_size (adev) +4 +3 );if (r) {DRM_ERROR("amdgpu: cp failed to lock ring (%d).\n", r);--
2.34.1