Runtime suspend runs GFX hw_fini and clears perfmon clock gating while
the UMD profile DPM level remains set in software.  Re-apply stable
pstate after a successful runtime resume when a profile mode is active.

Signed-off-by: Candice Li <[email protected]>
Reviewed-by: Hawking Zhang <[email protected]>
Reviewed-by: Yang Wang <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 5362705143bc75..356e44d54d0024 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -2920,6 +2920,19 @@ static int amdgpu_pmops_runtime_suspend(struct device 
*dev)
        return 0;
 }
 
+static void amdgpu_restore_umd_profile_pstate_after_runpm(struct amdgpu_device 
*adev)
+{
+       enum amd_dpm_forced_level level;
+       uint32_t profile_mode_mask = AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD |
+               AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK |
+               AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK |
+               AMD_DPM_FORCED_LEVEL_PROFILE_PEAK;
+
+       level = amdgpu_dpm_get_performance_level(adev);
+       if (level & profile_mode_mask)
+               amdgpu_asic_update_umd_stable_pstate(adev, true);
+}
+
 static int amdgpu_pmops_runtime_resume(struct device *dev)
 {
        struct pci_dev *pdev = to_pci_dev(dev);
@@ -2964,6 +2977,8 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)
 
        if (adev->pm.rpm_mode == AMDGPU_RUNPM_PX)
                drm_dev->switch_power_state = DRM_SWITCH_POWER_ON;
+
+       amdgpu_restore_umd_profile_pstate_after_runpm(adev);
        adev->in_runpm = false;
        return 0;
 }
-- 
2.25.1

Reply via email to