drm/amdgpu: disallow gfxoff until GC IP blocks complete s2idle resume
Subsystems (3)
PATCH 1/1 drm/amdgpu: disallow gfxoff until GC IP blocks complete s2idle resume
In the S2idle suspend/resume phase the gfxoff is keeping functional so some IP blocks will be likely to reinitialize at gfxoff entry and that will result in failing to program GC registers.Therefore, let disallow gfxoff until AMDGPU IPs reinitialized completely.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++++ drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 +++++ 2 files changed, 9 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
@@ -4185,6 +4185,10 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)/* Make sure IB tests flushed */ flush_delayed_work (&adev->delayed_init_work); +if (adev->in_s0ix) { +amdgpu_gfx_off_ctrl (adev, true); +DRM_DEBUG ("will enable gfxoff for the mission mode\n" ); + }if (fbcon)drm_fb_helper_set_suspend_unlocked (adev_to_drm (adev)->fb_helper, false);
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +5 -0
@@ -1664,6 +1664,11 @@ static int smu_resume(void *handle)dev_info (adev->dev,"SMU is resumed successfully!\n" ); +if (adev->in_s0ix) { +amdgpu_gfx_off_ctrl (adev, false); +dev_dbg (adev->dev,"will disable gfxoff for re-initializing other blocks\n" ); + } +return 0 ; }
Signature · 1 line
2.25.1
Quoted 32 lines · Prike Liang
In the S2idle suspend/resume phase the gfxoff is keeping functional so some IP blocks will be likely to reinitialize at gfxoff entry and that will result in failing to program GC registers.Therefore, let disallow gfxoff until AMDGPU IPs reinitialized completely.
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++++ drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 +++++ 2 files changed, 9 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4
-0@@ -4185,6 +4185,10 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)/* Make sure IB tests flushed */ flush_delayed_work (&adev->delayed_init_work); +if (adev->in_s0ix) { +amdgpu_gfx_off_ctrl (adev, true); +DRM_DEBUG ("will enable gfxoff for the mission mode\n" ); + }if (fbcon)drm_fb_helper_set_suspend_unlocked (adev_to_drm (adev)->fb_helper, false);drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-0
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_resume(void *handle) · line 1671
Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +5
-0@@ -1664,6 +1664,11 @@ static int smu_resume(void *handle)dev_info (adev->dev,"SMU is resumed successfully!\n" ); +if (adev->in_s0ix) { +amdgpu_gfx_off_ctrl (adev, false); +dev_dbg (adev->dev,"will disable gfxoff for re-initializing other blocks\n" ); + } +
I think it would be better to put this in amdgpu_device.c so it's clear where its match is. Also for raven based boards this will get missed because they still use the powerplay power code.
Alex
Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-1return 0 ; } --2.25.1
[Public]
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Friday, October 21, 2022 9:39 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: disallow gfxoff until GC IP blocks complete s2idle resume
Quoted 36 lines · Prike Liang
In the S2idle suspend/resume phase the gfxoff is keeping functional so some IP blocks will be likely to reinitialize at gfxoff entry and that will result in failing to program GC registers.Therefore, let disallow gfxoff until AMDGPU IPs reinitialized completely.
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++++ drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 +++++ 2 files changed, 9 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4
-0@@ -4185,6 +4185,10 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)/* Make sure IB tests flushed */ flush_delayed_work (&adev->delayed_init_work); +if (adev->in_s0ix) { +amdgpu_gfx_off_ctrl (adev, true); +DRM_DEBUG ("will enable gfxoff for the mission mode\n" ); + }if (fbcon) drm_fb_helper_set_suspend_unlocked(adev_to_drm(adev)->fb_helper,false);
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-0
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_resume(void *handle) · line 1671
Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +5
-0@@ -1664,6 +1664,11 @@ static int smu_resume(void *handle)dev_info (adev->dev,"SMU is resumed successfully!\n" ); +if (adev->in_s0ix) { +amdgpu_gfx_off_ctrl (adev, false); +dev_dbg (adev->dev,"will disable gfxoff for re-initializing other blocks\n" ); + } +
I think it would be better to put this in amdgpu_device.c so it's clear where its match is. Also for raven based boards this will get missed because they still use the powerplay power code.
Alex
[Prike] I miss this amdgpu_gfx_off_ctrl() is a generic upper layer function but that should also work on Rave series, since on the Rave series will use another message PPSMC_MSG_GpuChangeState exit gfxoff. But it makes sense unify the operation of exiting gfxoff at an upper layer in amdgpu_device.c and I will update it at patch v2.
Thanks,
Prike
Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-1return 0 ; } --2.25.1
Quoted 58 lines · Prike
[Public]
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Friday, October 21, 2022 9:39 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: disallow gfxoff until GC IP blocks complete s2idle resumeQuoted 36 lines · Prike Liang
In the S2idle suspend/resume phase the gfxoff is keeping functional so some IP blocks will be likely to reinitialize at gfxoff entry and that will result in failing to program GC registers.Therefore, let disallow gfxoff until AMDGPU IPs reinitialized completely.
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++++ drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 +++++ 2 files changed, 9 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4
-0@@ -4185,6 +4185,10 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)/* Make sure IB tests flushed */ flush_delayed_work (&adev->delayed_init_work); +if (adev->in_s0ix) { +amdgpu_gfx_off_ctrl (adev, true); +DRM_DEBUG ("will enable gfxoff for the mission mode\n" ); + }if (fbcon) drm_fb_helper_set_suspend_unlocked(adev_to_drm(adev)->fb_helper,false);
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-0drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_resume(void *handle) · line 1671
Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +5
-0@@ -1664,6 +1664,11 @@ static int smu_resume(void *handle)dev_info (adev->dev,"SMU is resumed successfully!\n" ); +if (adev->in_s0ix) { +amdgpu_gfx_off_ctrl (adev, false); +dev_dbg (adev->dev,"will disable gfxoff for re-initializing other blocks\n" ); + } +I think it would be better to put this in
amdgpu_device.cso it's clear where its match is. Also for raven based boards this will get missed because they still use the powerplay power code.
Quoted 4 lines
Alex
[Prike] I miss this
amdgpu_gfx_off_ctrl()is a generic upper layer function but that should also work on Rave series, since on the Rave series will use another messagePPSMC_MSG_GpuChangeStateexit gfxoff. But it makes sense unify the operation of exiting gfxoff at an upper layer inamdgpu_device.cand I will update it at patch v2.
Ok. If you can move it into amdgpu_device.c that would be great, but if not, either way, please add comments to these functions noting where their match is and why this is necessary.
Thanks!
Alex
Quoted 8 lines
Thanks,
PrikeQuoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-1return 0 ; } --2.25.1