drm/amd/powerplay: drop redundant soft min/max settings
Subsystems (2)
PATCH 1/8 drm/amd/powerplay: drop redundant soft min/max settings
As these are already set during apply_clocks_adjust_rules.
--- .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 24 ------------------- 1 file changed, 24 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0 -24
@@ -2314,32 +2314,8 @@ static int vega20_force_dpm_lowest(struct pp_hwmgr *hwmgr)static int vega20_unforce_dpm_levels (struct pp_hwmgr *hwmgr) { -struct vega20_hwmgr *data = - (struct vega20_hwmgr *)(hwmgr->backend); -uint32_t soft_min_level, soft_max_level;int ret =0 ; - soft_min_level =vega20_find_lowest_dpm_level (&(data->dpm_table.gfx_table)); - soft_max_level =vega20_find_highest_dpm_level (&(data->dpm_table.gfx_table)); - data->dpm_table.gfx_table.dpm_state.soft_min_level = - data->dpm_table.gfx_table.dpm_levels[soft_min_level].value; - data->dpm_table.gfx_table.dpm_state.soft_max_level = - data->dpm_table.gfx_table.dpm_levels[soft_max_level].value; - - soft_min_level =vega20_find_lowest_dpm_level (&(data->dpm_table.mem_table)); - soft_max_level =vega20_find_highest_dpm_level (&(data->dpm_table.mem_table)); - data->dpm_table.mem_table.dpm_state.soft_min_level = - data->dpm_table.mem_table.dpm_levels[soft_min_level].value; - data->dpm_table.mem_table.dpm_state.soft_max_level = - data->dpm_table.mem_table.dpm_levels[soft_max_level].value; - - soft_min_level =vega20_find_lowest_dpm_level (&(data->dpm_table.soc_table)); - soft_max_level =vega20_find_highest_dpm_level (&(data->dpm_table.soc_table)); - data->dpm_table.soc_table.dpm_state.soft_min_level = - data->dpm_table.soc_table.dpm_levels[soft_min_level].value; - data->dpm_table.soc_table.dpm_state.soft_max_level = - data->dpm_table.soc_table.dpm_levels[soft_max_level].value; - ret =vega20_upload_dpm_min_level (hwmgr,0xFFFFFFFF ); PP_ASSERT_WITH_CODE(!ret, "Failed to upload DPM Bootup Levels!",
Signature · 6 lines
2.20.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): [email protected]
PATCH 2/8 drm/amd/powerplay: need to reapply the dpm level settings
As these settings got reset during above phm_apply_clock_adjust_rules.
--- drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c +1 -2
@@ -277,8 +277,7 @@ int psm_adjust_power_state_dynamic(struct pp_hwmgr *hwmgr, bool skip_display_setif (!skip_display_settings)phm_notify_smc_display_config_after_ps_adjustment (hwmgr); -if ((hwmgr->request_dpm_level != hwmgr->dpm_level) && - !phm_force_dpm_levels (hwmgr, hwmgr->request_dpm_level)) +if (!phm_force_dpm_levels (hwmgr, hwmgr->request_dpm_level)) hwmgr->dpm_level = hwmgr->request_dpm_level;if (hwmgr->dpm_level !=AMD_DPM_FORCED_LEVEL_MANUAL ) {
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/8 drm/amd/powerplay: force FCLK to highest also for 5K or higher displays
In reply to a message not in the archiveThis can fix possible screen freeze on high resolution displays.
--- .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +37 -1
@@ -3332,6 +3332,31 @@ static int vega20_set_uclk_to_highest_dpm_level(struct pp_hwmgr *hwmgr,return ret; } +static int vega20_set_fclk_to_highest_dpm_level (struct pp_hwmgr *hwmgr) +{ +struct vega20_hwmgr *data = (struct vega20_hwmgr *)(hwmgr->backend); +struct vega20_single_dpm_table *dpm_table = &(data->dpm_table.fclk_table); +int ret =0 ; + +if (data->smu_features[GNLD_DPM_FCLK ].enabled) { +PP_ASSERT_WITH_CODE (dpm_table->count >0 , +"[SetFclkToHightestDpmLevel] Dpm table has no entry!" , + return -EINVAL ); +PP_ASSERT_WITH_CODE (dpm_table->count <=NUM_FCLK_DPM_LEVELS , +"[SetFclkToHightestDpmLevel] Dpm table has too many entries!" , + return -EINVAL ); + + dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[dpm_table->count -1 ].value; +PP_ASSERT_WITH_CODE (!(ret =smum_send_msg_to_smc_with_parameter (hwmgr, + PPSMC_MSG_SetSoftMinByFreq, + (PPCLK_FCLK <<16 ) | dpm_table->dpm_state.soft_min_level)), +"[SetFclkToHightestDpmLevel] Set soft min fclk failed!" , + return ret); + } + +return ret; +} +static int vega20_pre_display_configuration_changed_task (struct pp_hwmgr *hwmgr) {struct vega20_hwmgr *data = (struct vega20_hwmgr *)(hwmgr->backend);
@@ -3342,8 +3367,10 @@ static int vega20_pre_display_configuration_changed_task(struct pp_hwmgr *hwmgr) ret =vega20_set_uclk_to_highest_dpm_level (hwmgr, &data->dpm_table.mem_table); +if (ret) +return ret; -return ret; +return vega20_set_fclk_to_highest_dpm_level (hwmgr); }static int vega20_display_configuration_changed_task (struct pp_hwmgr *hwmgr)
@@ -3502,6 +3529,15 @@ static int vega20_apply_clocks_adjust_rules(struct pp_hwmgr *hwmgr)if (hwmgr->display_config->nb_pstate_switch_disable) dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[dpm_table->count -1 ].value; +/* fclk */ + dpm_table = &(data->dpm_table.fclk_table); + dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0 ].value; + dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count -1 ].value; + dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0 ].value; + dpm_table->dpm_state.hard_max_level = dpm_table->dpm_levels[dpm_table->count -1 ].value; +if (hwmgr->display_config->nb_pstate_switch_disable) + dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[dpm_table->count -1 ].value; +/* vclk */ dpm_table = &(data->dpm_table.vclk_table); dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0 ].value;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/8 drm/amd/powerplay: overwrite ODSettingsMin for UCLK_FMAX feature
In reply to a message not in the archiveFor UCLK_FMAX OD feature, SMU overwrites the highest UCLK DPM level freq. Therefore it can only take values that are greater than the second highest DPM level freq.
--- .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +5 -14
@@ -979,6 +979,8 @@ static int vega20_od8_set_feature_capabilities( }if (data->smu_features[GNLD_DPM_UCLK ].enabled) { + pptable_information->od_settings_min[OD8_SETTING_UCLK_FMAX ] = + data->dpm_table.mem_table.dpm_levels[data->dpm_table.mem_table.count -2 ].value; if (pptable_information->od_feature_capabilities[ATOM_VEGA20_ODFEATURE_UCLK_MAX] && pptable_information->od_settings_min[OD8_SETTING_UCLK_FMAX] > 0 && pptable_information->od_settings_max[OD8_SETTING_UCLK_FMAX] > 0 &&
@@ -2775,7 +2777,6 @@ static int vega20_odn_edit_dpm_table(struct pp_hwmgr *hwmgr, data->od8_settings.od8_settings_array;OverDriveTable_t *od_table = &(data->smc_state_table.overdrive_table); -struct pp_clock_levels_with_latency clocks;int32_t input_index, input_clk, input_vol, i;int od8_id;int ret;
@@ -2834,11 +2835,6 @@ static int vega20_odn_edit_dpm_table(struct pp_hwmgr *hwmgr,return -EOPNOTSUPP ; } - ret =vega20_get_memclocks (hwmgr, &clocks); -PP_ASSERT_WITH_CODE (!ret, -"Attempt to get memory clk levels failed!" , - return ret); -for (i =0 ; i < size; i +=2 ) {if (i +2 > size) { pr_info("invalid number of input parameters %d\n",
@@ -2855,11 +2851,11 @@ static int vega20_odn_edit_dpm_table(struct pp_hwmgr *hwmgr,return -EINVAL ; } -if (input_clk < clocks.data[0 ].clocks_in_khz /1000 || +if (input_clk < od8_settings[OD8_SETTING_UCLK_FMAX ].min_value || input_clk > od8_settings[OD8_SETTING_UCLK_FMAX ].max_value) {pr_info ("clock freq %d is not within allowed range [%d - %d]\n" , input_clk, - clocks.data[0 ].clocks_in_khz /1000 , + od8_settings[OD8_SETTING_UCLK_FMAX ].min_value, od8_settings[OD8_SETTING_UCLK_FMAX ].max_value);return -EINVAL ; }
@@ -3264,13 +3260,8 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr, }if (od8_settings[OD8_SETTING_UCLK_FMAX ].feature_id) { - ret =vega20_get_memclocks (hwmgr, &clocks); -PP_ASSERT_WITH_CODE (!ret, -"Fail to get memory clk levels!" , - return ret); - size +=sprintf (buf + size,"MCLK: %7uMhz %10uMhz\n" , - clocks.data[0 ].clocks_in_khz /1000 , + od8_settings[OD8_SETTING_UCLK_FMAX ].min_value, od8_settings[OD8_SETTING_UCLK_FMAX ].max_value); }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/8 drm/amd/powerplay: support retrieving clock information from other sysplls
In reply to a message not in the archiveThere will be some needs to retrieve clock information from other sysplls also except default 0.
--- .../drm/amd/powerplay/hwmgr/ppatomfwctrl.c | 27 ++++++++++--------- .../drm/amd/powerplay/hwmgr/ppatomfwctrl.h | 3 ++- .../drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 4 +-- 3 files changed, 18 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c +14 -13
@@ -489,15 +489,16 @@ int pp_atomfwctrl_get_gpio_information(struct pp_hwmgr *hwmgr, }int pp_atomfwctrl_get_clk_information_by_clkid (struct pp_hwmgr *hwmgr, -uint8_t id,uint32_t *frequency) +uint8_t clk_id,uint8_t syspll_id, +uint32_t *frequency) {struct amdgpu_device *adev = hwmgr->adev;struct atom_get_smu_clock_info_parameters_v3_1 parameters;struct atom_get_smu_clock_info_output_parameters_v3_1 *output;uint32_t ix; - parameters.clk_id = id; - parameters.syspll_id =0 ; + parameters.clk_id = clk_id; + parameters.syspll_id = syspll_id; parameters.command =GET_SMU_CLOCK_INFO_V3_1_GET_CLOCK_FREQ ; parameters.dfsdid =0 ;
@@ -530,19 +531,19 @@ static void pp_atomfwctrl_copy_vbios_bootup_values_3_2(struct pp_hwmgr *hwmgr, boot_values->ulSocClk =0 ; boot_values->ulDCEFClk =0 ; -if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU11_SYSPLL0_SOCCLK_ID , &frequency)) +if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU11_SYSPLL0_SOCCLK_ID ,SMU11_SYSPLL0_ID , &frequency)) boot_values->ulSocClk = frequency; -if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU11_SYSPLL0_DCEFCLK_ID , &frequency)) +if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU11_SYSPLL0_DCEFCLK_ID ,SMU11_SYSPLL0_ID , &frequency)) boot_values->ulDCEFClk = frequency; -if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU11_SYSPLL0_ECLK_ID , &frequency)) +if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU11_SYSPLL0_ECLK_ID ,SMU11_SYSPLL0_ID , &frequency)) boot_values->ulEClk = frequency; -if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU11_SYSPLL0_VCLK_ID , &frequency)) +if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU11_SYSPLL0_VCLK_ID ,SMU11_SYSPLL0_ID , &frequency)) boot_values->ulVClk = frequency; -if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU11_SYSPLL0_DCLK_ID , &frequency)) +if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU11_SYSPLL0_DCLK_ID ,SMU11_SYSPLL0_ID , &frequency)) boot_values->ulDClk = frequency; }
@@ -563,19 +564,19 @@ static void pp_atomfwctrl_copy_vbios_bootup_values_3_1(struct pp_hwmgr *hwmgr, boot_values->ulSocClk =0 ; boot_values->ulDCEFClk =0 ; -if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU9_SYSPLL0_SOCCLK_ID , &frequency)) +if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU9_SYSPLL0_SOCCLK_ID ,0 , &frequency)) boot_values->ulSocClk = frequency; -if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU9_SYSPLL0_DCEFCLK_ID , &frequency)) +if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU9_SYSPLL0_DCEFCLK_ID ,0 , &frequency)) boot_values->ulDCEFClk = frequency; -if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU9_SYSPLL0_ECLK_ID , &frequency)) +if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU9_SYSPLL0_ECLK_ID ,0 , &frequency)) boot_values->ulEClk = frequency; -if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU9_SYSPLL0_VCLK_ID , &frequency)) +if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU9_SYSPLL0_VCLK_ID ,0 , &frequency)) boot_values->ulVClk = frequency; -if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU9_SYSPLL0_DCLK_ID , &frequency)) +if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU9_SYSPLL0_DCLK_ID ,0 , &frequency)) boot_values->ulDClk = frequency; }
drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.h +2 -1
@@ -236,7 +236,8 @@ int pp_atomfwctrl_get_vbios_bootup_values(struct pp_hwmgr *hwmgr,int pp_atomfwctrl_get_smc_dpm_information (struct pp_hwmgr *hwmgr,struct pp_atomfwctrl_smc_dpm_parameters *param);int pp_atomfwctrl_get_clk_information_by_clkid (struct pp_hwmgr *hwmgr, -uint8_t id,uint32_t *frequency); +uint8_t clk_id,uint8_t syspll_id, +uint32_t *frequency);#endif
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +2 -2
@@ -2575,10 +2575,10 @@ static int vega10_init_smc_table(struct pp_hwmgr *hwmgr) data->vbios_boot_state.gfx_clock = boot_up_values.ulGfxClk; data->vbios_boot_state.mem_clock = boot_up_values.ulUClk;pp_atomfwctrl_get_clk_information_by_clkid (hwmgr, -SMU9_SYSPLL0_SOCCLK_ID , &boot_up_values.ulSocClk); +SMU9_SYSPLL0_SOCCLK_ID ,0 , &boot_up_values.ulSocClk);pp_atomfwctrl_get_clk_information_by_clkid (hwmgr, -SMU9_SYSPLL0_DCEFCLK_ID , &boot_up_values.ulDCEFClk); +SMU9_SYSPLL0_DCEFCLK_ID ,0 , &boot_up_values.ulDCEFClk); data->vbios_boot_state.soc_clock = boot_up_values.ulSocClk; data->vbios_boot_state.dcef_clock = boot_up_values.ulDCEFClk;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/8 drm/amd/powerplay: set default fclk for no fclk dpm support case
In reply to a message not in the archiveSet the default fclk as what we got from VBIOS.
--- drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c | 3 +++ drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.h | 1 + drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 7 +++++-- drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h | 1 + 4 files changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c +3 -0
@@ -545,6 +545,9 @@ static void pp_atomfwctrl_copy_vbios_bootup_values_3_2(struct pp_hwmgr *hwmgr,if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU11_SYSPLL0_DCLK_ID ,SMU11_SYSPLL0_ID , &frequency)) boot_values->ulDClk = frequency; + +if (!pp_atomfwctrl_get_clk_information_by_clkid (hwmgr,SMU11_SYSPLL1_0_FCLK_ID ,SMU11_SYSPLL1_2_ID , &frequency)) + boot_values->ulFClk = frequency; } static void pp_atomfwctrl_copy_vbios_bootup_values_3_1(struct pp_hwmgr *hwmgr,
drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.h +1 -0
@@ -139,6 +139,7 @@ struct pp_atomfwctrl_bios_boot_up_values {uint32_t ulEClk;uint32_t ulVClk;uint32_t ulDClk; +uint32_t ulFClk;uint16_t usVddc;uint16_t usVddci;uint16_t usMvddc;
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +5 -2
@@ -711,8 +711,10 @@ static int vega20_setup_default_dpm_tables(struct pp_hwmgr *hwmgr)PP_ASSERT_WITH_CODE (!ret,"[SetupDefaultDpmTable] failed to get fclk dpm levels!" , return ret); - }else - dpm_table->count =0 ; + }else { + dpm_table->count =1 ; + dpm_table->dpm_levels[0 ].value = data->vbios_boot_state.fclock /100 ; + }vega20_init_dpm_state (&(dpm_table->dpm_state));/* save a copy of the default DPM table */
@@ -754,6 +756,7 @@ static int vega20_init_smc_table(struct pp_hwmgr *hwmgr) data->vbios_boot_state.eclock = boot_up_values.ulEClk; data->vbios_boot_state.vclock = boot_up_values.ulVClk; data->vbios_boot_state.dclock = boot_up_values.ulDClk; + data->vbios_boot_state.fclock = boot_up_values.ulFClk; data->vbios_boot_state.uc_cooling_id = boot_up_values.ucCoolingID; smum_send_msg_to_smc_with_parameter(hwmgr,
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +1 -0
@@ -219,6 +219,7 @@ struct vega20_vbios_boot_state {uint32_t eclock;uint32_t dclock;uint32_t vclock; +uint32_t fclock; };#define DPMTABLE_OD_UPDATE_SCLK 0x00000001
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/8 drm/amd/powerplay: honor the OD settings
In reply to a message not in the archiveSet the soft/hard max settings as max possible to
not violate the OD settings.
--- .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 32 +++++++++---------- .../drm/amd/powerplay/hwmgr/vega20_hwmgr.h | 2 ++ 2 files changed, 18 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +16 -16
@@ -463,9 +463,9 @@ static int vega20_setup_asic_task(struct pp_hwmgr *hwmgr)static void vega20_init_dpm_state (struct vega20_dpm_state *dpm_state) { dpm_state->soft_min_level =0x0 ; - dpm_state->soft_max_level =0xffff ; + dpm_state->soft_max_level =VG20_CLOCK_MAX_DEFAULT ; dpm_state->hard_min_level =0x0 ; - dpm_state->hard_max_level =0xffff ; + dpm_state->hard_max_level =VG20_CLOCK_MAX_DEFAULT ; } static int vega20_get_number_of_dpm_level(struct pp_hwmgr *hwmgr,
@@ -3458,9 +3458,9 @@ static int vega20_apply_clocks_adjust_rules(struct pp_hwmgr *hwmgr)/* gfxclk */ dpm_table = &(data->dpm_table.gfx_table); dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0 ].value; - dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count -1 ].value; + dpm_table->dpm_state.soft_max_level =VG20_CLOCK_MAX_DEFAULT ; dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0 ].value; - dpm_table->dpm_state.hard_max_level = dpm_table->dpm_levels[dpm_table->count -1 ].value; + dpm_table->dpm_state.hard_max_level =VG20_CLOCK_MAX_DEFAULT ;if (PP_CAP (PHM_PlatformCaps_UMDPState)) {if (VEGA20_UMD_PSTATE_GFXCLK_LEVEL < dpm_table->count) {
@@ -3482,9 +3482,9 @@ static int vega20_apply_clocks_adjust_rules(struct pp_hwmgr *hwmgr)/* memclk */ dpm_table = &(data->dpm_table.mem_table); dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0 ].value; - dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count -1 ].value; + dpm_table->dpm_state.soft_max_level =VG20_CLOCK_MAX_DEFAULT ; dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0 ].value; - dpm_table->dpm_state.hard_max_level = dpm_table->dpm_levels[dpm_table->count -1 ].value; + dpm_table->dpm_state.hard_max_level =VG20_CLOCK_MAX_DEFAULT ;if (PP_CAP (PHM_PlatformCaps_UMDPState)) {if (VEGA20_UMD_PSTATE_MCLK_LEVEL < dpm_table->count) {
@@ -3526,18 +3526,18 @@ static int vega20_apply_clocks_adjust_rules(struct pp_hwmgr *hwmgr)/* fclk */ dpm_table = &(data->dpm_table.fclk_table); dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0 ].value; - dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count -1 ].value; + dpm_table->dpm_state.soft_max_level =VG20_CLOCK_MAX_DEFAULT ; dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0 ].value; - dpm_table->dpm_state.hard_max_level = dpm_table->dpm_levels[dpm_table->count -1 ].value; + dpm_table->dpm_state.hard_max_level =VG20_CLOCK_MAX_DEFAULT ;if (hwmgr->display_config->nb_pstate_switch_disable) dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[dpm_table->count -1 ].value;/* vclk */ dpm_table = &(data->dpm_table.vclk_table); dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0 ].value; - dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count -1 ].value; + dpm_table->dpm_state.soft_max_level =VG20_CLOCK_MAX_DEFAULT ; dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0 ].value; - dpm_table->dpm_state.hard_max_level = dpm_table->dpm_levels[dpm_table->count -1 ].value; + dpm_table->dpm_state.hard_max_level =VG20_CLOCK_MAX_DEFAULT ;if (PP_CAP (PHM_PlatformCaps_UMDPState)) {if (VEGA20_UMD_PSTATE_UVDCLK_LEVEL < dpm_table->count) {
@@ -3554,9 +3554,9 @@ static int vega20_apply_clocks_adjust_rules(struct pp_hwmgr *hwmgr)/* dclk */ dpm_table = &(data->dpm_table.dclk_table); dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0 ].value; - dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count -1 ].value; + dpm_table->dpm_state.soft_max_level =VG20_CLOCK_MAX_DEFAULT ; dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0 ].value; - dpm_table->dpm_state.hard_max_level = dpm_table->dpm_levels[dpm_table->count -1 ].value; + dpm_table->dpm_state.hard_max_level =VG20_CLOCK_MAX_DEFAULT ;if (PP_CAP (PHM_PlatformCaps_UMDPState)) {if (VEGA20_UMD_PSTATE_UVDCLK_LEVEL < dpm_table->count) {
@@ -3573,9 +3573,9 @@ static int vega20_apply_clocks_adjust_rules(struct pp_hwmgr *hwmgr)/* socclk */ dpm_table = &(data->dpm_table.soc_table); dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0 ].value; - dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count -1 ].value; + dpm_table->dpm_state.soft_max_level =VG20_CLOCK_MAX_DEFAULT ; dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0 ].value; - dpm_table->dpm_state.hard_max_level = dpm_table->dpm_levels[dpm_table->count -1 ].value; + dpm_table->dpm_state.hard_max_level =VG20_CLOCK_MAX_DEFAULT ;if (PP_CAP (PHM_PlatformCaps_UMDPState)) {if (VEGA20_UMD_PSTATE_SOCCLK_LEVEL < dpm_table->count) {
@@ -3592,9 +3592,9 @@ static int vega20_apply_clocks_adjust_rules(struct pp_hwmgr *hwmgr)/* eclk */ dpm_table = &(data->dpm_table.eclk_table); dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0 ].value; - dpm_table->dpm_state.soft_max_level = dpm_table->dpm_levels[dpm_table->count -1 ].value; + dpm_table->dpm_state.soft_max_level =VG20_CLOCK_MAX_DEFAULT ; dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0 ].value; - dpm_table->dpm_state.hard_max_level = dpm_table->dpm_levels[dpm_table->count -1 ].value; + dpm_table->dpm_state.hard_max_level =VG20_CLOCK_MAX_DEFAULT ;if (PP_CAP (PHM_PlatformCaps_UMDPState)) {if (VEGA20_UMD_PSTATE_VCEMCLK_LEVEL < dpm_table->count) {
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +2 -0
@@ -42,6 +42,8 @@#define AVFS_CURVE 0#define OD8_HOTCURVE_TEMPERATURE 85 +#define VG20_CLOCK_MAX_DEFAULT 0xFFFF +typedef uint32_t PP_Clock ;enum {
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/8 drm/amd/powerplay: show the right override pcie parameters
In reply to a message not in the archiveInstead of the hard-coded ones from VBIOS.
--- .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 46 ++++++++++++------- .../drm/amd/powerplay/hwmgr/vega20_hwmgr.h | 4 ++ 2 files changed, 34 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +30 -16
@@ -783,6 +783,8 @@ static int vega20_init_smc_table(struct pp_hwmgr *hwmgr)static int vega20_override_pcie_parameters (struct pp_hwmgr *hwmgr) {struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend);uint32_t pcie_gen =0 , pcie_width =0 , smu_pcie_arg;int ret;
@@ -819,6 +821,10 @@ static int vega20_override_pcie_parameters(struct pp_hwmgr *hwmgr)"[OverridePcieParameters] Attempt to override pcie params failed!" , return ret); + data->pcie_parameters_override =1 ; + data->pcie_gen_level1 = pcie_gen; + data->pcie_width_level1 = pcie_width; +return 0 ; }
@@ -3103,7 +3109,7 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr, &(data->dpm_table.fclk_table);int i, now, size =0 ;int ret =0 ; -uint32_t gen_speed, lane_width; +uint32_t gen_speed, lane_width, current_gen_speed, current_lane_width;switch (type) {case PP_SCLK :
@@ -3187,28 +3193,36 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr,break ;case PP_PCIE : - gen_speed = (RREG32_PCIE (smnPCIE_LC_SPEED_CNTL) & + current_gen_speed = (RREG32_PCIE (smnPCIE_LC_SPEED_CNTL) &PSWUSP0_PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE_MASK ) >>PSWUSP0_PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE__SHIFT ; - lane_width = (RREG32_PCIE (smnPCIE_LC_LINK_WIDTH_CNTL) & + current_lane_width = (RREG32_PCIE (smnPCIE_LC_LINK_WIDTH_CNTL) &PCIE_LC_LINK_WIDTH_CNTL__LC_LINK_WIDTH_RD_MASK ) >>PCIE_LC_LINK_WIDTH_CNTL__LC_LINK_WIDTH_RD__SHIFT ; -for (i =0 ; i <NUM_LINK_LEVELS ; i++) +for (i =0 ; i <NUM_LINK_LEVELS ; i++) { +if (i ==1 && data->pcie_parameters_override) { + gen_speed = data->pcie_gen_level1; + lane_width = data->pcie_width_level1; + }else { + gen_speed = pptable->PcieGenSpeed[i]; + lane_width = pptable->PcieLaneCount[i]; + } size +=sprintf (buf + size,"%d: %s %s %dMhz %s\n" , i, - (pptable->PcieGenSpeed[i] ==0 ) ?"2.5GT/s," : - (pptable->PcieGenSpeed[i] ==1 ) ?"5.0GT/s," : - (pptable->PcieGenSpeed[i] ==2 ) ?"8.0GT/s," : - (pptable->PcieGenSpeed[i] ==3 ) ?"16.0GT/s," :"" , - (pptable->PcieLaneCount[i] ==1 ) ?"x1" : - (pptable->PcieLaneCount[i] ==2 ) ?"x2" : - (pptable->PcieLaneCount[i] ==3 ) ?"x4" : - (pptable->PcieLaneCount[i] ==4 ) ?"x8" : - (pptable->PcieLaneCount[i] ==5 ) ?"x12" : - (pptable->PcieLaneCount[i] ==6 ) ?"x16" :"" , + (gen_speed ==0 ) ?"2.5GT/s," : + (gen_speed ==1 ) ?"5.0GT/s," : + (gen_speed ==2 ) ?"8.0GT/s," : + (gen_speed ==3 ) ?"16.0GT/s," :"" , + (lane_width ==1 ) ?"x1" : + (lane_width ==2 ) ?"x2" : + (lane_width ==3 ) ?"x4" : + (lane_width ==4 ) ?"x8" : + (lane_width ==5 ) ?"x12" : + (lane_width ==6 ) ?"x16" :"" , pptable->LclkFreq[i], - (gen_speed == pptable->PcieGenSpeed[i]) && - (lane_width == pptable->PcieLaneCount[i]) ? + (current_gen_speed == gen_speed) && + (current_lane_width == lane_width) ?"*" :"" ); + }break ;case OD_SCLK :
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +4 -0
@@ -526,6 +526,10 @@ struct vega20_hwmgr {unsigned long metrics_time;SmuMetrics_t metrics_table; + +bool pcie_parameters_override; +uint32_t pcie_gen_level1; +uint32_t pcie_width_level1; };#define VEGA20_DPM2_NEAR_TDP_DEC 10
Signature · 6 lines
2.20.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): [email protected]
Alex Deucher
Acked-byRe: [PATCH 8/8] drm/amd/powerplay: show the right override pcie parameters
Series is:
Quoted 113 lines · Evan Quan
Instead of the hard-coded ones from VBIOS.
Change-Id Ic317e292fbea89f01badfcfe240134aabcbe84ecSigned-off-by Evan Quan <[email protected]>--- .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 46 ++++++++++++------- .../drm/amd/powerplay/hwmgr/vega20_hwmgr.h | 4 ++ 2 files changed, 34 insertions(+), 16 deletions(-)drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +30
-16@@ -783,6 +783,8 @@ static int vega20_init_smc_table(struct pp_hwmgr *hwmgr)static int vega20_override_pcie_parameters (struct pp_hwmgr *hwmgr) {struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); +struct vega20_hwmgr *data = + (struct vega20_hwmgr *)(hwmgr->backend);uint32_t pcie_gen =0 , pcie_width =0 , smu_pcie_arg;int ret;@@ -819,6 +821,10 @@ static int vega20_override_pcie_parameters(struct pp_hwmgr *hwmgr)"[OverridePcieParameters] Attempt to override pcie params failed!" , return ret); + data->pcie_parameters_override =1 ; + data->pcie_gen_level1 = pcie_gen; + data->pcie_width_level1 = pcie_width; +return 0 ; }@@ -3103,7 +3109,7 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr, &(data->dpm_table.fclk_table);int i, now, size =0 ;int ret =0 ; -uint32_t gen_speed, lane_width; +uint32_t gen_speed, lane_width, current_gen_speed, current_lane_width;switch (type) {case PP_SCLK :@@ -3187,28 +3193,36 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr,break ;case PP_PCIE : - gen_speed = (RREG32_PCIE (smnPCIE_LC_SPEED_CNTL) & + current_gen_speed = (RREG32_PCIE (smnPCIE_LC_SPEED_CNTL) &PSWUSP0_PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE_MASK ) >>PSWUSP0_PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE__SHIFT ; - lane_width = (RREG32_PCIE (smnPCIE_LC_LINK_WIDTH_CNTL) & + current_lane_width = (RREG32_PCIE (smnPCIE_LC_LINK_WIDTH_CNTL) &PCIE_LC_LINK_WIDTH_CNTL__LC_LINK_WIDTH_RD_MASK ) >>PCIE_LC_LINK_WIDTH_CNTL__LC_LINK_WIDTH_RD__SHIFT ; -for (i =0 ; i <NUM_LINK_LEVELS ; i++) +for (i =0 ; i <NUM_LINK_LEVELS ; i++) { +if (i ==1 && data->pcie_parameters_override) { + gen_speed = data->pcie_gen_level1; + lane_width = data->pcie_width_level1; + }else { + gen_speed = pptable->PcieGenSpeed[i]; + lane_width = pptable->PcieLaneCount[i]; + } size +=sprintf (buf + size,"%d: %s %s %dMhz %s\n" , i, - (pptable->PcieGenSpeed[i] ==0 ) ?"2.5GT/s," : - (pptable->PcieGenSpeed[i] ==1 ) ?"5.0GT/s," : - (pptable->PcieGenSpeed[i] ==2 ) ?"8.0GT/s," : - (pptable->PcieGenSpeed[i] ==3 ) ?"16.0GT/s," :"" , - (pptable->PcieLaneCount[i] ==1 ) ?"x1" : - (pptable->PcieLaneCount[i] ==2 ) ?"x2" : - (pptable->PcieLaneCount[i] ==3 ) ?"x4" : - (pptable->PcieLaneCount[i] ==4 ) ?"x8" : - (pptable->PcieLaneCount[i] ==5 ) ?"x12" : - (pptable->PcieLaneCount[i] ==6 ) ?"x16" :"" , + (gen_speed ==0 ) ?"2.5GT/s," : + (gen_speed ==1 ) ?"5.0GT/s," : + (gen_speed ==2 ) ?"8.0GT/s," : + (gen_speed ==3 ) ?"16.0GT/s," :"" , + (lane_width ==1 ) ?"x1" : + (lane_width ==2 ) ?"x2" : + (lane_width ==3 ) ?"x4" : + (lane_width ==4 ) ?"x8" : + (lane_width ==5 ) ?"x12" : + (lane_width ==6 ) ?"x16" :"" , pptable->LclkFreq[i], - (gen_speed == pptable->PcieGenSpeed[i]) && - (lane_width == pptable->PcieLaneCount[i]) ? + (current_gen_speed == gen_speed) && + (current_lane_width == lane_width) ?"*" :"" ); + }break ;case OD_SCLK :drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +4
-1@@ -526,6 +526,10 @@ struct vega20_hwmgr {unsigned long metrics_time;SmuMetrics_t metrics_table; + +bool pcie_parameters_override; +uint32_t pcie_gen_level1; +uint32_t pcie_width_level1; };#define VEGA20_DPM2_NEAR_TDP_DEC 10 --2.20.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