drm/amdgpu: correct the S3 abort check condition
Subsystems (2)
PATCH v2 1/2 drm/amdgpu: correct the S3 abort check condition
In the normal S3 entry, the TOS cycle counter is not reset during BIOS execution the _S3 method, so it doesn't determine whether the _S3 method is executed exactly. Howerver, the PM core performs the S3 suspend will set the PM_SUSPEND_FLAG_FW_RESUME bit if all the devices suspend successfully. Therefore, drivers can check the pm_suspend_global_flags bit(1) to detect the S3 suspend abort event.
for aborting from deeper suspend")
--- drivers/gpu/drm/amd/amdgpu/soc15.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc15.c +13 -10
@@ -578,16 +578,13 @@ soc15_asic_reset_method(struct amdgpu_device *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. +* 1) Only reset on APU side, dGPU hasn't checked yet. +* 2) S3 suspend aborted in the normal S3 suspend or +* performing pm core test. */ if (adev->flags &AMD_IS_APU && adev->in_s3 && - sol_reg) { + !pm_resume_via_firmware ()) { adev->suspend_complete = false;return true; }else {
@@ -603,11 +600,17 @@ static int soc15_asic_reset(struct amdgpu_device *adev)* successfully. So now, temporarily enable it for the * S3 suspend abort case. */ -if (((adev->apu_flags &AMD_APU_IS_RAVEN ) || - (adev->apu_flags &AMD_APU_IS_RAVEN2 )) && - !soc15_need_reset_on_resume (adev)) + +if ((adev->apu_flags &AMD_APU_IS_PICASSO || + !(adev->apu_flags &AMD_APU_IS_RAVEN )) && +soc15_need_reset_on_resume (adev)) + goto asic_reset; + +if ((adev->apu_flags &AMD_APU_IS_RAVEN ) || + (adev->apu_flags &AMD_APU_IS_RAVEN2 ))return 0 ; +asic_reset:switch (soc15_asic_reset_method (adev)) {case AMD_RESET_METHOD_PCI :dev_info (adev->dev,"PCI reset\n" );
Signature · 1 line
2.34.1
PATCH v2 2/2 drm/amdgpu: clean up the suspend_complete
To check the status of S3 suspend completion, use the PM core pm_suspend_global_flags bit(1) to detect S3 abort events. Therefore, clean up the AMDGPU driver's private flag suspend_complete.
--- 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 | 4 ++-- drivers/gpu/drm/amd/amdgpu/soc15.c | 7 ++----- drivers/gpu/drm/amd/amdgpu/soc21.c | 2 +- 5 files changed, 5 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -2
@@ -1111,8 +1111,6 @@ 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 +0 -2
@@ -2501,7 +2501,6 @@ 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))
@@ -2516,7 +2515,6 @@ 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 +2 -2
@@ -3276,8 +3276,8 @@ static int gfx_v9_0_cp_gfx_start(struct amdgpu_device *adev)* 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" ); + adev->in_s3 && !pm_resume_via_firmware ()) { +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 );
drivers/gpu/drm/amd/amdgpu/soc15.c +2 -5
@@ -584,13 +584,10 @@ static bool soc15_need_reset_on_resume(struct amdgpu_device *adev)* performing pm core test. */ if (adev->flags &AMD_IS_APU && adev->in_s3 && - !pm_resume_via_firmware ()) { - adev->suspend_complete = false; + !pm_resume_via_firmware ())return true; - }else { - adev->suspend_complete = true; +else return false; - } }static int soc15_asic_reset (struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/soc21.c +1 -1
@@ -904,7 +904,7 @@ static bool soc21_need_reset_on_resume(struct amdgpu_device *adev)* 2) S3 suspend got aborted and TOS is active. */ if (!(adev->flags &AMD_IS_APU ) && adev->in_s3 && - !adev->suspend_complete) { + !pm_resume_via_firmware ()) { sol_reg1 =RREG32_SOC15 (MP0 ,0 , regMP0_SMN_C2PMSG_81);msleep (100 ); sol_reg2 =RREG32_SOC15 (MP0 ,0 , regMP0_SMN_C2PMSG_81);
Signature · 1 line
2.34.1
RE: [PATCH v2 2/2] drm/amdgpu: clean up the suspend_complete
[AMD Official Use Only - AMD Internal Distribution Only]
Ping on this series.
Thanks,
Prike
Quoted 110 lines
-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Monday, October 14, 2024 3:49 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Lazar, Lijo <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH v2 2/2] drm/amdgpu: clean up thesuspend_completeTo check the status of S3 suspend completion, use the PM core
pm_suspend_global_flagsbit(1) to detect S3 abort events. Therefore, clean up the AMDGPU driver's private flagsuspend_complete.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 | 4 ++-- drivers/gpu/drm/amd/amdgpu/soc15.c | 7 ++----- drivers/gpu/drm/amd/amdgpu/soc21.c | 2 +- 5 files changed, 5 insertions(+), 12 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-2@@ -1111,8 +1111,6 @@ 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
index680e44fdee6e..78972151b970100644drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-1@@ -2501,7 +2501,6 @@ 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)) @@ -2516,7 +2515,6 @@ staticint
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 +0
-1- 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 +2
-2@@ -3276,8 +3276,8 @@ static int gfx_v9_0_cp_gfx_start(struct amdgpu_device*adev) * 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" ); + adev->in_s3 && !pm_resume_via_firmware ()) { +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); diff --git
a/drivers/gpu/drm/amd/amdgpu/soc15.cb/drivers/gpu/drm/amd/amdgpu/soc15.cindex12ff6cf568dc..d9d11131a744100644drivers/gpu/drm/amd/amdgpu/soc15.c +2
-5@@ -584,13 +584,10 @@ static bool soc15_need_reset_on_resume(structamdgpu_device *adev) * performing pm core test. */ if (adev->flags &AMD_IS_APU && adev->in_s3 && - !pm_resume_via_firmware ()) { - adev->suspend_complete = false; + !pm_resume_via_firmware ())return true; - }else { - adev->suspend_complete = true; +else return false; - } }static int
soc15_asic_reset(struct amdgpu_device *adev)diff --gita/drivers/gpu/drm/amd/amdgpu/soc21.cb/drivers/gpu/drm/amd/amdgpu/soc21.cindexc4b950e75133..7a47a21ef00f100644drivers/gpu/drm/amd/amdgpu/soc21.c +1
-1@@ -904,7 +904,7 @@ static bool soc21_need_reset_on_resume(structamdgpu_device *adev) * 2) S3 suspend got aborted and TOS is active. */ if (!(adev->flags &AMD_IS_APU ) && adev->in_s3 && - !adev->suspend_complete) { + !pm_resume_via_firmware ()) { sol_reg1 =RREG32_SOC15 (MP0 ,0 , regMP0_SMN_C2PMSG_81);msleep (100 );sol_reg2 = RREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_81);--
2.34.1
Re: [PATCH v2 2/2] drm/amdgpu: clean up the suspend_complete
In reply to Prike LiangQuoted 87 lines · Prike Liang
To check the status of S3 suspend completion, use the PM core
pm_suspend_global_flagsbit(1) to detect S3 abort events. Therefore, clean up the AMDGPU driver's private flagsuspend_complete.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 | 4 ++-- drivers/gpu/drm/amd/amdgpu/soc15.c | 7 ++----- drivers/gpu/drm/amd/amdgpu/soc21.c | 2 +- 5 files changed, 5 insertions(+), 12 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-2@@ -1111,8 +1111,6 @@ 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 +0
-2@@ -2501,7 +2501,6 @@ 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))@@ -2516,7 +2515,6 @@ 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 +2
-2@@ -3276,8 +3276,8 @@ static int gfx_v9_0_cp_gfx_start(struct amdgpu_device *adev)* 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" ); + adev->in_s3 && !pm_resume_via_firmware ()) { +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 );drivers/gpu/drm/amd/amdgpu/soc15.c +2
-5@@ -584,13 +584,10 @@ static bool soc15_need_reset_on_resume(struct amdgpu_device *adev)* performing pm core test. */ if (adev->flags &AMD_IS_APU && adev->in_s3 && - !pm_resume_via_firmware ()) { - adev->suspend_complete = false; + !pm_resume_via_firmware ())return true; - }else { - adev->suspend_complete = true; +else return false; - } }static int soc15_asic_reset (struct amdgpu_device *adev)drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0
drivers/gpu/drm/amd/amdgpu/soc21.c static bool soc21_need_reset_on_resume(struct amdgpu_device *adev) · line 907
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +1
-1@@ -904,7 +904,7 @@ static bool soc21_need_reset_on_resume(struct amdgpu_device *adev)* 2) S3 suspend got aborted and TOS is active. */ if (!(adev->flags &AMD_IS_APU ) && adev->in_s3 && - !adev->suspend_complete) { + !pm_resume_via_firmware ()) {
Looks like this will cover only ACPI based systems. Not sure if that assumption is valid for dGPU cases.
Thanks,
Lijo
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0sol_reg1 =RREG32_SOC15 (MP0 ,0 , regMP0_SMN_C2PMSG_81);msleep (100 ); sol_reg2 =RREG32_SOC15 (MP0 ,0 , regMP0_SMN_C2PMSG_81);
RE: [PATCH v2 2/2] drm/amdgpu: clean up the suspend_complete
[Public]
Quoted 109 lines
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, October 23, 2024 6:55 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH v2 2/2] drm/amdgpu: clean up thesuspend_completedrivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_cp_gfx_start(struct amdgpu_device
Quoted 54 lines · Prike Liang
To check the status of S3 suspend completion, use the PM core
pm_suspend_global_flagsbit(1) to detect S3 abort events. Therefore, clean up the AMDGPU driver's private flagsuspend_complete.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 | 4 ++-- drivers/gpu/drm/amd/amdgpu/soc15.c | 7 ++----- drivers/gpu/drm/amd/amdgpu/soc21.c | 2 +- 5 files changed, 5 insertions(+), 12 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-2@@ -1111,8 +1111,6 @@ 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
index680e44fdee6e..78972151b970100644drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-1@@ -2501,7 +2501,6 @@ 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)) @@ -2516,7 +2515,6 @@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 +0
-1- 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 +0
-0@@ -3276,8 +3276,8 @@ static int gfx_v9_0_cp_gfx_start(struct amdgpu_device*adev)
drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_resume(struct
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2
-2* 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" ); + adev->in_s3 && !pm_resume_via_firmware ()) { +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 );drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -584,13 +584,10 @@ static bool soc15_need_reset_on_resume(struct
amdgpu_device*adev)drivers/gpu/drm/amd/amdgpu/soc21.c static bool soc21_need_reset_on_resume(struct
Quoted 21 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +2
-5* performing pm core test. */ if (adev->flags &AMD_IS_APU && adev->in_s3 && - !pm_resume_via_firmware ()) { - adev->suspend_complete = false; + !pm_resume_via_firmware ())return true; - }else { - adev->suspend_complete = true; +else return false; - } } static int soc15_asic_reset(struct amdgpu_device *adev) diff --git
a/drivers/gpu/drm/amd/amdgpu/soc21.cb/drivers/gpu/drm/amd/amdgpu/soc21.c
indexc4b950e75133..7a47a21ef00f100644drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0@@ -904,7 +904,7 @@ static bool soc21_need_reset_on_resume(struct
amdgpu_device*adev)drivers/gpu/drm/amd/amdgpu/soc21.c static bool soc21_need_reset_on_resume(struct amdgpu_device *adev) · line 907
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +1
-1* 2) S3 suspend got aborted and TOS is active. */ if (!(adev->flags &AMD_IS_APU ) && adev->in_s3 && - !adev->suspend_complete) { + !pm_resume_via_firmware ()) {
Quoted 5 lines
Looks like this will cover only ACPI based systems. Not sure if that assumption is valid for dGPU cases.
Thanks,
Lijo
Yes, the pm_set_resume_via_firmware() function is only called during the ACPI_STATE_S3 suspend process. However, ACPI-enabled systems are popular in the desktop world. If there are concerns about ACPI configuration, one option could be to check if the dGPU needs a reset by directly checking the SOL register. As far as I can see, when the dGPU completes its suspend process, the SOL value will remain zero until the dGPU is resumed. Conversely, in the case of a suspend abort, the SOL value will be non-zero.
Thanks,
Prike
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0sol_reg1 =RREG32_SOC15 (MP0 ,0 , regMP0_SMN_C2PMSG_81);msleep (100 ); sol_reg2 =RREG32_SOC15 (MP0 ,0 , regMP0_SMN_C2PMSG_81);
Re: [PATCH v2 2/2] drm/amdgpu: clean up the suspend_complete
Quoted 111 lines · Prike
[Public]
Quoted 109 lines
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, October 23, 2024 6:55 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH v2 2/2] drm/amdgpu: clean up thesuspend_completedrivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_cp_gfx_start(struct amdgpu_device
Quoted 54 lines · Prike Liang
To check the status of S3 suspend completion, use the PM core
pm_suspend_global_flagsbit(1) to detect S3 abort events. Therefore, clean up the AMDGPU driver's private flagsuspend_complete.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 | 4 ++-- drivers/gpu/drm/amd/amdgpu/soc15.c | 7 ++----- drivers/gpu/drm/amd/amdgpu/soc21.c | 2 +- 5 files changed, 5 insertions(+), 12 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-2@@ -1111,8 +1111,6 @@ 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
index680e44fdee6e..78972151b970100644drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-1@@ -2501,7 +2501,6 @@ 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)) @@ -2516,7 +2515,6 @@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 +0
-1- 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 +0
-0@@ -3276,8 +3276,8 @@ static int gfx_v9_0_cp_gfx_start(struct amdgpu_device*adev)
drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_resume(struct
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2
-2* 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" ); + adev->in_s3 && !pm_resume_via_firmware ()) { +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 );drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -584,13 +584,10 @@ static bool soc15_need_reset_on_resume(struct
amdgpu_device*adev)drivers/gpu/drm/amd/amdgpu/soc21.c static bool soc21_need_reset_on_resume(struct
Quoted 21 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +2
-5* performing pm core test. */ if (adev->flags &AMD_IS_APU && adev->in_s3 && - !pm_resume_via_firmware ()) { - adev->suspend_complete = false; + !pm_resume_via_firmware ())return true; - }else { - adev->suspend_complete = true; +else return false; - } } static int soc15_asic_reset(struct amdgpu_device *adev) diff --git
a/drivers/gpu/drm/amd/amdgpu/soc21.cb/drivers/gpu/drm/amd/amdgpu/soc21.c
indexc4b950e75133..7a47a21ef00f100644drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0@@ -904,7 +904,7 @@ static bool soc21_need_reset_on_resume(struct
amdgpu_device*adev)Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +1
-1* 2) S3 suspend got aborted and TOS is active. */ if (!(adev->flags &AMD_IS_APU ) && adev->in_s3 && - !adev->suspend_complete) { + !pm_resume_via_firmware ()) {
Quoted 8 lines
Quoted 5 lines
Looks like this will cover only ACPI based systems. Not sure if that assumption is valid for dGPU cases.
Thanks,
LijoYes, the
pm_set_resume_via_firmware()function is only called during theACPI_STATE_S3suspend process. However, ACPI-enabled systems are popular in the desktop world. If there are concerns about ACPI configuration, one option could be to check if the dGPU needs a reset by directly checking the SOL register. As far as I can see, when the dGPU completes its suspend process, the SOL value will remain zero until the dGPU is resumed. Conversely, in the case of a suspend abort, the SOL value will be non-zero.
in_s3 is set for dGPU in case of s0ix as well. Probably, that's the only case where need the flag to avoid unnecessary reset. Otherwise SOL check could be sufficient.
Thanks,
Lijo
Quoted 6 lines
Thanks,
PrikeQuoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0sol_reg1 =RREG32_SOC15 (MP0 ,0 , regMP0_SMN_C2PMSG_81);msleep (100 ); sol_reg2 =RREG32_SOC15 (MP0 ,0 , regMP0_SMN_C2PMSG_81);
RE: [PATCH v2 2/2] drm/amdgpu: clean up the suspend_complete
[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 137 lines
From: Lazar, Lijo <[email protected]>
Sent: Thursday, October 24, 2024 11:39 AM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH v2 2/2] drm/amdgpu: clean up thesuspend_completeQuoted 36 lines · Prike
[Public]
Quoted 34 lines
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, October 23, 2024 6:55 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH v2 2/2] drm/amdgpu: clean up thesuspend_completeQuoted 25 lines · Prike Liang
To check the status of S3 suspend completion, use the PM core
pm_suspend_global_flagsbit(1) to detect S3 abort events. Therefore, clean up the AMDGPU driver's private flagsuspend_complete.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 | 4 ++-- drivers/gpu/drm/amd/amdgpu/soc15.c | 7 ++----- drivers/gpu/drm/amd/amdgpu/soc21.c | 2 +- 5 files changed, 5 insertions(+), 12 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-2@@ -1111,8 +1111,6 @@ struct amdgpu_device {bool in_s3;bool in_s4;bool in_s0ix; -/* indicate amdgpu suspension status */ -bool suspend_complete;Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_suspend(struct device
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0enum 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
index680e44fdee6e..78972151b970100644drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0@@ -2501,7 +2501,6 @@ static int amdgpu_pmops_suspend(struct device*dev)
Quoted 68 lines
Quoted 68 lines
Quoted 21 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-1struct 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)) @@ -2516,7 +2515,6 @@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 +0
-1- 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 +0
-0@@ -3276,8 +3276,8 @@ static int gfx_v9_0_cp_gfx_start(structQuoted 1 line
amdgpu_device*adev)
drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_resume(struct
Quoted 16 lines
* confirmed that the APU gfx10/gfx11 needn't such update. */ if (adev->flags & AMD_IS_APU &&drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2
-2- adev->in_s3 && !adev->suspend_complete) { -DRM_INFO (" Will skip the CSB packet resubmit\n" ); + adev->in_s3 && !pm_resume_via_firmware()) { +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); diff --git
a/drivers/gpu/drm/amd/amdgpu/soc15.cb/drivers/gpu/drm/amd/amdgpu/soc15.c
index12ff6cf568dc..d9d11131a744100644drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -584,13 +584,10 @@ static bool soc15_need_reset_on_resume(struct
amdgpu_device*adev)drivers/gpu/drm/amd/amdgpu/soc21.c static bool soc21_need_reset_on_resume(struct
Quoted 21 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +2
-5* performing pm core test. */ if (adev->flags &AMD_IS_APU && adev->in_s3 && - !pm_resume_via_firmware ()) { - adev->suspend_complete = false; + !pm_resume_via_firmware ())return true; - }else { - adev->suspend_complete = true; +else return false; - } } static int soc15_asic_reset(struct amdgpu_device *adev) diff --git
a/drivers/gpu/drm/amd/amdgpu/soc21.cb/drivers/gpu/drm/amd/amdgpu/soc21.c
indexc4b950e75133..7a47a21ef00f100644drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0@@ -904,7 +904,7 @@ static bool soc21_need_reset_on_resume(struct
amdgpu_device*adev)Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +1
-1* 2) S3 suspend got aborted and TOS is active. */ if (!(adev->flags &AMD_IS_APU ) && adev->in_s3 && - !adev->suspend_complete) { + !pm_resume_via_firmware ()) {Quoted 7 lines
Quoted 5 lines
Looks like this will cover only ACPI based systems. Not sure if that assumption is valid for dGPU cases.
Thanks,
LijoYes, the
pm_set_resume_via_firmware()function is only called during the
ACPI_STATE_S3suspend process. However, ACPI-enabled systems are popular in the desktop world. If there are concerns about ACPI configuration, one option could be to check if the dGPU needs a reset by directly checking the SOL register. As far as I can see, when the dGPU completes its suspend process, the SOL value will remain zero until the dGPU is resumed. Conversely, in the case of a suspend abort, the SOL value will be non-zero.Quoted 1 line
Quoted 6 lines
in_s3is set for dGPU in case of s0ix as well. Probably, that's the only case where need the flag to avoid unnecessary reset. Otherwise SOL check could be sufficient.Thanks,
Lijo
Do you mean we need to include S0ix to reset the dGPU during an S0ix suspend abort? However, the in_s0ix state of the dGPU should always be false, and there is no specific suspension handler for the dGPU in S0ix. As a PCIe endpoint, the dGPU should be powered off during system-wide(S0ix and Sx) suspend, and the SOL will be reset to 0 during the suspend process. So, for the dGPU resume case, do you think it's enough to detect the suspend abort event by only checking SOL without any Sx filter?
Quoted 6 lines
Quoted 6 lines
Thanks,
PrikeQuoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0sol_reg1 =RREG32_SOC15 (MP0 ,0 , regMP0_SMN_C2PMSG_81);msleep (100 ); sol_reg2 =RREG32_SOC15 (MP0 ,0 , regMP0_SMN_C2PMSG_81);
Re: [PATCH v2 2/2] drm/amdgpu: clean up the suspend_complete
Quoted 139 lines · Prike
[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 137 lines
From: Lazar, Lijo <[email protected]>
Sent: Thursday, October 24, 2024 11:39 AM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH v2 2/2] drm/amdgpu: clean up thesuspend_completeQuoted 36 lines · Prike
[Public]
Quoted 34 lines
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, October 23, 2024 6:55 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH v2 2/2] drm/amdgpu: clean up thesuspend_completeQuoted 25 lines · Prike Liang
To check the status of S3 suspend completion, use the PM core
pm_suspend_global_flagsbit(1) to detect S3 abort events. Therefore, clean up the AMDGPU driver's private flagsuspend_complete.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 | 4 ++-- drivers/gpu/drm/amd/amdgpu/soc15.c | 7 ++----- drivers/gpu/drm/amd/amdgpu/soc21.c | 2 +- 5 files changed, 5 insertions(+), 12 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-2@@ -1111,8 +1111,6 @@ struct amdgpu_device {bool in_s3;bool in_s4;bool in_s0ix; -/* indicate amdgpu suspension status */ -bool suspend_complete;Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_suspend(struct device
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0enum 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
index680e44fdee6e..78972151b970100644drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0@@ -2501,7 +2501,6 @@ static int amdgpu_pmops_suspend(struct device*dev)
Quoted 68 lines
Quoted 68 lines
Quoted 21 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-1struct 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)) @@ -2516,7 +2515,6 @@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 +0
-1- 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 +0
-0@@ -3276,8 +3276,8 @@ static int gfx_v9_0_cp_gfx_start(structQuoted 1 line
amdgpu_device*adev)
drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_resume(struct
Quoted 16 lines
* confirmed that the APU gfx10/gfx11 needn't such update. */ if (adev->flags & AMD_IS_APU &&drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2
-2- adev->in_s3 && !adev->suspend_complete) { -DRM_INFO (" Will skip the CSB packet resubmit\n" ); + adev->in_s3 && !pm_resume_via_firmware()) { +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); diff --git
a/drivers/gpu/drm/amd/amdgpu/soc15.cb/drivers/gpu/drm/amd/amdgpu/soc15.c
index12ff6cf568dc..d9d11131a744100644drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -584,13 +584,10 @@ static bool soc15_need_reset_on_resume(struct
amdgpu_device*adev)drivers/gpu/drm/amd/amdgpu/soc21.c static bool soc21_need_reset_on_resume(struct
Quoted 21 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +2
-5* performing pm core test. */ if (adev->flags &AMD_IS_APU && adev->in_s3 && - !pm_resume_via_firmware ()) { - adev->suspend_complete = false; + !pm_resume_via_firmware ())return true; - }else { - adev->suspend_complete = true; +else return false; - } } static int soc15_asic_reset(struct amdgpu_device *adev) diff --git
a/drivers/gpu/drm/amd/amdgpu/soc21.cb/drivers/gpu/drm/amd/amdgpu/soc21.c
indexc4b950e75133..7a47a21ef00f100644drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0@@ -904,7 +904,7 @@ static bool soc21_need_reset_on_resume(struct
amdgpu_device*adev)Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +1
-1* 2) S3 suspend got aborted and TOS is active. */ if (!(adev->flags &AMD_IS_APU ) && adev->in_s3 && - !adev->suspend_complete) { + !pm_resume_via_firmware ()) {Quoted 7 lines
Quoted 5 lines
Looks like this will cover only ACPI based systems. Not sure if that assumption is valid for dGPU cases.
Thanks,
LijoYes, the
pm_set_resume_via_firmware()function is only called during the
ACPI_STATE_S3suspend process. However, ACPI-enabled systems are popular in the desktop world. If there are concerns about ACPI configuration, one option could be to check if the dGPU needs a reset by directly checking the SOL register. As far as I can see, when the dGPU completes its suspend process, the SOL value will remain zero until the dGPU is resumed. Conversely, in the case of a suspend abort, the SOL value will be non-zero.Quoted 1 line
Quoted 8 lines
Quoted 6 lines
in_s3is set for dGPU in case of s0ix as well. Probably, that's the only case where need the flag to avoid unnecessary reset. Otherwise SOL check could be sufficient.Thanks,
LijoDo you mean we need to include S0ix to reset the dGPU during an S0ix suspend abort? However, the
in_s0ixstate of the dGPU should always be false, and there is no specific suspension handler for the dGPU in S0ix. As a PCIe endpoint, the dGPU should be powered off during system-wide(S0ix and Sx) suspend, and the SOL will be reset to 0 during the suspend process. So, for the dGPU resume case, do you think it's enough to detect the suspend abort event by only checking SOL without any Sx filter?
For S0ix, I don't think there is a requirement to turn off all endpoints
- for dGPUs that don't support D3 or runpm etc. Then even if S0ix entry got aborted, but GPU is suspended properly there is no need to reset the device.
Thanks,
Lijo
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Thanks,
PrikeQuoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0sol_reg1 =RREG32_SOC15 (MP0 ,0 , regMP0_SMN_C2PMSG_81);msleep (100 ); sol_reg2 =RREG32_SOC15 (MP0 ,0 , regMP0_SMN_C2PMSG_81);
Re: [PATCH v2 2/2] drm/amdgpu: clean up the suspend_complete
Quoted 145 lines · Lijo
Quoted 142 lines · Prike
[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 140 lines
From: Lazar, Lijo <[email protected]>
Sent: Thursday, October 24, 2024 11:39 AM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH v2 2/2] drm/amdgpu: clean up thesuspend_completeQuoted 36 lines · Prike
[Public]
Quoted 34 lines
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, October 23, 2024 6:55 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH v2 2/2] drm/amdgpu: clean up thesuspend_completeQuoted 25 lines · Prike Liang
To check the status of S3 suspend completion, use the PM core
pm_suspend_global_flagsbit(1) to detect S3 abort events. Therefore, clean up the AMDGPU driver's private flagsuspend_complete.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 | 4 ++-- drivers/gpu/drm/amd/amdgpu/soc15.c | 7 ++----- drivers/gpu/drm/amd/amdgpu/soc21.c | 2 +- 5 files changed, 5 insertions(+), 12 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-2@@ -1111,8 +1111,6 @@ struct amdgpu_device {bool in_s3;bool in_s4;bool in_s0ix; -/* indicate amdgpu suspension status */ -bool suspend_complete;Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_suspend(struct device
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0enum 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
index680e44fdee6e..78972151b970100644drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0@@ -2501,7 +2501,6 @@ static int amdgpu_pmops_suspend(struct device*dev)
Quoted 68 lines
Quoted 68 lines
Quoted 21 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-1struct 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)) @@ -2516,7 +2515,6 @@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 +0
-1- 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 +0
-0@@ -3276,8 +3276,8 @@ static int gfx_v9_0_cp_gfx_start(structQuoted 1 line
amdgpu_device*adev)
drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_resume(struct
Quoted 16 lines
* confirmed that the APU gfx10/gfx11 needn't such update. */ if (adev->flags & AMD_IS_APU &&drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2
-2- adev->in_s3 && !adev->suspend_complete) { -DRM_INFO (" Will skip the CSB packet resubmit\n" ); + adev->in_s3 && !pm_resume_via_firmware()) { +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); diff --git
a/drivers/gpu/drm/amd/amdgpu/soc15.cb/drivers/gpu/drm/amd/amdgpu/soc15.c
index12ff6cf568dc..d9d11131a744100644drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -584,13 +584,10 @@ static bool soc15_need_reset_on_resume(struct
amdgpu_device*adev)drivers/gpu/drm/amd/amdgpu/soc21.c static bool soc21_need_reset_on_resume(struct
Quoted 21 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +2
-5* performing pm core test. */ if (adev->flags &AMD_IS_APU && adev->in_s3 && - !pm_resume_via_firmware ()) { - adev->suspend_complete = false; + !pm_resume_via_firmware ())return true; - }else { - adev->suspend_complete = true; +else return false; - } } static int soc15_asic_reset(struct amdgpu_device *adev) diff --git
a/drivers/gpu/drm/amd/amdgpu/soc21.cb/drivers/gpu/drm/amd/amdgpu/soc21.c
indexc4b950e75133..7a47a21ef00f100644drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0@@ -904,7 +904,7 @@ static bool soc21_need_reset_on_resume(struct
amdgpu_device*adev)Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +1
-1* 2) S3 suspend got aborted and TOS is active. */ if (!(adev->flags &AMD_IS_APU ) && adev->in_s3 && - !adev->suspend_complete) { + !pm_resume_via_firmware ()) {Quoted 7 lines
Quoted 5 lines
Looks like this will cover only ACPI based systems. Not sure if that assumption is valid for dGPU cases.
Thanks,
LijoYes, the
pm_set_resume_via_firmware()function is only called during the
ACPI_STATE_S3suspend process. However, ACPI-enabled systems are popular in the desktop world. If there are concerns about ACPI configuration, one option could be to check if the dGPU needs a reset by directly checking the SOL register. As far as I can see, when the dGPU completes its suspend process, the SOL value will remain zero until the dGPU is resumed. Conversely, in the case of a suspend abort, the SOL value will be non-zero.Quoted 1 line
in_s3is set for dGPU in case of s0ix as well. Probably, that's the only case where need the flag to avoid unnecessary reset. Otherwise SOL check could be sufficient.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Thanks,
LijoDo you mean we need to include S0ix to reset the dGPU during an S0ix suspend abort? However, the
in_s0ixstate of the dGPU should always be false, and there is no specific suspension handler for the dGPU in S0ix. As a PCIe endpoint, the dGPU should be powered off during system-wide(S0ix and Sx) suspend, and the SOL will be reset to 0 during the suspend process. So, for the dGPU resume case, do you think it's enough to detect the suspend abort event by only checking SOL without any Sx filter?For S0ix, I don't think there is a requirement to turn off all endpoints
- for dGPUs that don't support D3 or runpm etc.
To clarify, "don't support D3" => what I meant is when D3 entry is prevented.
Thanks,
Lijo
Then even if S0ix entry
Quoted 12 lines
got aborted, but GPU is suspended properly there is no need to reset the device.
Thanks,
LijoQuoted 6 lines
Quoted 6 lines
Quoted 6 lines
Thanks,
PrikeQuoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0sol_reg1 =RREG32_SOC15 (MP0 ,0 , regMP0_SMN_C2PMSG_81);msleep (100 ); sol_reg2 =RREG32_SOC15 (MP0 ,0 , regMP0_SMN_C2PMSG_81);
RE: [PATCH v2 2/2] drm/amdgpu: clean up the suspend_complete
[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 166 lines
From: Lazar, Lijo <[email protected]>
Sent: Thursday, October 24, 2024 3:30 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH v2 2/2] drm/amdgpu: clean up thesuspend_completeQuoted 139 lines · Lijo
Quoted 136 lines · Prike
[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 134 lines
From: Lazar, Lijo <[email protected]>
Sent: Thursday, October 24, 2024 11:39 AM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH v2 2/2] drm/amdgpu: clean up thesuspend_completeQuoted 38 lines · Prike
[Public]
Quoted 36 lines
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, October 23, 2024 6:55 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH v2 2/2] drm/amdgpu: clean up thesuspend_completeQuoted 25 lines · Prike Liang
To check the status of S3 suspend completion, use the PM core
pm_suspend_global_flagsbit(1) to detect S3 abort events. Therefore, clean up the AMDGPU driver's private flagsuspend_complete.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 | 4 ++-- drivers/gpu/drm/amd/amdgpu/soc15.c | 7 ++----- drivers/gpu/drm/amd/amdgpu/soc21.c | 2 +- 5 files changed, 5 insertions(+), 12 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-2@@ -1111,8 +1111,6 @@ struct amdgpu_device {bool in_s3;bool in_s4;bool in_s0ix; -/* indicate amdgpu suspension status */ -bool suspend_complete;Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0enum 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
index680e44fdee6e..78972151b970100644drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0@@ -2501,7 +2501,6 @@ static int amdgpu_pmops_suspend(structdevice
*dev)
Quoted 75 lines
Quoted 74 lines
Quoted 21 lines
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)) @@ -2516,7 +2515,6 @@ 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 +0
-1- 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 +0
-0@@ -3276,8 +3276,8 @@ static int gfx_v9_0_cp_gfx_start(structQuoted 1 line
amdgpu_device*adev)
Quoted 16 lines
* confirmed that the APU gfx10/gfx11 needn't such update. */ if (adev->flags & AMD_IS_APU &&drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2
-2- adev->in_s3 && !adev->suspend_complete) { -DRM_INFO (" Will skip the CSB packet resubmit\n" ); + adev->in_s3 && !pm_resume_via_firmware()) { +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); diff --git
a/drivers/gpu/drm/amd/amdgpu/soc15.cb/drivers/gpu/drm/amd/amdgpu/soc15.c
index12ff6cf568dc..d9d11131a744100644drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -584,13 +584,10 @@ static boolQuoted 1 line
soc15_need_reset_on_resume(struct
amdgpu_device*adev)drivers/gpu/drm/amd/amdgpu/soc21.c static bool soc21_need_reset_on_resume(struct
Quoted 21 lines
* performing pm core test. */ if (adev->flags & AMD_IS_APU && adev->in_s3 &&drivers/gpu/drm/amd/amdgpu/soc15.c +2
-6- !pm_resume_via_firmware()) { - adev->suspend_complete = false; + !pm_resume_via_firmware())return true; - } else { - adev->suspend_complete = true; + else return false; - } } static int soc15_asic_reset(struct amdgpu_device *adev) diff --git a/drivers/gpu/drm/amd/amdgpu/soc21.c
b/drivers/gpu/drm/amd/amdgpu/soc21.c
indexc4b950e75133..7a47a21ef00f100644drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0@@ -904,7 +904,7 @@ static bool soc21_need_reset_on_resume(struct
amdgpu_device*adev)drivers/gpu/drm/amd/amdgpu/soc21.c static bool soc21_need_reset_on_resume(struct · line 907
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +1
-1* 2) S3 suspend got aborted and TOS is active. */ if (!(adev->flags &AMD_IS_APU ) && adev->in_s3 && - !adev->suspend_complete) { + !pm_resume_via_firmware ()) {Looks like this will cover only ACPI based systems. Not sure if that assumption is valid for dGPU cases.
Thanks,
LijoQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Yes, the
pm_set_resume_via_firmware()function is only called during the
ACPI_STATE_S3suspend process. However, ACPI-enabled systems are popular in the desktop world. If there are concerns about ACPI configuration, one option could be to check if the dGPU needs a reset by directly checking the SOL register. As far as I can see, when the dGPU completes its suspend process, the SOL value will remain zero until the dGPU is resumed. Conversely, in the case of a suspendabort, the SOL value will be non-zero.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
in_s3is set for dGPU in case of s0ix as well. Probably, that's the only case where need the flag to avoid unnecessary reset. Otherwise SOLcheck could be sufficient.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Thanks,
Lijo
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Do you mean we need to include S0ix to reset the dGPU during an S0ix suspend
abort? However, the
in_s0ixstate of the dGPU should always be false, and there is no specific suspension handler for the dGPU in S0ix. As a PCIe endpoint, the dGPU should be powered off during system-wide(S0ix and Sx) suspend, and the SOL will be reset to 0 during the suspend process. So, for the dGPU resume case, do you think it's enough to detect the suspend abort event by only checking SOL without any Sx filter?Quoted 3 lines
Quoted 1 line
For S0ix, I don't think there is a requirement to turn off all endpoints
Yes, that only requires the _DSM listed devices reach its deepest sleep level.
Quoted 3 lines
Quoted 1 line
- for dGPUs that don't support D3 or runpm etc.
To clarify, "don't support D3" => what I meant is when D3 entry is prevented.
IMO this case can be filtered out by checking the SOL register value.
Quoted 18 lines
Thanks,
LijoThen even if S0ix entry
Quoted 10 lines
got aborted, but GPU is suspended properly there is no need to reset the device.
Thanks,
LijoQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
Thanks,
PrikeQuoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0sol_reg1 = RREG32_SOC15(MP0, 0,
regMP0_SMN_C2PMSG_81);Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/soc21.c +0
-0msleep (100 ); sol_reg2 = RREG32_SOC15(MP0, 0,
regMP0_SMN_C2PMSG_81);