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 | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++ 3 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -1079,6 +1079,7 @@ struct amdgpu_device {bool in_s3;bool in_s4;bool in_s0ix; +bool pm_complete;enum pp_mp1_state mp1_state;struct amdgpu_doorbell_index doorbell_index;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
@@ -2486,6 +2486,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 +4 -0
@@ -3034,6 +3034,10 @@ static int gfx_v9_0_cp_gfx_start(struct amdgpu_device *adev)gfx_v9_0_cp_gfx_enable (adev, true); +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_psp.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +5 -0
@@ -2935,6 +2935,11 @@ static int psp_resume(void *handle)dev_info (adev->dev,"PSP is resuming...\n" ); +if (amdgpu_asic_need_reset_on_init (adev)) { +DRM_INFO ("PM abort case and let's reset asic \n" ); +amdgpu_asic_reset (adev); + } +if (psp->mem_train_ctx.enable_mem_training) { ret =psp_mem_training (psp,PSP_MEM_TRAIN_RESUME );if (ret) {
drivers/gpu/drm/amd/amdgpu/soc15.c +6 -1
@@ -804,9 +804,15 @@ 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->pm_complete && + sol_reg) +return true; +if (!amdgpu_passthrough (adev))return false;
@@ -816,7 +822,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 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_psp.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c static int psp_resume(void *handle) · line 2942
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +5
-0@@ -2935,6 +2935,11 @@ static int psp_resume(void *handle)dev_info (adev->dev,"PSP is resuming...\n" ); +if (amdgpu_asic_need_reset_on_init (adev)) { +DRM_INFO ("PM abort case and let's reset asic \n" ); +amdgpu_asic_reset (adev); + } +
Seems like it would be better to put this in the resume callback.
drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_init(struct amdgpu_device *adev) · line 807
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0
-0if (psp->mem_train_ctx.enable_mem_training) { ret =psp_mem_training (psp,PSP_MEM_TRAIN_RESUME );if (ret) {drivers/gpu/drm/amd/amdgpu/soc15.c +1
-0@@ -804,9 +804,15 @@ 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);
Is this register consistent for all soc15 chips?
Alex
Quoted 21 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +5
-1+/* Just return false for soc15 GPUs. Reset does not seem to * be necessary. */ +if (adev->in_suspend && !adev->pm_complete && + sol_reg) +return true; +if (!amdgpu_passthrough (adev))return false;@@ -816,7 +822,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;Quoted 1 line
--
2.34.1
RE: [PATCH 2/2] drm/amdgpu: reset gpu for pm abort case
[AMD Official Use Only - General]
Hi, Alex
Quoted 30 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, January 25, 2024 12:07 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 caseQuoted 20 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_psp.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0
-0@@ -2935,6 +2935,11 @@ static int psp_resume(void *handle)dev_info (adev->dev,"PSP is resuming...\n" );
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c static int psp_resume(void *handle) · line 2942
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.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); + } +Seems like it would be better to put this in the resume callback.
[Liang, Prike] Yes, it makes sense to put the device level function call in device resume callback.
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_init(struct
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0
-0if (psp->mem_train_ctx.enable_mem_training) { ret =psp_mem_training (psp,PSP_MEM_TRAIN_RESUME );if (ret) {drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -804,9 +804,15 @@ static bool soc15_need_reset_on_init(struct
amdgpu_device*adev)
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_init(struct amdgpu_device *adev) · line 807
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +1
-0if (adev->asic_type ==CHIP_RENOIR )return true; + sol_reg =RREG32_SOC15 (MP0 ,0 , mmMP0_SMN_C2PMSG_81);Is this register consistent for all soc15 chips?
Alex
Yes, confirmed from the PSP firmware guys this register can be used for indicating the TOS/SOS live status on the SOC15 series.
Quoted 22 lines
drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_init(struct
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +5
-0+/* Just return false for soc15 GPUs. Reset does not seem to * be necessary. */ +if (adev->in_suspend && !added->microplate && + sol_reg) +return true; +if (!amdgpu_passthrough (adev))return false;@@ -816,7 +822,6 @@ static bool soc15_need_reset_on_init(struct
amdgpu_device*adev)Quoted 9 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;Quoted 1 line
--
2.34.1
Quoted 30 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 | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++ 3 files changed, 6 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -1079,6 +1079,7 @@ struct amdgpu_device {bool in_s3;bool in_s4;bool in_s0ix; +bool pm_complete;enum pp_mp1_state mp1_state;struct amdgpu_doorbell_index doorbell_index;drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_suspend_noirq(struct device *dev) · line 2489
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-0@@ -2486,6 +2486,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;
This needs to be cleared somewhere on resume.
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0if (amdgpu_acpi_should_gpu_reset (adev))return amdgpu_asic_reset (adev);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_cp_gfx_start(struct amdgpu_device *adev) · line 3040
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4
-0@@ -3034,6 +3034,10 @@ static int gfx_v9_0_cp_gfx_start(struct amdgpu_device *adev)gfx_v9_0_cp_gfx_enable (adev, true); +if (adev->in_suspend && !adev->pm_complete) { +DRM_INFO (" will skip the csb ring write\n" ); +return 0 ; + }
We probably want a similar fix for other gfx generations as well.
Alex
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-1r =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
[AMD Official Use Only - General]
Hi, Alex
Quoted 44 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, January 24, 2024 11:59 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Sharma, Deepak <[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu: skip to program GFXDEC registers for PM abort casedrivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_suspend_noirq(struct
Quoted 32 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 | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++ 3 files changed, 6 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -1079,6 +1079,7 @@ struct amdgpu_device {bool in_s3;bool in_s4;bool in_s0ix; +bool pm_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..a01f9b0c2f30100644drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0@@ -2486,6 +2486,7 @@ static int amdgpu_pmops_suspend_noirq(structdevice *dev)
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_suspend_noirq(struct device *dev) · line 2489
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-0struct drm_device *drm_dev =dev_get_drvdata (dev);struct amdgpu_device *adev =drm_to_adev (drm_dev); + adev->pm_complete = true;This needs to be cleared somewhere on resume.
[Liang, Prike] This flag is designed to indicate the amdgpu device suspension process status and will update the patch and clear it at the amdgpu suspension beginning point.
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0if (amdgpu_acpi_should_gpu_reset (adev))return amdgpu_asic_reset (adev);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0@@ -3034,6 +3034,10 @@ static int gfx_v9_0_cp_gfx_start(struct amdgpu_device *adev)gfx_v9_0_cp_gfx_enable (adev ,true );
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_cp_gfx_start(struct amdgpu_device *adev) · line 3040
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4
-0+if (adev->in_suspend && !adev->pm_complete) { +DRM_INFO (" will skip the csb ring write\n" ); +return 0 ; + }We probably want a similar fix for other gfx generations as well.
Alex
[Liang, Prike] IIRC, there's no issue on the Mendocino side even without the fix. How about keep the other gfx generations unchanged firstly and after sort out the failed case will add the quirk for each specific gfx respectively?
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0r =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
Quoted 76 lines · Prike
[AMD Official Use Only - General]
Hi, Alex
Quoted 44 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, January 24, 2024 11:59 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Sharma, Deepak <[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu: skip to program GFXDEC registers for PM abort casedrivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_suspend_noirq(struct
Quoted 32 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 | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++ 3 files changed, 6 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -1079,6 +1079,7 @@ struct amdgpu_device {bool in_s3;bool in_s4;bool in_s0ix; +bool pm_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..a01f9b0c2f30100644drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0@@ -2486,6 +2486,7 @@ static int amdgpu_pmops_suspend_noirq(structdevice *dev)
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_suspend_noirq(struct device *dev) · line 2489
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-0struct drm_device *drm_dev =dev_get_drvdata (dev);struct amdgpu_device *adev =drm_to_adev (drm_dev); + adev->pm_complete = true;This needs to be cleared somewhere on resume.
[Liang, Prike] This flag is designed to indicate the amdgpu device suspension process status and will update the patch and clear it at the amdgpu suspension beginning point.
Quoted 21 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0if (amdgpu_acpi_should_gpu_reset (adev))return amdgpu_asic_reset (adev);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_cp_gfx_start(struct · line 3041
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4
-0@@ -3034,6 +3034,10 @@ static int gfx_v9_0_cp_gfx_start(struct amdgpu_device *adev)gfx_v9_0_cp_gfx_enable (adev ,true ); +if (adev->in_suspend && !adev->pm_complete) { +DRM_INFO (" will skip the csb ring write\n" ); +return 0 ; + }We probably want a similar fix for other gfx generations as well.
Quoted 3 lines
Quoted 2 lines
Alex
[Liang, Prike] IIRC, there's no issue on the Mendocino side even without the fix. How about keep the other gfx generations unchanged firstly and after sort out the failed case will add the quirk for each specific gfx respectively?
Mendocino only supports S0i3 so we don't touch gfx on suspend/resume. This would only happen on platforms that support S3.
Alex
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0r =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
Quoted 78 lines · Alex Deucher
Quoted 76 lines · Prike
[AMD Official Use Only - General]
Hi, Alex
Quoted 44 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, January 24, 2024 11:59 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Sharma, Deepak <[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu: skip to program GFXDEC registers for PM abort casedrivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_suspend_noirq(struct
Quoted 32 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 | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++ 3 files changed, 6 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -1079,6 +1079,7 @@ struct amdgpu_device {bool in_s3;bool in_s4;bool in_s0ix; +bool pm_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..a01f9b0c2f30100644drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0@@ -2486,6 +2486,7 @@ static int amdgpu_pmops_suspend_noirq(structdevice *dev)
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_suspend_noirq(struct device *dev) · line 2489
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-0struct drm_device *drm_dev =dev_get_drvdata (dev);struct amdgpu_device *adev =drm_to_adev (drm_dev); + adev->pm_complete = true;This needs to be cleared somewhere on resume.
[Liang, Prike] This flag is designed to indicate the amdgpu device suspension process status and will update the patch and clear it at the amdgpu suspension beginning point.
Quoted 21 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0if (amdgpu_acpi_should_gpu_reset (adev))return amdgpu_asic_reset (adev);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_cp_gfx_start(struct · line 3041
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4
-0@@ -3034,6 +3034,10 @@ static int gfx_v9_0_cp_gfx_start(struct amdgpu_device *adev)gfx_v9_0_cp_gfx_enable (adev ,true ); +if (adev->in_suspend && !adev->pm_complete) { +DRM_INFO (" will skip the csb ring write\n" ); +return 0 ; + }We probably want a similar fix for other gfx generations as well.
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
Alex
[Liang, Prike] IIRC, there's no issue on the Mendocino side even without the fix. How about keep the other gfx generations unchanged firstly and after sort out the failed case will add the quirk for each specific gfx respectively?
Mendocino only supports S0i3 so we don't touch gfx on suspend/resume. This would only happen on platforms that support S3.
E.g., try an aborted suspend on Raphael or PHX2.
Alex
Quoted 11 lines
Alex
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0r =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
[AMD Official Use Only - General]
Quoted 100 lines
From: Alex Deucher <[email protected]>
Sent: Thursday, January 25, 2024 11:24 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Sharma, Deepak <[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu: skip to program GFXDEC registers for PM abort caseQuoted 2 lines · Alex Deucher
On Wed, Jan 24, 2024 at 9:39 PM Liang, Prike <[email protected]>
Quoted 15 lines · wrote:
Quoted 15 lines
[AMD Official Use Only - General]
Hi, Alex
Quoted 11 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, January 24, 2024 11:59 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Sharma, Deepak <[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu: skip to program GFXDEC registers for PM abort caseOn Wed, Jan 24, 2024 at 2:12 AM Prike Liang <[email protected]>
Quoted 34 lines · wrote:
Quoted 34 lines
Quoted 34 lines
Quoted 32 lines
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 | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++ 3 files changed, 6 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -1079,6 +1079,7 @@ struct amdgpu_device {bool in_s3;bool in_s4;bool in_s0ix; +bool pm_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..a01f9b0c2f30100644drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0@@ -2486,6 +2486,7 @@ static intQuoted 1 line
amdgpu_pmops_suspend_noirq(struct
device *dev)
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
struct drm_device *drm_dev = dev_get_drvdata(dev); struct amdgpu_device *adev = drm_to_adev(drm_dev);+
adev->pm_complete= true;This needs to be cleared somewhere on resume.
[Liang, Prike] This flag is designed to indicate the amdgpu device
suspension process status and will update the patch and clear it at the amdgpu suspension beginning point.
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 10 lines
if (amdgpu_acpi_should_gpu_reset(adev)) return amdgpu_asic_reset(adev);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_cp_gfx_start(struct · line 3041
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4
-0@@ -3034,6 +3034,10 @@ static int gfx_v9_0_cp_gfx_start(struct amdgpu_device *adev)gfx_v9_0_cp_gfx_enable (adev ,true ); +if (adev->in_suspend && !adev->pm_complete) { +DRM_INFO (" will skip the csb ring write\n" ); +return 0 ; + }We probably want a similar fix for other gfx generations as well.
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Alex
[Liang, Prike] IIRC, there's no issue on the Mendocino side even without
the fix. How about keep the other gfx generations unchanged firstly and after sort out the failed case will add the quirk for each specific gfx respectively?
Quoted 1 line
Quoted 7 lines
Quoted 2 lines
Mendocino only supports S0i3 so we don't touch gfx on suspend/resume. This would only happen on platforms that support S3.
E.g., try an aborted suspend on Raphael or PHX2.
Alex
[Liang, Prike] Thanks for the reminder, but the Mendocino also was verified on the system with S3 enabled from BIOS. I will double confirm if there need the quirk on the RPL or PHX2.
Quoted 11 lines
Quoted 11 lines
Alex
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0r =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
[AMD Official Use Only - General]
Quoted 118 lines
Sent: Friday, January 26, 2024 9:43 AM
To: Alex Deucher <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Sharma, Deepak <[email protected]>; [email protected]
Subject: RE: [PATCH 1/2] drm/amdgpu: skip to program GFXDEC registers for PM abort case[AMD Official Use Only - General]
[AMD Official Use Only - General]
Quoted 5 lines
From: Alex Deucher <[email protected]>
Sent: Thursday, January 25, 2024 11:24 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Sharma, DeepakQuoted 90 lines
Subject: Re: [PATCH 1/2] drm/amdgpu: skip to program GFXDEC registers for PM abort case
Quoted 2 lines · Alex Deucher
On Wed, Jan 24, 2024 at 9:39 PM Liang, Prike <[email protected]>
Quoted 16 lines · wrote:
Quoted 16 lines
[AMD Official Use Only - General]
Hi, Alex
Quoted 12 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, January 24, 2024 11:59 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Sharma, Deepak <[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu: skip to program GFXDEC registers for PM abort caseOn Wed, Jan 24, 2024 at 2:12 AM Prike Liang
<[email protected]>Quoted 34 lines · wrote:
Quoted 34 lines
Quoted 34 lines
Quoted 32 lines
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 | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++ 3 files changed, 6 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-1@@ -1079,6 +1079,7 @@ struct amdgpu_device {bool in_s3;bool in_s4;bool in_s0ix; +bool pm_complete;enum pp_mp1_state mp1_state;struct amdgpu_doorbell_index doorbell_index; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index475bd59c9ac2..a01f9b0c2f30100644drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0@@ -2486,6 +2486,7 @@ static intQuoted 1 line
amdgpu_pmops_suspend_noirq(struct
device *dev)
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
struct drm_device *drm_dev = dev_get_drvdata(dev); struct amdgpu_device *adev = drm_to_adev(drm_dev);+
adev->pm_complete= true;This needs to be cleared somewhere on resume.
[Liang, Prike] This flag is designed to indicate the amdgpu device
suspension process status and will update the patch and clear it at the amdgpu suspension beginning point.
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 10 lines
if (amdgpu_acpi_should_gpu_reset(adev)) return amdgpu_asic_reset(adev);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_cp_gfx_start(struct · line 3041
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4
-0@@ -3034,6 +3034,10 @@ static int gfx_v9_0_cp_gfx_start(struct amdgpu_device *adev)gfx_v9_0_cp_gfx_enable (adev ,true ); +if (adev->in_suspend && !adev->pm_complete) { +DRM_INFO (" will skip the csb ring write\n" ); +return 0 ; + }We probably want a similar fix for other gfx generations as well.
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Alex
[Liang, Prike] IIRC, there's no issue on the Mendocino side even without
the fix. How about keep the other gfx generations unchanged firstly and after sort out the failed case will add the quirk for each specific gfx
respectively?
Quoted 4 lines
Quoted 3 lines
Mendocino only supports S0i3 so we don't touch gfx on suspend/resume. This would only happen on platforms that support S3.
Quoted 8 lines
Quoted 4 lines
E.g., try an aborted suspend on Raphael or PHX2.
Alex
[Liang, Prike] Thanks for the reminder, but the Mendocino also was verified on the system with S3 enabled from BIOS. I will double confirm if there need the quirk on the RPL or PHX2.
[Prike] According to @Zhang, Jesse(Jie) and @Huang, Tim further confirm there's no such problem on the RPL and PHX, so we may only need apply this quirk on some specific gfx9 series.
Quoted 12 lines
Quoted 5 lines
Quoted 5 lines
Alex
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0r = amdgpu_ring_alloc(ring, gfx_v9_0_get_csb_size(adev) + 4 +3);
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0if (r) {DRM_ERROR("amdgpu: cp failed to lock ring
(%d).\n", r);
--
2.34.1
Quoted 123 lines · Prike
[AMD Official Use Only - General]
Quoted 120 lines
Sent: Friday, January 26, 2024 9:43 AM
To: Alex Deucher <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Sharma, Deepak <[email protected]>; [email protected]
Subject: RE: [PATCH 1/2] drm/amdgpu: skip to program GFXDEC registers for PM abort case[AMD Official Use Only - General]
[AMD Official Use Only - General]
Quoted 5 lines
From: Alex Deucher <[email protected]>
Sent: Thursday, January 25, 2024 11:24 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Sharma, DeepakQuoted 90 lines
Subject: Re: [PATCH 1/2] drm/amdgpu: skip to program GFXDEC registers for PM abort case
Quoted 2 lines · Alex Deucher
On Wed, Jan 24, 2024 at 9:39 PM Liang, Prike <[email protected]>
Quoted 16 lines · wrote:
Quoted 16 lines
[AMD Official Use Only - General]
Hi, Alex
Quoted 12 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, January 24, 2024 11:59 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Sharma, Deepak <[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu: skip to program GFXDEC registers for PM abort caseOn Wed, Jan 24, 2024 at 2:12 AM Prike Liang
<[email protected]>Quoted 34 lines · wrote:
Quoted 34 lines
Quoted 34 lines
Quoted 32 lines
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 | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++ 3 files changed, 6 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-1@@ -1079,6 +1079,7 @@ struct amdgpu_device {bool in_s3;bool in_s4;bool in_s0ix; +bool pm_complete;enum pp_mp1_state mp1_state;struct amdgpu_doorbell_index doorbell_index; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index475bd59c9ac2..a01f9b0c2f30100644drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0@@ -2486,6 +2486,7 @@ static intQuoted 1 line
amdgpu_pmops_suspend_noirq(struct
device *dev)
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
struct drm_device *drm_dev = dev_get_drvdata(dev); struct amdgpu_device *adev = drm_to_adev(drm_dev);+
adev->pm_complete= true;This needs to be cleared somewhere on resume.
[Liang, Prike] This flag is designed to indicate the amdgpu device
suspension process status and will update the patch and clear it at the amdgpu suspension beginning point.
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 10 lines
if (amdgpu_acpi_should_gpu_reset(adev)) return amdgpu_asic_reset(adev);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_cp_gfx_start(struct · line 3041
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4
-0@@ -3034,6 +3034,10 @@ static int gfx_v9_0_cp_gfx_start(struct amdgpu_device *adev)gfx_v9_0_cp_gfx_enable (adev ,true ); +if (adev->in_suspend && !adev->pm_complete) { +DRM_INFO (" will skip the csb ring write\n" ); +return 0 ; + }We probably want a similar fix for other gfx generations as well.
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Alex
[Liang, Prike] IIRC, there's no issue on the Mendocino side even without
the fix. How about keep the other gfx generations unchanged firstly and after sort out the failed case will add the quirk for each specific gfx
respectively?
Quoted 6 lines
Quoted 3 lines
Mendocino only supports S0i3 so we don't touch gfx on suspend/resume. This would only happen on platforms that support S3.
E.g., try an aborted suspend on Raphael or PHX2.
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
Alex
[Liang, Prike] Thanks for the reminder, but the Mendocino also was verified on the system with S3 enabled from BIOS. I will double confirm if there need the quirk on the RPL or PHX2.
[Prike] According to @Zhang, Jesse(Jie) and @Huang, Tim further confirm there's no such problem on the RPL and PHX, so we may only need apply this quirk on some specific gfx9 series.
Great. Thanks!
Alex
Quoted 12 lines
Quoted 12 lines
Quoted 5 lines
Quoted 5 lines
Alex
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0r = amdgpu_ring_alloc(ring, gfx_v9_0_get_csb_size(adev) + 4 +3);
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0if (r) {DRM_ERROR("amdgpu: cp failed to lock ring
(%d).\n", r);
--
2.34.1