drm/amd/pm: correct gfx and pcie settings on umd pstate switching(V2)
authorEvan Quan <evan.quan@amd.com>
Tue, 18 Aug 2020 04:43:25 +0000 (12:43 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 15 Oct 2020 16:20:46 +0000 (12:20 -0400)
For entering UMD stable Pstate, the operations to enter rlc_safe
mode, disable mgcg_perfmon and disable PCIE aspm are needed. And
the opposite operations should be performed on UMD stable Pstate
exiting.

V2: take those ASICs(CI/SI/VI) which may not support this into
    consideration

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c

index bfecee8..9101ccd 100644 (file)
@@ -623,6 +623,8 @@ struct amdgpu_asic_funcs {
        bool (*supports_baco)(struct amdgpu_device *adev);
        /* pre asic_init quirks */
        void (*pre_asic_init)(struct amdgpu_device *adev);
+       /* enter/exit umd stable pstate */
+       int (*update_umd_stable_pstate)(struct amdgpu_device *adev, bool enter);
 };
 
 /*
@@ -1165,6 +1167,8 @@ int emu_soc_asic_init(struct amdgpu_device *adev);
 #define amdgpu_asic_get_pcie_replay_count(adev) ((adev)->asic_funcs->get_pcie_replay_count((adev)))
 #define amdgpu_asic_supports_baco(adev) (adev)->asic_funcs->supports_baco((adev))
 #define amdgpu_asic_pre_asic_init(adev) (adev)->asic_funcs->pre_asic_init((adev))
+#define amdgpu_asic_update_umd_stable_pstate(adev, enter) \
+       ((adev)->asic_funcs->update_umd_stable_pstate ? (adev)->asic_funcs->update_umd_stable_pstate((adev), (enter)) : 0)
 
 #define amdgpu_inc_vram_lost(adev) atomic_inc(&((adev)->vram_lost_counter));
 
index 7e1b303..b2e5b28 100644 (file)
@@ -1414,6 +1414,7 @@ static int smu_enable_umd_pstate(void *handle,
                                                               AMD_CG_STATE_UNGATE);
                        smu_gfx_ulv_control(smu, false);
                        smu_deep_sleep_control(smu, false);
+                       amdgpu_asic_update_umd_stable_pstate(smu->adev, true);
                }
        } else {
                /* exit umd pstate, restore level, enable gfx cg*/
@@ -1421,6 +1422,7 @@ static int smu_enable_umd_pstate(void *handle,
                        if (*level == AMD_DPM_FORCED_LEVEL_PROFILE_EXIT)
                                *level = smu_dpm_ctx->saved_dpm_level;
                        smu_dpm_ctx->enable_umd_pstate = false;
+                       amdgpu_asic_update_umd_stable_pstate(smu->adev, false);
                        smu_deep_sleep_control(smu, true);
                        smu_gfx_ulv_control(smu, true);
                        amdgpu_device_ip_set_clockgating_state(smu->adev,