Revert "drm/amd: flush any delayed gfxoff on suspend entry"
Subsystems (2)
PATCH v4 1/3 Revert "drm/amd: flush any delayed gfxoff on suspend entry"
commit ab4750332dbe ("drm/amdgpu/sdma5.2: add begin/end_use ring callbacks") caused GFXOFF control to be used more heavily and the codepath that was removed from commit 0dee72639533 ("drm/amd: flush any delayed gfxoff on suspend entry") now can be exercised at suspend again.
Users report that by using GNOME to suspend the lockscreen trigger will cause SDMA traffic and the system can deadlock.
This reverts commit 0dee726395333fea833eaaf838bc80962df886c8.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 - drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 9 ++++++++- 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -1
@@ -4573,7 +4573,6 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)drm_fb_helper_set_suspend_unlocked (adev_to_drm (adev)->fb_helper, true);cancel_delayed_work_sync (&adev->delayed_init_work); -flush_delayed_work (&adev->gfx.gfx_off_delay_work);amdgpu_ras_suspend (adev);
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +8 -1
@@ -727,8 +727,15 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable)if (adev->gfx.gfx_off_req_count ==0 && !adev->gfx.gfx_off_state) { -schedule_delayed_work (&adev->gfx.gfx_off_delay_work, +/* If going to s2idle, no need to wait */ +if (adev->in_s0ix) { +if (!amdgpu_dpm_set_powergating_by_smu (adev, +AMD_IP_BLOCK_TYPE_GFX , true)) + adev->gfx.gfx_off_state = true; + }else { +schedule_delayed_work (&adev->gfx.gfx_off_delay_work, delay); + } } }else {if (adev->gfx.gfx_off_req_count ==0 ) {
Signature · 1 line
2.34.1
PATCH v4 2/3 drm/amd: Stop evicting resources on APUs in suspend
commit 5095d5418193 ("drm/amd: Evict resources during PM ops prepare() callback") intentionally moved the eviction of resources to earlier in the suspend process, but this introduced a subtle change that it occurs before adev->in_s0ix or adev->in_s3 are set. This meant that APUs actually started to evict resources at suspend time as well.
Explicitly set s0ix or s3 in the prepare() stage, and unset them if the prepare() stage failed.
---v3->v4:
* New function to set s0ix/s3 and explicitly unset in cleanupv2->v3:
* Whitespacev1->v2:
* Add and use new in_prepare member
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 15 +++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 11 +++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
@@ -1547,9 +1547,11 @@ static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev,#if defined(CONFIG_ACPI ) && defined(CONFIG_SUSPEND )bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev);bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev); +void amdgpu_choose_low_power_state (struct amdgpu_device *adev);#else static inline bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev) {return false; }static inline bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev) {return false; } +static void amdgpu_choose_low_power_state (struct amdgpu_device *adev) { }#endif #if defined(CONFIG_DRM_AMD_DC )
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +15 -0
@@ -1519,4 +1519,19 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) #endif /* CONFIG_AMD_PMC */ } +/** +* amdgpu_choose_low_power_state +* +* @adev: amdgpu_device_pointer +* +* Choose the target low power state for the GPU +*/ +void amdgpu_choose_low_power_state (struct amdgpu_device *adev) +{ +if (amdgpu_acpi_is_s0ix_active (adev)) + adev->in_s0ix = true; +else if (amdgpu_acpi_is_s3_active (adev)) + adev->in_s3 = true; +} +#endif /* CONFIG_SUSPEND */
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +9 -2
@@ -4518,13 +4518,15 @@ int amdgpu_device_prepare(struct drm_device *dev)struct amdgpu_device *adev =drm_to_adev (dev);int i, r; +amdgpu_choose_low_power_state (adev); +if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF )return 0 ;/* Evict the majority of BOs before starting suspend sequence */ r =amdgpu_device_evict_resources (adev);if (r) -return r; + goto unprepare;for (i =0 ; i < adev->num_ip_blocks; i++) {if (!adev->ip_blocks[i].status.valid)
@@ -4533,10 +4535,15 @@ int amdgpu_device_prepare(struct drm_device *dev)continue ; r = adev->ip_blocks[i].version->funcs->prepare_suspend ((void *)adev);if (r) -return r; + goto unprepare; }return 0 ; + +unprepare: + adev->in_s0ix = adev->in_s3 = false; + +return r; }/**
Signature · 1 line
2.34.1
Re: [PATCH v4 2/3] drm/amd: Stop evicting resources on APUs in suspend
Quoted 7 lines · Mario Limonciello
commit
5095d5418193("drm/amd: Evict resources during PM opsprepare()callback") intentionally moved the eviction of resources to earlier in the suspend process, but this introduced a subtle change that it occurs beforeadev->in_s0ixoradev->in_s3are set. This meant that APUs actually started to evict resources at suspend time as well.
Quoted 7 lines
Explicitly set s0ix or s3 in the
prepare()stage, and unset them if theprepare()stage failed.Reported-by Jürg Billeter <[email protected]>Fixes 5095d5418193 ("drm/amd: Evict resources during PM ops prepare() callback")Signed-off-by Mario Limonciello <[email protected]>
Quoted 94 lines
---
v3->v4:
* New function to set s0ix/s3 and explicitly unset in cleanupv2->v3:
* Whitespacev1->v2:
* Add and use newin_preparemember--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 15 +++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 11 +++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +2
-0@@ -1547,9 +1547,11 @@ static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev,#if defined(CONFIG_ACPI ) && defined(CONFIG_SUSPEND )bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev);bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev); +void amdgpu_choose_low_power_state (struct amdgpu_device *adev);#else static inline bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev) {return false; }static inline bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev) {return false; } +static void amdgpu_choose_low_power_state (struct amdgpu_device *adev) { }#endif #if defined(CONFIG_DRM_AMD_DC )drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +15
-0@@ -1519,4 +1519,19 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) #endif /* CONFIG_AMD_PMC */ } +/** +* amdgpu_choose_low_power_state +* +* @adev: amdgpu_device_pointer +* +* Choose the target low power state for the GPU +*/ +void amdgpu_choose_low_power_state (struct amdgpu_device *adev) +{ +if (amdgpu_acpi_is_s0ix_active (adev)) + adev->in_s0ix = true; +else if (amdgpu_acpi_is_s3_active (adev)) + adev->in_s3 = true; +} +#endif /* CONFIG_SUSPEND */ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +9
-3@@ -4518,13 +4518,15 @@ int amdgpu_device_prepare(struct drm_device *dev)struct amdgpu_device *adev =drm_to_adev (dev);int i, r; +amdgpu_choose_low_power_state (adev); +if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF )return 0 ;/* Evict the majority of BOs before starting suspend sequence */ r =amdgpu_device_evict_resources (adev);if (r) -return r; + goto unprepare;for (i =0 ; i < adev->num_ip_blocks; i++) {if (!adev->ip_blocks[i].status.valid)@@ -4533,10 +4535,15 @@ int amdgpu_device_prepare(struct drm_device *dev)continue ; r = adev->ip_blocks[i].version->funcs->prepare_suspend ((void *)adev);if (r) -return r; + goto unprepare; }return 0 ; + +unprepare: + adev->in_s0ix = adev->in_s3 = false; + +return r; }/** -- 2.34.1
PATCH v4 3/3 drm/amd: Drop unneeded functions to check if s3/s0ix active
In reply to Mario Limoncielloamdgpu_acpi_is_s0ix_active() and amdgpu_acpi_is_s0ix_active() aren't needed to be checked multiple times in a suspend cycle. Checking and setting up policy one time in the prepare() callback is sufficient.
---
v4: New patch
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 ---- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 7 +++---- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 17 ++--------------- 3 files changed, 5 insertions(+), 23 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -4
@@ -1545,12 +1545,8 @@ static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev,#endif #if defined(CONFIG_ACPI ) && defined(CONFIG_SUSPEND ) -bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev); -bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev);void amdgpu_choose_low_power_state (struct amdgpu_device *adev);#else -static inline bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev) {return false; } -static inline bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev) {return false; }static void amdgpu_choose_low_power_state (struct amdgpu_device *adev) { }#endif
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3 -4
@@ -1366,8 +1366,7 @@ bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev) adev->gfx.imu.funcs) /* Not need to do mode2 reset for IMU enabled APUs */return false; -if ((adev->flags &AMD_IS_APU ) && -amdgpu_acpi_is_s3_active (adev)) +if ((adev->flags &AMD_IS_APU ) && adev->in_s3)return false;if (amdgpu_sriov_vf (adev))
@@ -1472,7 +1471,7 @@ void amdgpu_acpi_release(void)* * returns true if supported, false if not. */ -bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev) +static inline bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev) {return !(adev->flags &AMD_IS_APU ) || (pm_suspend_target_state ==PM_SUSPEND_MEM );
@@ -1485,7 +1484,7 @@ bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)* * returns true if supported, false if not. */ -bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev) +static inline bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev) {if (!(adev->flags &AMD_IS_APU ) || (pm_suspend_target_state !=PM_SUSPEND_TO_IDLE ))
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -15
@@ -2456,13 +2456,6 @@ static int amdgpu_pmops_prepare(struct device *dev) pm_runtime_suspended(dev))return 1 ; -/* if we will not support s3 or s2i for the device -* then skip suspend -*/ -if (!amdgpu_acpi_is_s0ix_active (adev) && - !amdgpu_acpi_is_s3_active (adev)) -return 1 ; -return amdgpu_device_prepare (drm_dev); }
@@ -2476,10 +2469,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); -if (amdgpu_acpi_is_s0ix_active (adev)) - adev->in_s0ix = true; -else if (amdgpu_acpi_is_s3_active (adev)) - adev->in_s3 = true;if (!adev->in_s0ix && !adev->in_s3)return 0 ;return amdgpu_device_suspend (drm_dev, true);
@@ -2510,10 +2499,8 @@ static int amdgpu_pmops_resume(struct device *dev) adev->no_hw_access = true; r =amdgpu_device_resume (drm_dev, true); -if (amdgpu_acpi_is_s0ix_active (adev)) - adev->in_s0ix = false; -else - adev->in_s3 = false; + adev->in_s0ix = adev->in_s3 = false; +return r; }
Signature · 1 line
2.34.1
Re: [PATCH v4 3/3] drm/amd: Drop unneeded functions to check if s3/s0ix active
Am 08.02.24 um 06:52 schrieb Mario Limonciello:
Quoted 3 lines
amdgpu_acpi_is_s0ix_active()andamdgpu_acpi_is_s0ix_active()aren't needed to be checked multiple times in a suspend cycle. Checking and setting up policy one time in theprepare()callback is sufficient.
Mhm, looking at amdgpu_acpi_is_s3_active() I think we should not cache that in a variable in the first place.
Just calling the function all the time to check the state should be sufficient, or do we then run into any state transition problems?
Regards,
Christian.
Quoted 101 lines
Signed-off-by Mario Limonciello <[email protected]>---
v4: New patch--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 ---- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 7 +++---- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 17 ++--------------- 3 files changed, 5 insertions(+), 23 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-4@@ -1545,12 +1545,8 @@ static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev,#endif #if defined(CONFIG_ACPI ) && defined(CONFIG_SUSPEND ) -bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev); -bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev);void amdgpu_choose_low_power_state (struct amdgpu_device *adev);#else -static inline bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev) {return false; } -static inline bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev) {return false; }static void amdgpu_choose_low_power_state (struct amdgpu_device *adev) { }#endif drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3
-4@@ -1366,8 +1366,7 @@ bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev) adev->gfx.imu.funcs) /* Not need to do mode2 reset for IMU enabled APUs */return false; -if ((adev->flags &AMD_IS_APU ) && -amdgpu_acpi_is_s3_active (adev)) +if ((adev->flags &AMD_IS_APU ) && adev->in_s3)return false;if (amdgpu_sriov_vf (adev))@@ -1472,7 +1471,7 @@ void amdgpu_acpi_release(void)* * returns true if supported, false if not. */ -bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev) +static inline bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev) {return !(adev->flags &AMD_IS_APU ) || (pm_suspend_target_state ==PM_SUSPEND_MEM );@@ -1485,7 +1484,7 @@ bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)* * returns true if supported, false if not. */ -bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev) +static inline bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev) {if (!(adev->flags &AMD_IS_APU ) || (pm_suspend_target_state !=PM_SUSPEND_TO_IDLE ))drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2
-15@@ -2456,13 +2456,6 @@ static int amdgpu_pmops_prepare(struct device *dev) pm_runtime_suspended(dev))return 1 ; -/* if we will not support s3 or s2i for the device -* then skip suspend -*/ -if (!amdgpu_acpi_is_s0ix_active (adev) && - !amdgpu_acpi_is_s3_active (adev)) -return 1 ; -return amdgpu_device_prepare (drm_dev); }@@ -2476,10 +2469,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); -if (amdgpu_acpi_is_s0ix_active (adev)) - adev->in_s0ix = true; -else if (amdgpu_acpi_is_s3_active (adev)) - adev->in_s3 = true;if (!adev->in_s0ix && !adev->in_s3)return 0 ;return amdgpu_device_suspend (drm_dev, true);@@ -2510,10 +2499,8 @@ static int amdgpu_pmops_resume(struct device *dev) adev->no_hw_access = true; r =amdgpu_device_resume (drm_dev, true); -if (amdgpu_acpi_is_s0ix_active (adev)) - adev->in_s0ix = false; -else - adev->in_s3 = false; + adev->in_s0ix = adev->in_s3 = false; +return r; }
Re: [PATCH v4 3/3] drm/amd: Drop unneeded functions to check if s3/s0ix active
Quoted 8 lines · Christian König
Am 08.02.24 um 06:52 schrieb Mario Limonciello:
Quoted 3 lines
amdgpu_acpi_is_s0ix_active()andamdgpu_acpi_is_s0ix_active()aren't needed to be checked multiple times in a suspend cycle. Checking and setting up policy one time in theprepare()callback is sufficient.Mhm, looking at
amdgpu_acpi_is_s3_active()I think we should not cache that in a variable in the first place.Just calling the function all the time to check the state should be sufficient, or do we then run into any state transition problems?
I think calling to check it each time is perfectly fine, it should never change once the sequence starts until it's over.
If the first 2 patches look OK, I'd like to get those merged so we can fix the regressions. I'll do another series that can drop the cached parameters.
Quoted 105 lines
Regards,
Christian.Quoted 100 lines
Signed-off-by Mario Limonciello <[email protected]>---
v4: New patch
---
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 ----drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c| 7 +++---- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 17 ++---------------3 files changed, 5 insertions(+), 23 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-4@@ -1545,12 +1545,8 @@ static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev, #endif #if defined(CONFIG_ACPI) && defined(CONFIG_SUSPEND) -bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev); -bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev); void amdgpu_choose_low_power_state(struct amdgpu_device *adev); #else -static inline bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev) { return false; } -static inline bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev) { return false; } static void amdgpu_choose_low_power_state(struct amdgpu_device *adev) { }#endif
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0
-0@@ -1366,8 +1366,7 @@ bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev)
adev->gfx.imu.funcs) /* Not need to do mode2 reset for IMU enabled APUs */ return false;
- if ((adev->flags&AMD_IS_APU) &&
-amdgpu_acpi_is_s3_active(adev))
+ if ((adev->flags&AMD_IS_APU) &&adev->in_s3)
return false;
if (amdgpu_sriov_vf(adev))drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1
-1@@ -1472,7 +1471,7 @@ void amdgpu_acpi_release(void)* * returns true if supported, false if not. */ -bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev) +static inline bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev) {return !(adev->flags &
AMD_IS_APU) || (pm_suspend_target_state==PM_SUSPEND_MEM);drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1
-1@@ -1485,7 +1484,7 @@ bool amdgpu_acpi_is_s3_active(structamdgpu_device *adev) * * returns true if supported, false if not. */ -bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev) +static inline bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev) {if (!(adev->flags &
AMD_IS_APU) || (pm_suspend_target_state!=PM_SUSPEND_TO_IDLE))drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2
-15@@ -2456,13 +2456,6 @@ static int amdgpu_pmops_prepare(struct device *dev) pm_runtime_suspended(dev)) return 1; - /* if we will not support s3 or s2i for the device - * then skip suspend - */ - if (!amdgpu_acpi_is_s0ix_active(adev) && - !amdgpu_acpi_is_s3_active(adev)) - return 1; - return amdgpu_device_prepare(drm_dev); }@@ -2476,10 +2469,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); - if (amdgpu_acpi_is_s0ix_active(adev)) - adev->in_s0ix = true; - else if (amdgpu_acpi_is_s3_active(adev)) - adev->in_s3 = true; if (!adev->in_s0ix && !adev->in_s3) return 0; return amdgpu_device_suspend(drm_dev, true);@@ -2510,10 +2499,8 @@ static int amdgpu_pmops_resume(struct device *dev) adev->no_hw_access = true; r = amdgpu_device_resume(drm_dev, true); - if (amdgpu_acpi_is_s0ix_active(adev)) - adev->in_s0ix = false; - else - adev->in_s3 = false; + adev->in_s0ix = adev->in_s3 = false; + return r; }
Re: [PATCH v4 3/3] drm/amd: Drop unneeded functions to check if s3/s0ix active
Am 08.02.24 um 16:04 schrieb Mario Limonciello:
Quoted 6 lines · Christian König
Quoted 5 lines
Am 08.02.24 um 06:52 schrieb Mario Limonciello:
Quoted 3 lines
amdgpu_acpi_is_s0ix_active()andamdgpu_acpi_is_s0ix_active()aren't needed to be checked multiple times in a suspend cycle. Checking and setting up policy one time in theprepare()callback is sufficient.
Quoted 7 lines
Quoted 3 lines
Mhm, looking at
amdgpu_acpi_is_s3_active()I think we should not cache that in a variable in the first place.Just calling the function all the time to check the state should be sufficient, or do we then run into any state transition problems?
I think calling to check it each time is perfectly fine, it should never change once the sequence starts until it's over.
If the first 2 patches look OK, I'd like to get those merged so we can fix the regressions. I'll do another series that can drop the cached parameters.
Feel free to add my Acked-by to the series, but for ACPI stuff I would wait for Alex to take a look as well.
Regards,
Christian.
Quoted 109 lines
Quoted 108 lines
Regards,
Christian.Quoted 102 lines
Signed-off-by Mario Limonciello <[email protected]>---
v4: New patch
---
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 ----drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c| 7 +++---- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 17 ++---------------3 files changed, 5 insertions(+), 23 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-4@@ -1545,12 +1545,8 @@ static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev, #endif #if defined(CONFIG_ACPI) && defined(CONFIG_SUSPEND) -bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev); -bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev); void amdgpu_choose_low_power_state(struct amdgpu_device *adev); #else -static inline bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev) { return false; } -static inline bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev) { return false; } static void amdgpu_choose_low_power_state(struct amdgpu_device *adev) { }#endif
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0
-0@@ -1366,8 +1366,7 @@ bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev)
adev->gfx.imu.funcs) /* Not need to do mode2 reset for IMU enabled APUs */ return false;
- if ((adev->flags&AMD_IS_APU) &&
-amdgpu_acpi_is_s3_active(adev))
+ if ((adev->flags&AMD_IS_APU) &&adev->in_s3)
return false;
if (amdgpu_sriov_vf(adev))drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1
-1@@ -1472,7 +1471,7 @@ void amdgpu_acpi_release(void)* * returns true if supported, false if not. */ -bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev) +static inline bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev) {return !(adev->flags &
AMD_IS_APU) || (pm_suspend_target_state==PM_SUSPEND_MEM);drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1
-1@@ -1485,7 +1484,7 @@ bool amdgpu_acpi_is_s3_active(structamdgpu_device *adev) * * returns true if supported, false if not. */ -bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev) +static inline bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev) {if (!(adev->flags &
AMD_IS_APU) || (pm_suspend_target_state!=PM_SUSPEND_TO_IDLE))drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2
-15@@ -2456,13 +2456,6 @@ static int amdgpu_pmops_prepare(struct device *dev) pm_runtime_suspended(dev)) return 1; - /* if we will not support s3 or s2i for the device - * then skip suspend - */ - if (!amdgpu_acpi_is_s0ix_active(adev) && - !amdgpu_acpi_is_s3_active(adev)) - return 1; - return amdgpu_device_prepare(drm_dev); }@@ -2476,10 +2469,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); - if (amdgpu_acpi_is_s0ix_active(adev)) - adev->in_s0ix = true; - else if (amdgpu_acpi_is_s3_active(adev)) - adev->in_s3 = true; if (!adev->in_s0ix && !adev->in_s3) return 0; return amdgpu_device_suspend(drm_dev, true);@@ -2510,10 +2499,8 @@ static int amdgpu_pmops_resume(struct device *dev) adev->no_hw_access = true; r = amdgpu_device_resume(drm_dev, true); - if (amdgpu_acpi_is_s0ix_active(adev)) - adev->in_s0ix = false; - else - adev->in_s3 = false; + adev->in_s0ix = adev->in_s3 = false; + return r; }