drm/amd/powerplay: fix force dpm level failed on CZ
Subsystems (2)
PATCH 1/3 drm/amd/powerplay: fix force dpm level failed on CZ
--- drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c | 51 ++++++++++++++++++-------- 1 file changed, 36 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +36 -15
@@ -1234,13 +1234,18 @@ static int cz_phm_force_dpm_highest(struct pp_hwmgr *hwmgr) {struct cz_hwmgr *cz_hwmgr = (struct cz_hwmgr *)(hwmgr->backend); -if (cz_hwmgr->sclk_dpm.soft_min_clk != - cz_hwmgr->sclk_dpm.soft_max_clk) -smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, - PPSMC_MSG_SetSclkSoftMin, -cz_get_sclk_level (hwmgr, - cz_hwmgr->sclk_dpm.soft_max_clk, - PPSMC_MSG_SetSclkSoftMin)); +smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, + PPSMC_MSG_SetSclkSoftMin, +cz_get_sclk_level (hwmgr, + cz_hwmgr->sclk_dpm.soft_max_clk, + PPSMC_MSG_SetSclkSoftMin)); + +smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, + PPSMC_MSG_SetSclkSoftMax, +cz_get_sclk_level (hwmgr, + cz_hwmgr->sclk_dpm.soft_max_clk, + PPSMC_MSG_SetSclkSoftMax)); +return 0 ; }
@@ -1286,18 +1291,34 @@ static int cz_phm_force_dpm_lowest(struct pp_hwmgr *hwmgr) {struct cz_hwmgr *cz_hwmgr = (struct cz_hwmgr *)(hwmgr->backend); -if (cz_hwmgr->sclk_dpm.soft_min_clk != - cz_hwmgr->sclk_dpm.soft_max_clk) { - cz_hwmgr->sclk_dpm.soft_max_clk = - cz_hwmgr->sclk_dpm.soft_min_clk; +smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, + PPSMC_MSG_SetSclkSoftMax, +cz_get_sclk_level (hwmgr, + cz_hwmgr->sclk_dpm.soft_min_clk, + PPSMC_MSG_SetSclkSoftMax)); -smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, +smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, + PPSMC_MSG_SetSclkSoftMin, +cz_get_sclk_level (hwmgr, + cz_hwmgr->sclk_dpm.soft_min_clk, + PPSMC_MSG_SetSclkSoftMin)); + +return 0 ; +} + +static int cz_phm_force_dpm_sclk (struct pp_hwmgr *hwmgr,uint32_t sclk) +{ +smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, + PPSMC_MSG_SetSclkSoftMin, +cz_get_sclk_level (hwmgr, + sclk, + PPSMC_MSG_SetSclkSoftMin)); + +smum_send_msg_to_smc_with_parameter (hwmgr->smumgr, PPSMC_MSG_SetSclkSoftMax,cz_get_sclk_level (hwmgr, - cz_hwmgr->sclk_dpm.soft_max_clk, + sclk, PPSMC_MSG_SetSclkSoftMax)); - } -return 0 ; }
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1501671923-22079-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org
PATCH 2/3 drm/amd/powerplay: fix set highest mclk level failed on Vega10
--- drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 33 ++++++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +27 -6
@@ -3646,10 +3646,22 @@ static void vega10_apply_dal_minimum_voltage_request(return ; } +static int vega10_get_soc_index_for_max_uclk (struct pp_hwmgr *hwmgr) +{ +struct phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_table_on_mclk; +struct phm_ppt_v2_information *table_info = + (struct phm_ppt_v2_information *)(hwmgr->pptable); + + vdd_dep_table_on_mclk = table_info->vdd_dep_on_mclk; + +return vdd_dep_table_on_mclk->entries[NUM_UCLK_DPM_LEVELS -1 ].vddInd +1 ; +} +static int vega10_upload_dpm_bootup_level (struct pp_hwmgr *hwmgr) {struct vega10_hwmgr *data = (struct vega10_hwmgr *)(hwmgr->backend); +uint32_t socclk_idx;vega10_apply_dal_minimum_voltage_request (hwmgr);
@@ -3670,13 +3682,22 @@ static int vega10_upload_dpm_bootup_level(struct pp_hwmgr *hwmgr)if (!data->registry_data.mclk_dpm_key_disabled) {if (data->smc_state_table.mem_boot_level != data->dpm_table.mem_table.dpm_state.soft_min_level) { +if (data->smc_state_table.mem_boot_level ==NUM_UCLK_DPM_LEVELS -1 ) { + socclk_idx =vega10_get_soc_index_for_max_uclk (hwmgr);PP_ASSERT_WITH_CODE (!smum_send_msg_to_smc_with_parameter ( - hwmgr->smumgr, - PPSMC_MSG_SetSoftMinUclkByIndex, - data->smc_state_table.mem_boot_level), -"Failed to set soft min mclk index!" , - return -EINVAL ); - + hwmgr->smumgr, + PPSMC_MSG_SetSoftMinSocclkByIndex, + socclk_idx), +"Failed to set soft min uclk index!" , + return -EINVAL ); + }else { +PP_ASSERT_WITH_CODE (!smum_send_msg_to_smc_with_parameter ( + hwmgr->smumgr, + PPSMC_MSG_SetSoftMinUclkByIndex, + data->smc_state_table.mem_boot_level), +"Failed to set soft min uclk index!" , + return -EINVAL ); + } data->dpm_table.mem_table.dpm_state.soft_min_level = data->smc_state_table.mem_boot_level; }
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/3 drm/amd/powerplay: add CZ profile support
In reply to a message not in the archiveFrom: Alex Deucher <[email protected]>
Support the profiling modes for sclk.
v2: delete profileing mode for mclk.
Tested-and-Reviewed-by Rex Zhu <[email protected]>
--- drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c | 66 +++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +64 -2
@@ -1322,33 +1322,95 @@ static int cz_phm_force_dpm_sclk(struct pp_hwmgr *hwmgr, uint32_t sclk)return 0 ; } +static int cz_get_profiling_clk (struct pp_hwmgr *hwmgr,uint32_t *sclk) +{ +struct phm_clock_voltage_dependency_table *table = + hwmgr->dyn_state.vddc_dependency_on_sclk; +int32_t tmp_sclk; +int32_t count; + + tmp_sclk = table->entries[table->count-1 ].clk *70 /100 ; + +for (count = table->count-1 ; count >=0 ; count--) { +if (tmp_sclk >= table->entries[count].clk) { + tmp_sclk = table->entries[count].clk; + *sclk = tmp_sclk; +break ; + } + } +if (count <0 ) + *sclk = table->entries[0 ].clk; + +return 0 ; +} +static int cz_dpm_force_dpm_level (struct pp_hwmgr *hwmgr,enum amd_dpm_forced_level level) { +uint32_t sclk =0 ;int ret =0 ; +uint32_t profile_mode_mask =AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD | +AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK | +AMD_DPM_FORCED_LEVEL_PROFILE_PEAK ; + +if (level == hwmgr->dpm_level) +return ret; + +if (!(hwmgr->dpm_level & profile_mode_mask)) { +/* enter profile mode, save current level, disable gfx cg*/ +if (level & profile_mode_mask) { + hwmgr->saved_dpm_level = hwmgr->dpm_level; +cgs_set_clockgating_state (hwmgr->device, +AMD_IP_BLOCK_TYPE_GFX , +AMD_CG_STATE_UNGATE ); + } + }else { +/* exit profile mode, restore level, enable gfx cg*/ +if (!(level & profile_mode_mask)) { +if (level ==AMD_DPM_FORCED_LEVEL_PROFILE_EXIT ) + level = hwmgr->saved_dpm_level; +cgs_set_clockgating_state (hwmgr->device, +AMD_IP_BLOCK_TYPE_GFX , +AMD_CG_STATE_GATE ); + } + }switch (level) {case AMD_DPM_FORCED_LEVEL_HIGH : +case AMD_DPM_FORCED_LEVEL_PROFILE_PEAK : ret =cz_phm_force_dpm_highest (hwmgr);if (ret)return ret; + hwmgr->dpm_level = level;break ;case AMD_DPM_FORCED_LEVEL_LOW : +case AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK : ret =cz_phm_force_dpm_lowest (hwmgr);if (ret)return ret; + hwmgr->dpm_level = level;break ;case AMD_DPM_FORCED_LEVEL_AUTO : ret =cz_phm_unforce_dpm_levels (hwmgr);if (ret)return ret; + hwmgr->dpm_level = level;break ; +case AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD : + ret =cz_get_profiling_clk (hwmgr, &sclk); +if (ret) +return ret; + hwmgr->dpm_level = level; +cz_phm_force_dpm_sclk (hwmgr, sclk); +break ; +case AMD_DPM_FORCED_LEVEL_MANUAL : + hwmgr->dpm_level = level; +break ; +case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT :default :break ; } - hwmgr->dpm_level = level; -return ret; }
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1501671923-22079-3-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org
Deucher, Alexander
Reviewed-by Alex DeucherRE: [PATCH 3/3] drm/amd/powerplay: add CZ profile support
Quoted 10 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Rex Zhu
Sent: Wednesday, August 02, 2017 7:05 AM
To: [email protected]
Cc: Deucher, Alexander; Zhu, Rex
Subject: [PATCH 3/3] drm/amd/powerplay: add CZ profile supportFrom: Alex Deucher <[email protected]>
Quoted 8 lines
Support the profiling modes for sclk.
v2: delete profileing mode for mclk.
Change-Id I07418e52c37f8b67fd02426ddf4e166eeb091c7dSigned-off-by Alex Deucher <[email protected]>Signed-off-by Rex Zhu <[email protected]>Tested-and-Reviewed-by Rex Zhu <[email protected]>
Series is:
Quoted 116 lines
--- drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c | 66 +++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +24
-0@@ -1322,33 +1322,95 @@ static int cz_phm_force_dpm_sclk(struct pp_hwmgr *hwmgr, uint32_t sclk) return 0; } +static int cz_get_profiling_clk (struct pp_hwmgr *hwmgr,uint32_t *sclk) +{ +struct phm_clock_voltage_dependency_table *table = + hwmgr->dyn_state.vddc_dependency_on_sclk; +int32_t tmp_sclk; +int32_t count; + + tmp_sclk = table->entries[table->count-1 ].clk *70 /100 ; + +for (count = table->count-1 ; count >=0 ; count--) { +if (tmp_sclk >= table->entries[count].clk) { + tmp_sclk = table->entries[count].clk; + *sclk = tmp_sclk; +break ; + } + } +if (count <0 ) + *sclk = table->entries[0 ].clk; + +return 0 ; +} +static int cz_dpm_force_dpm_level (struct pp_hwmgr *hwmgr,enum amd_dpm_forced_level level) { +uint32_t sclk =0 ;int ret =0 ; + uint32_t profile_mode_mask =
AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD|
+
AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK|
+AMD_DPM_FORCED_LEVEL_PROFILE_PEAK;drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +16
-0+ +if (level == hwmgr->dpm_level) +return ret; + +if (!(hwmgr->dpm_level & profile_mode_mask)) { +/* enter profile mode, save current level, disable gfx cg*/ +if (level & profile_mode_mask) { + hwmgr->saved_dpm_level = hwmgr->dpm_level; +cgs_set_clockgating_state (hwmgr->device, +AMD_IP_BLOCK_TYPE_GFX , +AMD_CG_STATE_UNGATE ); + } + }else { +/* exit profile mode, restore level, enable gfx cg*/ +if (!(level & profile_mode_mask)) { + if (level ==
AMD_DPM_FORCED_LEVEL_PROFILE_EXIT)drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +22
-3+ level = hwmgr->saved_dpm_level; +cgs_set_clockgating_state (hwmgr->device, +AMD_IP_BLOCK_TYPE_GFX , +AMD_CG_STATE_GATE ); + } + }switch (level) {case AMD_DPM_FORCED_LEVEL_HIGH : +case AMD_DPM_FORCED_LEVEL_PROFILE_PEAK : ret =cz_phm_force_dpm_highest (hwmgr);if (ret)return ret; + hwmgr->dpm_level = level;break ;case AMD_DPM_FORCED_LEVEL_LOW : +case AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK : ret =cz_phm_force_dpm_lowest (hwmgr);if (ret)return ret; + hwmgr->dpm_level = level;break ;case AMD_DPM_FORCED_LEVEL_AUTO : ret =cz_phm_unforce_dpm_levels (hwmgr);if (ret)return ret; + hwmgr->dpm_level = level;break ; +case AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD : + ret =cz_get_profiling_clk (hwmgr, &sclk); +if (ret) +return ret; + hwmgr->dpm_level = level; +cz_phm_force_dpm_sclk (hwmgr, sclk); +break ; +case AMD_DPM_FORCED_LEVEL_MANUAL : + hwmgr->dpm_level = level; +break ; +case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT :default :break ; } - hwmgr->dpm_level = level; -return ret; } --1.9.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx