drm/amdgpu: skip to program GFXDEC registers for PM abort case
Subsystems (2)
PATCH 1/2 drm/amdgpu: skip to program GFXDEC registers for PM abort case
In the PM abort cases, the gfx power rail doesn't turn off so some GFXDEC registers/CSB can't reset to default vaule. In order to avoid unexpected problem now need skip to program GFXDEC registers and bypass issue CSB packet for PM 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 | 6 ++++++ 3 files changed, 10 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 pm_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->pm_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->pm_complete = true;if (amdgpu_acpi_should_gpu_reset (adev))return amdgpu_asic_reset (adev);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +6 -0
@@ -3034,6 +3034,12 @@ static int gfx_v9_0_cp_gfx_start(struct amdgpu_device *adev)gfx_v9_0_cp_gfx_enable (adev, true); +/* TODO: double confirm whether need to reinitialize gfxedc and submit csb packet +* on the other gfx generations for the pm suspend abort case. */ +if (adev->in_suspend && !adev->pm_complete) { +DRM_INFO (" will skip the csb ring write\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 pm abort case
In the pm abort case the gfx power rail not turn off from FCH side and this will lead to the gfx reinitialized failed base on the unknown gfx HW status, so let's reset the gpu to a known good power state.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
@@ -4627,6 +4627,11 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)return r; } +if (amdgpu_asic_need_reset_on_init (adev)) { +DRM_INFO ("PM abort case and let's reset asic \n" ); +amdgpu_asic_reset (adev); + } +if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF )return 0 ;
drivers/gpu/drm/amd/amdgpu/soc15.c +7 -1
@@ -804,9 +804,16 @@ static bool soc15_need_reset_on_init(struct amdgpu_device *adev)if (adev->asic_type ==CHIP_RENOIR )return true; + sol_reg =RREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_81); +/* Just return false for soc15 GPUs. Reset does not seem to * be necessary. */ +if (adev->in_suspend && !adev->in_s0ix && + !adev->pm_complete && + sol_reg) +return true; +if (!amdgpu_passthrough (adev))return false;
@@ -816,7 +823,6 @@ static bool soc15_need_reset_on_init(struct amdgpu_device *adev)/* Check sOS sign of life register to confirm sys driver and sOS * are already been loaded. */ - sol_reg =RREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_81);if (sol_reg)return true;
Signature · 1 line
2.34.1
Re: [PATCH 2/2] drm/amdgpu: reset gpu for pm abort case
Quoted 4 lines · Prike Liang
In the pm abort case the gfx power rail not turn off from FCH side and this will lead to the gfx reinitialized failed base on the unknown gfx HW status, so let's reset the gpu to a known good power state.
From the description, this an APU only problem (or this patch could only resolve APU abort sequence). However, there is no check for APU in the patch below.
Quoted 11 lines
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device *dev, bool fbcon) · line 4634
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5
-0@@ -4627,6 +4627,11 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)return r; } +if (amdgpu_asic_need_reset_on_init (adev)) { +DRM_INFO ("PM abort case and let's reset asic \n" ); +amdgpu_asic_reset (adev); + } +
suspend_noirq is specific for suspend scenarios and not valid for freeze/thaw. I guess this could trigger reset for successful restore on APUs.
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF )return 0 ;drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0
drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_init(struct amdgpu_device *adev) · line 811
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +2
-0@@ -804,9 +804,16 @@ static bool soc15_need_reset_on_init(struct amdgpu_device *adev)if (adev->asic_type ==CHIP_RENOIR )return true; + sol_reg =RREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_81); +/* Just return false for soc15 GPUs. Reset does not seem to * be necessary. */
The comment now doesn't make sense.
Thanks,
Lijo
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +5
-1+if (adev->in_suspend && !adev->in_s0ix && + !adev->pm_complete && + sol_reg) +return true; +if (!amdgpu_passthrough (adev))return false;@@ -816,7 +823,6 @@ static bool soc15_need_reset_on_init(struct amdgpu_device *adev)/* Check sOS sign of life register to confirm sys driver and sOS * are already been loaded. */ - sol_reg =RREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_81);if (sol_reg)return true;
RE: [PATCH 2/2] drm/amdgpu: reset gpu for pm abort case
[AMD Official Use Only - General]
Quoted 11 lines · Prike Liang
Quoted 4 lines
In the pm abort case the gfx power rail not turn off from FCH side and this will lead to the gfx reinitialized failed base on the unknown gfx HW status, so let's reset the gpu to a known good power state.
From the description, this an APU only problem (or this patch could only resolve APU abort sequence). However, there is no check for APU in the patch below.
[Prike] IIRC, there also has a similar problem on the dGPU side when suspend abort and now this patch is only drafted for a hot issue on the RV series. If need we can add a TODO item for drafting a more generic solution.
Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device
Quoted 13 lines
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -4627,6 +4627,11 @@ int amdgpu_device_resume(struct drm_device*dev, bool fbcon)
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0return r; }
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device *dev, bool fbcon) · line 4634
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5
-0+if (amdgpu_asic_need_reset_on_init (adev)) { +DRM_INFO ("PM abort case and let's reset asic \n" ); +amdgpu_asic_reset (adev); + } +
suspend_noirqis specific for suspend scenarios and not valid for freeze/thaw. I guess this could trigger reset for successful restore on APUs.
[Prike] If doesn't run into noirq_suspend then still need further check whether the PSP TOS is still alive before gpu reset.
Quoted 41 lines
drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_init(struct
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF )return 0 ;drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -804,9 +804,16 @@ static bool soc15_need_reset_on_init(struct
amdgpu_device*adev)drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_init(struct amdgpu_device *adev) · line 811
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +2
-0if (adev->asic_type ==CHIP_RENOIR )return true; + sol_reg =RREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_81); +/* Just return false for soc15 GPUs. Reset does not seem to * be necessary. */ The comment now doesn't make sense.
Thanks,
Lijodrivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_init(struct
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +5
-0+if (adev->in_suspend && !adev->in_s0ix && + !adev->pm_complete && + sol_reg) +return true; +if (!amdgpu_passthrough (adev))return false;@@ -816,7 +823,6 @@ static bool soc15_need_reset_on_init(struct
amdgpu_device*adev)Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +0
-1/* Check sOS sign of life register to confirm sys driver and sOS * are already been loaded. */ - sol_reg =RREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_81);if (sol_reg)return true;
Re: [PATCH 2/2] drm/amdgpu: reset gpu for pm abort case
Quoted 9 lines · Prike
[AMD Official Use Only - General]
Quoted 7 lines · Prike Liang
Quoted 4 lines
In the pm abort case the gfx power rail not turn off from FCH side and this will lead to the gfx reinitialized failed base on the unknown gfx HW status, so let's reset the gpu to a known good power state.
Quoted 8 lines
Quoted 4 lines
From the description, this an APU only problem (or this patch could only resolve APU abort sequence). However, there is no check for APU in the patch below.
[Prike] IIRC, there also has a similar problem on the dGPU side when suspend abort and now this patch is only drafted for a hot issue on the RV series. If need we can add a TODO item for drafting a more generic solution.
If this addresses a specific issue, then better to check the specific IP revision before presenting this as a generic one. Presently the patch logic considers this as a generic for all soc15 asics.
Quoted 23 lines
Quoted 23 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device
Quoted 13 lines
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -4627,6 +4627,11 @@ int amdgpu_device_resume(struct drm_device*dev, bool fbcon)
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5
-0return r; } +if (amdgpu_asic_need_reset_on_init (adev)) { +DRM_INFO ("PM abort case and let's reset asic \n" ); +amdgpu_asic_reset (adev); + } +
Quoted 5 lines
Quoted 3 lines
suspend_noirqis specific for suspend scenarios and not valid for freeze/thaw. I guess this could trigger reset for successful restore on APUs.[Prike] If doesn't run into
noirq_suspendthen still need further check whether the PSP TOS is still alive before gpu reset.
AFAIU, for a successful resume from hibernate on APUs, TOS will still be running. The patch will trigger a reset in such cases also.
Thanks,
Lijo
Quoted 41 lines
Quoted 41 lines
drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_init(struct
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF )return 0 ;drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -804,9 +804,16 @@ static bool soc15_need_reset_on_init(struct
amdgpu_device*adev)drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_init(struct amdgpu_device *adev) · line 811
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +2
-0if (adev->asic_type ==CHIP_RENOIR )return true; + sol_reg =RREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_81); +/* Just return false for soc15 GPUs. Reset does not seem to * be necessary. */ The comment now doesn't make sense.
Thanks,
Lijodrivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_init(struct
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +5
-0+if (adev->in_suspend && !adev->in_s0ix && + !adev->pm_complete && + sol_reg) +return true; +if (!amdgpu_passthrough (adev))return false;@@ -816,7 +823,6 @@ static bool soc15_need_reset_on_init(struct
amdgpu_device*adev)Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +0
-1/* Check sOS sign of life register to confirm sys driver and sOS * are already been loaded. */ - sol_reg =RREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_81);if (sol_reg)return true;
RE: [PATCH 2/2] drm/amdgpu: reset gpu for pm abort case
[AMD Official Use Only - General]
Quoted 27 lines
From: Lazar, Lijo <[email protected]>
Sent: Monday, January 29, 2024 2:48 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Sharma, Deepak <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: reset gpu for pm abort caseQuoted 7 lines · Prike
[AMD Official Use Only - General]
Quoted 5 lines · Prike Liang
Quoted 3 lines
In the pm abort case the gfx power rail not turn off from FCH side and this will lead to the gfx reinitialized failed base on the unknown gfx HW status, so let's reset the gpu to a known good power
state.
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
From the description, this an APU only problem (or this patch could only resolve APU abort sequence). However, there is no check for APU in the patch below.
[Prike] IIRC, there also has a similar problem on the dGPU side when suspend abort and now this patch is only drafted for a hot issue on the RV series. If need we can add a TODO item for drafting a more generic
Quoted 7 lines
solution.
Quoted 1 line
If this addresses a specific issue, then better to check the specific IP revision before presenting this as a generic one. Presently the patch logic considers this as a generic for all soc15 asics.
Before someone can further confirm whether there's a similar problem on the dGPU device side then I prefer to limit this quirk only on some specific ASIC.
Quoted 29 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-)Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -4627,6 +4627,11 @@ int amdgpu_device_resume(struct
drm_deviceQuoted 11 lines
Quoted 11 lines
*dev, bool fbcon)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device *dev, bool fbcon) · line 4634
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5
-0return r; } +if (amdgpu_asic_need_reset_on_init (adev)) { +DRM_INFO ("PM abort case and let's reset asic \n" ); +amdgpu_asic_reset (adev); + } +
suspend_noirqis specific for suspend scenarios and not valid forfreeze/thaw.
Quoted 3 lines
Quoted 2 lines
I guess this could trigger reset for successful restore on APUs.
[Prike] If doesn't run into
noirq_suspendthen still need further check
Quoted 9 lines
whether the PSP TOS is still alive before gpu reset.
Quoted 1 line
AFAIU, for a successful resume from hibernate on APUs, TOS will still be running. The patch will trigger a reset in such cases also.
Thanks,
Lijo
Yes, during the system try to restore the saved image the TOS should be running at that moment so will filter out the hibernate resume case in the later patch.
Thanks,
Prike
Quoted 41 lines
Quoted 41 lines
Quoted 41 lines
drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_init(struct
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF )return 0 ;drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -804,9 +804,16 @@ static bool soc15_need_reset_on_init(struct
amdgpu_device*adev)drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_init(struct amdgpu_device *adev) · line 811
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +2
-0if (adev->asic_type ==CHIP_RENOIR )return true; + sol_reg =RREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_81); +/* Just return false for soc15 GPUs. Reset does not seem to * be necessary. */ The comment now doesn't make sense.
Thanks,
Lijodrivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_init(struct
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +5
-0+if (adev->in_suspend && !adev->in_s0ix && + !adev->pm_complete && + sol_reg) +return true; +if (!amdgpu_passthrough (adev))return false;@@ -816,7 +823,6 @@ static bool soc15_need_reset_on_init(struct
amdgpu_device*adev)Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +0
-1/* Check sOS sign of life register to confirm sys driver and sOS * are already been loaded. */ - sol_reg =RREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_81);if (sol_reg)return true;
Re: [PATCH 2/2] drm/amdgpu: reset gpu for pm abort case
In reply to Prike LiangQuoted 16 lines · Prike Liang
In the pm abort case the gfx power rail not turn off from FCH side and this will lead to the gfx reinitialized failed base on the unknown gfx HW status, so let's reset the gpu to a known good power state.
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device *dev, bool fbcon) · line 4630
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0@@ -4627,6 +4627,11 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)return r; } +if (amdgpu_asic_need_reset_on_init (adev)) {
space between if and (.
Also, I think we need to check that we are not in S0ix as well otherwise I think we'll always reset in S0ix. We could probably do away with the GPU reset in the suspend_noirq callback with this change, but maybe make that a separate follow up patch.
Alex
Quoted 39 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4
-0+DRM_INFO ("PM abort case and let's reset asic \n" ); +amdgpu_asic_reset (adev); + } +if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF )return 0 ;drivers/gpu/drm/amd/amdgpu/soc15.c +7
-2@@ -804,9 +804,16 @@ static bool soc15_need_reset_on_init(struct amdgpu_device *adev)if (adev->asic_type ==CHIP_RENOIR )return true; + sol_reg =RREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_81); +/* Just return false for soc15 GPUs. Reset does not seem to * be necessary. */ +if (adev->in_suspend && !adev->in_s0ix && + !adev->pm_complete && + sol_reg) +return true; +if (!amdgpu_passthrough (adev))return false;@@ -816,7 +823,6 @@ static bool soc15_need_reset_on_init(struct amdgpu_device *adev)/* Check sOS sign of life register to confirm sys driver and sOS * are already been loaded. */ - sol_reg =RREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_81);if (sol_reg)return true; --2.34.1
RE: [PATCH 2/2] drm/amdgpu: reset gpu for pm abort case
[AMD Official Use Only - General]
Quoted 32 lines
From: Alex Deucher <[email protected]>
Sent: Friday, January 26, 2024 6:57 AM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Sharma, Deepak <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: reset gpu for pm abort casedrivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device
Quoted 17 lines · Prike Liang
In the pm abort case the gfx power rail not turn off from FCH side and this will lead to the gfx reinitialized failed base on the unknown gfx HW status, so let's reset the gpu to a known good power state.
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -4627,6 +4627,11 @@ int amdgpu_device_resume(struct drm_device*dev, bool fbcon)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device *dev, bool fbcon) · line 4630
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0return r; } +if (amdgpu_asic_need_reset_on_init (adev)) {
Quoted 9 lines
space between if and (.
Also, I think we need to check that we are not in S0ix as well otherwise I think we'll always reset in S0ix. We could probably do away with the GPU reset in the
suspend_noirqcallback with this change, but maybe make that a separate follow up patch.Alex
[Liang, Prike] Yes, there needn't reset GPU for the s0ix suspend abort case and s0ix suspension was already filtered out in the need_reset_on_init() at the end of this patch. Regards to reset GPU at suspend_noirq callback, there already sort out some cases that require to reset at amdgpu_acpi_should_gpu_reset() and if do the reset
at the no_irq suspend phase then will miss the first suspend abort case. IMO, we need filer out the following two cases and update the patch to be a more generic solution accordingly.
1) The PM suspend abort case which is exit PM suspension process before runs into no_irq suspend phase.
2) The PM suspend completely but the GPU doesn't power off and PSP TOS is alive at the amdgpu resume early beginning and this case happed at passthrough device suspension at Xen guest side.
Quoted 42 lines
drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_init(struct
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4
-0+DRM_INFO ("PM abort case and let's reset asic \n" ); +amdgpu_asic_reset (adev); + } +if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF )return 0 ;drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -804,9 +804,16 @@ static bool soc15_need_reset_on_init(struct
amdgpu_device*adev)drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_init(struct
Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +7
-0if (adev->asic_type ==CHIP_RENOIR )return true; + sol_reg =RREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_81); +/* Just return false for soc15 GPUs. Reset does not seem to * be necessary. */ +if (adev->in_suspend && !adev->in_s0ix && + !adev->pm_complete && + sol_reg) +return true; +if (!amdgpu_passthrough (adev))return false;@@ -816,7 +823,6 @@ static bool soc15_need_reset_on_init(struct
amdgpu_device*adev)Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +0
-2/* Check sOS sign of life register to confirm sys driver and sOS * are already been loaded. */ - sol_reg =RREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_81);if (sol_reg)return true; --2.34.1
Quoted 18 lines · Prike Liang
In the PM abort cases, the gfx power rail doesn't turn off so some GFXDEC registers/CSB can't reset to default vaule. In order to avoid unexpected problem now need skip to program GFXDEC registers and bypass issue CSB packet for PM abort case.
Signed-off-by Prike Liang <[email protected]>--- 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 | 6 ++++++ 3 files changed, 10 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_device { · line 1083
Quoted 5 lines
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 pm_complete;
Maybe rename this suspend_complete to better specify that it only applies on the suspend side.
Alex
Quoted 43 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0enum 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->pm_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->pm_complete = true;if (amdgpu_acpi_should_gpu_reset (adev))return amdgpu_asic_reset (adev);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +6
-1@@ -3034,6 +3034,12 @@ static int gfx_v9_0_cp_gfx_start(struct amdgpu_device *adev)gfx_v9_0_cp_gfx_enable (adev, true); +/* TODO: double confirm whether need to reinitialize gfxedc and submit csb packet +* on the other gfx generations for the pm suspend abort case. */ +if (adev->in_suspend && !adev->pm_complete) { +DRM_INFO (" will skip the csb ring write\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