drm/amd/pm: enable GPO dynamic control support for SMU13.0.0
PATCH 1/10 drm/amd/pm: enable GPO dynamic control support for SMU13.0.0
To better support UMD pstate profilings, the GPO feature needs to be switched on/off accordingly.
--- drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h | 3 ++- drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h | 3 +++ drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 15 +++++++++++++++ .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 2 ++ 4 files changed, 22 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +2 -1
@@ -241,7 +241,8 @@__SMU_DUMMY_MAP (GetGfxOffEntryCount), \__SMU_DUMMY_MAP (LogGfxOffResidency), \__SMU_DUMMY_MAP (SetNumBadMemoryPagesRetired), \ -__SMU_DUMMY_MAP (SetBadMemoryPagesRetiredFlagsPerChannel), +__SMU_DUMMY_MAP (SetBadMemoryPagesRetiredFlagsPerChannel), \ +__SMU_DUMMY_MAP (AllowGpo), #undef __SMU_DUMMY_MAP#define __SMU_DUMMY_MAP (type) SMU_MSG_##type
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h +3 -0
@@ -273,6 +273,9 @@ int smu_v13_0_init_pptable_microcode(struct smu_context *smu);int smu_v13_0_run_btc (struct smu_context *smu); +int smu_v13_0_gpo_control (struct smu_context *smu, +bool enablement); +int smu_v13_0_deep_sleep_control (struct smu_context *smu,bool enablement);
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +15 -0
@@ -2180,6 +2180,21 @@ int smu_v13_0_run_btc(struct smu_context *smu)return res; } +int smu_v13_0_gpo_control (struct smu_context *smu, +bool enablement) +{ +int res; + + res =smu_cmn_send_smc_msg_with_param (smu, + SMU_MSG_AllowGpo, + enablement ?1 :0 , +NULL ); +if (res) +dev_err (smu->adev->dev,"SetGpoAllow %d failed!\n" , enablement); + +return res; +} +int smu_v13_0_deep_sleep_control (struct smu_context *smu,bool enablement) {
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +2 -0
@@ -144,6 +144,7 @@ static struct cmn2asic_msg_mapping smu_v13_0_0_message_map[SMU_MSG_MAX_COUNT] =MSG_MAP (SetNumBadMemoryPagesRetired, PPSMC_MSG_SetNumBadMemoryPagesRetired,0 ),MSG_MAP (SetBadMemoryPagesRetiredFlagsPerChannel, PPSMC_MSG_SetBadMemoryPagesRetiredFlagsPerChannel,0 ), + MSG_MAP(AllowGpo, PPSMC_MSG_SetGpoAllow, 0), }; static struct cmn2asic_mapping smu_v13_0_0_clk_map[SMU_CLK_COUNT] = {
@@ -1948,6 +1949,7 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = { .set_df_cstate = smu_v13_0_0_set_df_cstate, .send_hbm_bad_pages_num = smu_v13_0_0_smu_send_bad_mem_page_num, .send_hbm_bad_channel_flag = smu_v13_0_0_send_bad_mem_channel_flag, + .gpo_control = smu_v13_0_gpo_control, };void smu_v13_0_0_set_ppt_funcs (struct smu_context *smu)
Signature · 1 line
2.34.1
PATCH 2/10 drm/amd/pm: enable GPO dynamic control support for SMU13.0.7
To better support UMD pstate profilings, the GPO feature needs to be switched on/off accordingly.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +2 -0
@@ -123,6 +123,7 @@ static struct cmn2asic_msg_mapping smu_v13_0_7_message_map[SMU_MSG_MAX_COUNT] =MSG_MAP (SetMGpuFanBoostLimitRpm, PPSMC_MSG_SetMGpuFanBoostLimitRpm,0 ),MSG_MAP (DFCstateControl, PPSMC_MSG_SetExternalClientDfCstateAllow,0 ),MSG_MAP (ArmD3, PPSMC_MSG_ArmD3,0 ), + MSG_MAP(AllowGpo, PPSMC_MSG_SetGpoAllow, 0), }; static struct cmn2asic_mapping smu_v13_0_7_clk_map[SMU_CLK_COUNT] = {
@@ -1689,6 +1690,7 @@ static const struct pptable_funcs smu_v13_0_7_ppt_funcs = { .mode1_reset = smu_v13_0_mode1_reset, .set_mp1_state = smu_v13_0_7_set_mp1_state, .set_df_cstate = smu_v13_0_7_set_df_cstate, + .gpo_control = smu_v13_0_gpo_control, };void smu_v13_0_7_set_ppt_funcs (struct smu_context *smu)
Signature · 1 line
2.34.1
PATCH 3/10 drm/amd/pm: correct SMU13.0.0 pstate profiling clock settings
In reply to Evan QuanCorrect the pstate standard/peak profiling mode clock settings for SMU13.0.0.
--- .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +15 -7
@@ -1305,9 +1305,17 @@ static int smu_v13_0_0_populate_umd_state_clk(struct smu_context *smu) &dpm_context->dpm_tables.fclk_table;struct smu_umd_pstate_table *pstate_table = &smu->pstate_table; +struct smu_table_context *table_context = &smu->smu_table; +PPTable_t *pptable = table_context->driver_pptable; +DriverReportedClocks_t driver_clocks = + pptable->SkuTable.DriverReportedClocks; pstate_table->gfxclk_pstate.min = gfx_table->min; - pstate_table->gfxclk_pstate.peak = gfx_table->max; +if (driver_clocks.GameClockAc && + (driver_clocks.GameClockAc < gfx_table->max)) + pstate_table->gfxclk_pstate.peak = driver_clocks.GameClockAc; +else + pstate_table->gfxclk_pstate.peak = gfx_table->max; pstate_table->uclk_pstate.min = mem_table->min; pstate_table->uclk_pstate.peak = mem_table->max;
@@ -1324,12 +1332,12 @@ static int smu_v13_0_0_populate_umd_state_clk(struct smu_context *smu) pstate_table->fclk_pstate.min = fclk_table->min; pstate_table->fclk_pstate.peak = fclk_table->max; -/* -* For now, just use the mininum clock frequency. -* TODO: update them when the real pstate settings available -*/ - pstate_table->gfxclk_pstate.standard = gfx_table->min; - pstate_table->uclk_pstate.standard = mem_table->min; +if (driver_clocks.BaseClockAc && + driver_clocks.BaseClockAc < gfx_table->max) + pstate_table->gfxclk_pstate.standard = driver_clocks.BaseClockAc; +else + pstate_table->gfxclk_pstate.standard = gfx_table->max; + pstate_table->uclk_pstate.standard = mem_table->max; pstate_table->socclk_pstate.standard = soc_table->min; pstate_table->vclk_pstate.standard = vclk_table->min; pstate_table->dclk_pstate.standard = dclk_table->min;
Signature · 1 line
2.34.1
PATCH 4/10 drm/amd/pm: drop unused SMU v13 API
In reply to Evan QuanThe API is not in use. And it's unlikely to be used in the future either.
--- drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h | 5 --- .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 39 ------------------- 2 files changed, 44 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h +0 -5
@@ -244,11 +244,6 @@ int smu_v13_0_set_single_dpm_table(struct smu_context *smu,enum smu_clk_type clk_type, struct smu_13_0_dpm_table *single_dpm_table); -int smu_v13_0_get_dpm_level_range (struct smu_context *smu, -enum smu_clk_type clk_type, -uint32_t *min_value, -uint32_t *max_value); -int smu_v13_0_get_current_pcie_link_width_level (struct smu_context *smu);int smu_v13_0_get_current_pcie_link_width (struct smu_context *smu);
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -39
@@ -2062,45 +2062,6 @@ int smu_v13_0_set_single_dpm_table(struct smu_context *smu,return 0 ; } -int smu_v13_0_get_dpm_level_range (struct smu_context *smu, -enum smu_clk_type clk_type, -uint32_t *min_value, -uint32_t *max_value) -{ -uint32_t level_count =0 ; -int ret =0 ; - -if (!min_value && !max_value) -return -EINVAL ; - -if (min_value) { -/* by default, level 0 clock value as min value */ - ret =smu_v13_0_get_dpm_freq_by_index (smu, - clk_type, -0 , - min_value); -if (ret) -return ret; - } - -if (max_value) { - ret =smu_v13_0_get_dpm_level_count (smu, - clk_type, - &level_count); -if (ret) -return ret; - - ret =smu_v13_0_get_dpm_freq_by_index (smu, - clk_type, - level_count -1 , - max_value); -if (ret) -return ret; - } - -return ret; -} -int smu_v13_0_get_current_pcie_link_width_level (struct smu_context *smu) {struct amdgpu_device *adev = smu->adev;
Signature · 1 line
2.34.1
PATCH 5/10 drm/amd/pm: fulfill swsmu peak profiling mode shader/memory clock settings
In reply to Evan QuanEnable peak profiling mode shader/memory clocks reporting for swsmu framework.
--- drivers/gpu/drm/amd/include/kgd_pp_interface.h | 2 ++ drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 8 ++++++++ 2 files changed, 10 insertions(+)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 -0
@@ -139,6 +139,8 @@ enum amd_pp_sensors {AMDGPU_PP_SENSOR_MIN_FAN_RPM ,AMDGPU_PP_SENSOR_MAX_FAN_RPM ,AMDGPU_PP_SENSOR_VCN_POWER_STATE , +AMDGPU_PP_SENSOR_PEAK_PSTATE_SCLK , + AMDGPU_PP_SENSOR_PEAK_PSTATE_MCLK, }; enum amd_pp_task {
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +8 -0
@@ -2473,6 +2473,14 @@ static int smu_read_sensor(void *handle, *((uint32_t *)data) = pstate_table->uclk_pstate.standard *100 ; *size =4 ;break ; +case AMDGPU_PP_SENSOR_PEAK_PSTATE_SCLK : + *((uint32_t *)data) = pstate_table->gfxclk_pstate.peak *100 ; + *size =4 ; +break ; +case AMDGPU_PP_SENSOR_PEAK_PSTATE_MCLK : + *((uint32_t *)data) = pstate_table->uclk_pstate.peak *100 ; + *size =4 ; +break ;case AMDGPU_PP_SENSOR_ENABLED_SMC_FEATURES_MASK : ret =smu_feature_get_enabled_mask (smu, (uint64_t *)data); *size =8 ;
Signature · 1 line
2.34.1
PATCH 6/10 drm/amd/pm: fulfill powerplay peak profiling mode shader/memory clock settings
In reply to Evan QuanEnable peak profiling mode shader/memory clock reporting for powerplay framework.
--- .../gpu/drm/amd/pm/powerplay/amd_powerplay.c | 10 ++- .../drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 16 +++- .../drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 76 +++++++++++++++---- .../drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c | 16 +++- .../drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 31 ++++++-- .../drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c | 22 ++++++ .../drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c | 20 ++--- drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h | 2 + 8 files changed, 155 insertions(+), 38 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +8 -2
@@ -769,10 +769,16 @@ static int pp_dpm_read_sensor(void *handle, int idx,switch (idx) {case AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK : - *((uint32_t *)value) = hwmgr->pstate_sclk; + *((uint32_t *)value) = hwmgr->pstate_sclk *100 ;return 0 ;case AMDGPU_PP_SENSOR_STABLE_PSTATE_MCLK : - *((uint32_t *)value) = hwmgr->pstate_mclk; + *((uint32_t *)value) = hwmgr->pstate_mclk *100 ; +return 0 ; +case AMDGPU_PP_SENSOR_PEAK_PSTATE_SCLK : + *((uint32_t *)value) = hwmgr->pstate_sclk_peak *100 ; +return 0 ; +case AMDGPU_PP_SENSOR_PEAK_PSTATE_MCLK : + *((uint32_t *)value) = hwmgr->pstate_mclk_peak *100 ;return 0 ;case AMDGPU_PP_SENSOR_MIN_FAN_RPM : *((uint32_t *)value) = hwmgr->thermal_controller.fanInfo.ulMinRPM;
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +13 -3
@@ -375,6 +375,17 @@ static int smu10_enable_gfx_off(struct pp_hwmgr *hwmgr)return 0 ; } +static void smu10_populate_umdpstate_clocks (struct pp_hwmgr *hwmgr) +{ + hwmgr->pstate_sclk =SMU10_UMD_PSTATE_GFXCLK ; + hwmgr->pstate_mclk =SMU10_UMD_PSTATE_FCLK ; + +smum_send_msg_to_smc (hwmgr, + PPSMC_MSG_GetMaxGfxclkFrequency, + &hwmgr->pstate_sclk_peak); + hwmgr->pstate_mclk_peak =SMU10_UMD_PSTATE_PEAK_FCLK ; +} +static int smu10_enable_dpm_tasks (struct pp_hwmgr *hwmgr) {struct amdgpu_device *adev = hwmgr->adev;
@@ -398,6 +409,8 @@ static int smu10_enable_dpm_tasks(struct pp_hwmgr *hwmgr)return ret; } +smu10_populate_umdpstate_clocks (hwmgr); +return 0 ; }
@@ -574,9 +587,6 @@ static int smu10_hwmgr_backend_init(struct pp_hwmgr *hwmgr) hwmgr->platform_descriptor.minimumClocksReductionPercentage =50 ; - hwmgr->pstate_sclk =SMU10_UMD_PSTATE_GFXCLK *100 ; - hwmgr->pstate_mclk =SMU10_UMD_PSTATE_FCLK *100 ; -/* enable the pp_od_clk_voltage sysfs file */ hwmgr->od_enabled =1 ;/* disabled fine grain tuning function by default */
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +63 -13
122 lines not on this page · raw message
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c +14 -2
@@ -1016,6 +1016,18 @@ static void smu8_reset_acp_boot_level(struct pp_hwmgr *hwmgr) data->acp_boot_level =0xff ; } +static void smu8_populate_umdpstate_clocks (struct pp_hwmgr *hwmgr) +{ +struct phm_clock_voltage_dependency_table *table = + hwmgr->dyn_state.vddc_dependency_on_sclk; + + hwmgr->pstate_sclk = table->entries[0 ].clk /100 ; + hwmgr->pstate_mclk =0 ; + + hwmgr->pstate_sclk_peak = table->entries[table->count -1 ].clk /100 ; + hwmgr->pstate_mclk_peak =0 ; +} +static int smu8_enable_dpm_tasks (struct pp_hwmgr *hwmgr) {smu8_program_voting_clients (hwmgr);
@@ -1024,6 +1036,8 @@ static int smu8_enable_dpm_tasks(struct pp_hwmgr *hwmgr)smu8_program_bootup_state (hwmgr);smu8_reset_acp_boot_level (hwmgr); +smu8_populate_umdpstate_clocks (hwmgr); +return 0 ; }
@@ -1167,8 +1181,6 @@ static int smu8_phm_unforce_dpm_levels(struct pp_hwmgr *hwmgr) data->sclk_dpm.soft_min_clk = table->entries[0 ].clk; data->sclk_dpm.hard_min_clk = table->entries[0 ].clk; - hwmgr->pstate_sclk = table->entries[0 ].clk; - hwmgr->pstate_mclk =0 ; level =smu8_get_max_sclk_level (hwmgr) -1 ;
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c +26 -5
@@ -3008,6 +3008,30 @@ static int vega10_enable_disable_PCC_limit_feature(struct pp_hwmgr *hwmgr, boolreturn 0 ; } +static void vega10_populate_umdpstate_clocks (struct pp_hwmgr *hwmgr) +{ +struct phm_ppt_v2_information *table_info = + (struct phm_ppt_v2_information *)(hwmgr->pptable); + +if (table_info->vdd_dep_on_sclk->count >VEGA10_UMD_PSTATE_GFXCLK_LEVEL && + table_info->vdd_dep_on_mclk->count >VEGA10_UMD_PSTATE_MCLK_LEVEL ) { + hwmgr->pstate_sclk = table_info->vdd_dep_on_sclk->entries[VEGA10_UMD_PSTATE_GFXCLK_LEVEL ].clk; + hwmgr->pstate_mclk = table_info->vdd_dep_on_mclk->entries[VEGA10_UMD_PSTATE_MCLK_LEVEL ].clk; + }else { + hwmgr->pstate_sclk = table_info->vdd_dep_on_sclk->entries[0 ].clk; + hwmgr->pstate_mclk = table_info->vdd_dep_on_mclk->entries[0 ].clk; + } + + hwmgr->pstate_sclk_peak = table_info->vdd_dep_on_sclk->entries[table_info->vdd_dep_on_sclk->count -1 ].clk; + hwmgr->pstate_mclk_peak = table_info->vdd_dep_on_mclk->entries[table_info->vdd_dep_on_mclk->count -1 ].clk; + +/* make sure the output is in Mhz */ + hwmgr->pstate_sclk /=100 ; + hwmgr->pstate_mclk /=100 ; + hwmgr->pstate_sclk_peak /=100 ; + hwmgr->pstate_mclk_peak /=100 ; +} +static int vega10_enable_dpm_tasks (struct pp_hwmgr *hwmgr) {struct vega10_hwmgr *data = hwmgr->backend;
@@ -3082,6 +3106,8 @@ static int vega10_enable_dpm_tasks(struct pp_hwmgr *hwmgr) result = tmp_result); } +vega10_populate_umdpstate_clocks (hwmgr); +return result; }
@@ -4169,8 +4195,6 @@ static int vega10_get_profiling_clk_mask(struct pp_hwmgr *hwmgr, enum amd_dpm_fo *sclk_mask =VEGA10_UMD_PSTATE_GFXCLK_LEVEL ; *soc_mask =VEGA10_UMD_PSTATE_SOCCLK_LEVEL ; *mclk_mask =VEGA10_UMD_PSTATE_MCLK_LEVEL ; - hwmgr->pstate_sclk = table_info->vdd_dep_on_sclk->entries[VEGA10_UMD_PSTATE_GFXCLK_LEVEL ].clk; - hwmgr->pstate_mclk = table_info->vdd_dep_on_mclk->entries[VEGA10_UMD_PSTATE_MCLK_LEVEL ].clk; }if (level ==AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK ) {
@@ -4281,9 +4305,6 @@ static int vega10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,uint32_t mclk_mask =0 ;uint32_t soc_mask =0 ; -if (hwmgr->pstate_sclk ==0 ) -vega10_get_profiling_clk_mask (hwmgr, level, &sclk_mask, &mclk_mask, &soc_mask); -switch (level) {case AMD_DPM_FORCED_LEVEL_HIGH : ret =vega10_force_dpm_highest (hwmgr);
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c +22 -0
@@ -1026,6 +1026,25 @@ static int vega12_get_all_clock_ranges(struct pp_hwmgr *hwmgr)return 0 ; } +static void vega12_populate_umdpstate_clocks (struct pp_hwmgr *hwmgr) +{ +struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend); +struct vega12_single_dpm_table *gfx_dpm_table = &(data->dpm_table.gfx_table); +struct vega12_single_dpm_table *mem_dpm_table = &(data->dpm_table.mem_table); + +if (gfx_dpm_table->count >VEGA12_UMD_PSTATE_GFXCLK_LEVEL && + mem_dpm_table->count >VEGA12_UMD_PSTATE_MCLK_LEVEL ) { + hwmgr->pstate_sclk = gfx_dpm_table->dpm_levels[VEGA12_UMD_PSTATE_GFXCLK_LEVEL ].value; + hwmgr->pstate_mclk = mem_dpm_table->dpm_levels[VEGA12_UMD_PSTATE_MCLK_LEVEL ].value; + }else { + hwmgr->pstate_sclk = gfx_dpm_table->dpm_levels[0 ].value; + hwmgr->pstate_mclk = mem_dpm_table->dpm_levels[0 ].value; + } + + hwmgr->pstate_sclk_peak = gfx_dpm_table->dpm_levels[gfx_dpm_table->count].value; + hwmgr->pstate_mclk_peak = mem_dpm_table->dpm_levels[mem_dpm_table->count].value; +} +static int vega12_enable_dpm_tasks (struct pp_hwmgr *hwmgr) {int tmp_result, result =0 ;
@@ -1077,6 +1096,9 @@ static int vega12_enable_dpm_tasks(struct pp_hwmgr *hwmgr)PP_ASSERT_WITH_CODE (!result,"Failed to setup default DPM tables!" , return result); + +vega12_populate_umdpstate_clocks (hwmgr); +return result; }
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c +7 -13
@@ -1555,26 +1555,23 @@ static int vega20_set_mclk_od(return 0 ; } -static int vega20_populate_umdpstate_clocks ( -struct pp_hwmgr *hwmgr) +static void vega20_populate_umdpstate_clocks (struct pp_hwmgr *hwmgr) {struct vega20_hwmgr *data = (struct vega20_hwmgr *)(hwmgr->backend);struct vega20_single_dpm_table *gfx_table = &(data->dpm_table.gfx_table);struct vega20_single_dpm_table *mem_table = &(data->dpm_table.mem_table); - hwmgr->pstate_sclk = gfx_table->dpm_levels[0 ].value; - hwmgr->pstate_mclk = mem_table->dpm_levels[0 ].value; -if (gfx_table->count >VEGA20_UMD_PSTATE_GFXCLK_LEVEL && mem_table->count >VEGA20_UMD_PSTATE_MCLK_LEVEL ) { hwmgr->pstate_sclk = gfx_table->dpm_levels[VEGA20_UMD_PSTATE_GFXCLK_LEVEL ].value; hwmgr->pstate_mclk = mem_table->dpm_levels[VEGA20_UMD_PSTATE_MCLK_LEVEL ].value; + }else { + hwmgr->pstate_sclk = gfx_table->dpm_levels[0 ].value; + hwmgr->pstate_mclk = mem_table->dpm_levels[0 ].value; } - hwmgr->pstate_sclk = hwmgr->pstate_sclk *100 ; - hwmgr->pstate_mclk = hwmgr->pstate_mclk *100 ; - -return 0 ; + hwmgr->pstate_sclk_peak = gfx_table->dpm_levels[gfx_table->count -1 ].value; + hwmgr->pstate_mclk_peak = mem_table->dpm_levels[mem_table->count -1 ].value; } static int vega20_get_max_sustainable_clock(struct pp_hwmgr *hwmgr,
@@ -1753,10 +1750,7 @@ static int vega20_enable_dpm_tasks(struct pp_hwmgr *hwmgr)"[EnableDPMTasks] Failed to initialize odn settings!" , return result); - result =vega20_populate_umdpstate_clocks (hwmgr); -PP_ASSERT_WITH_CODE (!result, -"[EnableDPMTasks] Failed to populate umdpstate clocks!" , - return result); +vega20_populate_umdpstate_clocks (hwmgr); result =smum_send_msg_to_smc_with_parameter (hwmgr, PPSMC_MSG_GetPptLimit,POWER_SOURCE_AC <<16 , &hwmgr->default_power_limit);
drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h +2 -0
@@ -809,6 +809,8 @@ struct pp_hwmgr {uint32_t workload_prority[Workload_Policy_Max];uint32_t workload_setting[Workload_Policy_Max];bool gfxoff_state_changed_by_workload; +uint32_t pstate_sclk_peak; +uint32_t pstate_mclk_peak; };int hwmgr_early_init (struct pp_hwmgr *hwmgr);
Signature · 1 line
2.34.1
PATCH 7/10 drm/amdgpu: expose peak profiling mode shader/memory clocks
In reply to Evan QuanExpose those informations to UMD who need them as for standard profiling mode.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 18 ++++++++++++++++++ include/uapi/drm/amdgpu_drm.h | 4 ++++ 2 files changed, 22 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +18 -0
@@ -1052,6 +1052,24 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) } ui32 /=100 ;break ; +case AMDGPU_INFO_SENSOR_PEAK_PSTATE_GFX_SCLK : +/* get peak pstate sclk in Mhz */ +if (amdgpu_dpm_read_sensor (adev, +AMDGPU_PP_SENSOR_PEAK_PSTATE_SCLK , + (void *)&ui32, &ui32_size)) { +return -EINVAL ; + } + ui32 /=100 ; +break ; +case AMDGPU_INFO_SENSOR_PEAK_PSTATE_GFX_MCLK : +/* get peak pstate mclk in Mhz */ +if (amdgpu_dpm_read_sensor (adev, +AMDGPU_PP_SENSOR_PEAK_PSTATE_MCLK , + (void *)&ui32, &ui32_size)) { +return -EINVAL ; + } + ui32 /=100 ; +break ;default :DRM_DEBUG_KMS ("Invalid request %d\n" , info->sensor_info.type);
include/uapi/drm/amdgpu_drm.h +4 -0
@@ -893,6 +893,10 @@ struct drm_amdgpu_cs_chunk_data {#define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_SCLK 0x8/* Subquery id: Query GPU stable pstate memory clock */ #define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_MCLK 0x9 +/* Subquery id: Query GPU peak pstate shader clock */ +#define AMDGPU_INFO_SENSOR_PEAK_PSTATE_GFX_SCLK 0xa +/* Subquery id: Query GPU peak pstate memory clock */ +#define AMDGPU_INFO_SENSOR_PEAK_PSTATE_GFX_MCLK 0xb/* Number of VRAM page faults on CPU access. */ #define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS 0x1E#define AMDGPU_INFO_VRAM_LOST_COUNTER 0x1F
Signature · 1 line
2.34.1
PATCH 8/10 drm/amdgpu: expose the minimum shader/memory clock frequency
In reply to Evan QuanOtherwise, some UMD tools will treate them as 0 at default while actually they are not.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 10 ++++++++-- include/uapi/drm/amdgpu_drm.h | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +8 -2
@@ -808,9 +808,15 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)if (adev->pm.dpm_enabled) { dev_info->max_engine_clock =amdgpu_dpm_get_sclk (adev, false) *10 ; dev_info->max_memory_clock =amdgpu_dpm_get_mclk (adev, false) *10 ; + dev_info->min_engine_clock =amdgpu_dpm_get_sclk (adev, true) *10 ; + dev_info->min_memory_clock =amdgpu_dpm_get_mclk (adev, true) *10 ; }else { - dev_info->max_engine_clock = adev->clock.default_sclk *10 ; - dev_info->max_memory_clock = adev->clock.default_mclk *10 ; + dev_info->max_engine_clock = + dev_info->min_engine_clock = + adev->clock.default_sclk *10 ; + dev_info->max_memory_clock = + dev_info->min_memory_clock = + adev->clock.default_mclk *10 ; } dev_info->enabled_rb_pipes_mask = adev->gfx.config.backend_enable_mask; dev_info->num_rb_pipes = adev->gfx.config.max_backends_per_se *
include/uapi/drm/amdgpu_drm.h +2 -0
@@ -1189,6 +1189,8 @@ struct drm_amdgpu_info_device {__u32 pa_sc_tile_steering_override;/* disabled TCCs */ __u64 tcc_disabled_mask; +__u64 min_engine_clock; +__u64 min_memory_clock; };struct drm_amdgpu_info_hw_ip {
Signature · 1 line
2.34.1
PATCH 9/10 drm/amdgpu: bump minor version number for DEV_INFO and SENSOR IOCTLs update
In reply to Evan QuanUpdate AMDGPU_INFO_DEV_INFO IOCTL for minimum engine and memory clock. And update AMDGPU_INFO_SENSOR IOCTL for PEAK_PSTATE engine and memory clock. User applications can better utilize these IOCTLs to get needed informations.
Increase the minor version number to indicate that the new flags are available.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -2
@@ -102,10 +102,12 @@* - 3.46.0 - To enable hot plug amdgpu tests in libdrm * - 3.47.0 - Add AMDGPU_GEM_CREATE_DISCARDABLE and AMDGPU_VM_NOALLOC flags * - 3.48.0 - Add IP discovery version info to HW INFO -* 3.49.0 - Add gang submit into CS IOCTL +* - 3.49.0 - Add gang submit into CS IOCTL +* - 3.50.0 - Update AMDGPU_INFO_DEV_INFO IOCTL for minimum engine and memory clock +* Update AMDGPU_INFO_SENSOR IOCTL for PEAK_PSTATE engine and memory clock */ #define KMS_DRIVER_MAJOR 3 -#define KMS_DRIVER_MINOR 49 +#define KMS_DRIVER_MINOR 50#define KMS_DRIVER_PATCHLEVEL 0int amdgpu_vram_limit;
Signature · 1 line
2.34.1
Re: [PATCH 09/10] drm/amdgpu: bump minor version number for DEV_INFO and SENSOR IOCTLs update
Quoted 7 lines · Evan Quan
Update
AMDGPU_INFO_DEV_INFOIOCTL for minimum engine and memory clock. And updateAMDGPU_INFO_SENSORIOCTL forPEAK_PSTATEengine and memory clock. User applications can better utilize these IOCTLs to get needed informations.Increase the minor version number to indicate that the new flags are available.
We need updated user space patches which use the IOCTL updates before they can land. Once we have those, the patches are:
Quoted 29 lines
Signed-off-by Evan Quan <[email protected]>Change-Id I2fc85ed8046391555282c0629d88c875488c2b97--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4
-3@@ -102,10 +102,12 @@* - 3.46.0 - To enable hot plug amdgpu tests in libdrm * - 3.47.0 - Add AMDGPU_GEM_CREATE_DISCARDABLE and AMDGPU_VM_NOALLOC flags * - 3.48.0 - Add IP discovery version info to HW INFO -* 3.49.0 - Add gang submit into CS IOCTL +* - 3.49.0 - Add gang submit into CS IOCTL +* - 3.50.0 - Update AMDGPU_INFO_DEV_INFO IOCTL for minimum engine and memory clock +* Update AMDGPU_INFO_SENSOR IOCTL for PEAK_PSTATE engine and memory clock */ #define KMS_DRIVER_MAJOR 3 -#define KMS_DRIVER_MINOR 49 +#define KMS_DRIVER_MINOR 50#define KMS_DRIVER_PATCHLEVEL 0int amdgpu_vram_limit; --2.34.1
PATCH 10/10 drm/amd/pm: update SMU13.0.0 reported maximum shader clock
In reply to Evan QuanUpdate the reported maximum shader clock to the value which can be guarded to be achieved on all cards. This is to align with Window setting.
--- .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 70 ++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +69 -1
@@ -541,6 +541,23 @@ static int smu_v13_0_0_set_default_dpm_table(struct smu_context *smu) dpm_table);if (ret)return ret; + +/* +* Update the reported maximum shader clock to the value +* which can be guarded to be achieved on all cards. This +* is aligned with Window setting. And considering that value +* might be not the peak frequency the card can achieve, it +* is normal some real-time clock frequency can overtake this +* labelled maximum clock frequency(for example in pp_dpm_sclk +* sysfs output). +*/ +if (skutable->DriverReportedClocks.GameClockAc && + (dpm_table->dpm_levels[dpm_table->count -1 ].value > + skutable->DriverReportedClocks.GameClockAc)) { + dpm_table->dpm_levels[dpm_table->count -1 ].value = + skutable->DriverReportedClocks.GameClockAc; + dpm_table->max = skutable->DriverReportedClocks.GameClockAc; + } }else { dpm_table->count =1 ; dpm_table->dpm_levels[0 ].value = smu->smu_table.boot_values.gfxclk /100 ;
@@ -803,6 +820,57 @@ static int smu_v13_0_0_get_smu_metrics_data(struct smu_context *smu,return ret; } +static int smu_v13_0_0_get_dpm_ultimate_freq (struct smu_context *smu, +enum smu_clk_type clk_type, +uint32_t *min, +uint32_t *max) +{ +struct smu_13_0_dpm_context *dpm_context = + smu->smu_dpm.dpm_context; +struct smu_13_0_dpm_table *dpm_table; + +switch (clk_type) { +case SMU_MCLK : +case SMU_UCLK : +/* uclk dpm table */ + dpm_table = &dpm_context->dpm_tables.uclk_table; +break ; +case SMU_GFXCLK : +case SMU_SCLK : +/* gfxclk dpm table */ + dpm_table = &dpm_context->dpm_tables.gfx_table; +break ; +case SMU_SOCCLK : +/* socclk dpm table */ + dpm_table = &dpm_context->dpm_tables.soc_table; +break ; +case SMU_FCLK : +/* fclk dpm table */ + dpm_table = &dpm_context->dpm_tables.fclk_table; +break ; +case SMU_VCLK : +case SMU_VCLK1 : +/* vclk dpm table */ + dpm_table = &dpm_context->dpm_tables.vclk_table; +break ; +case SMU_DCLK : +case SMU_DCLK1 : +/* dclk dpm table */ + dpm_table = &dpm_context->dpm_tables.dclk_table; +break ; +default : +dev_err (smu->adev->dev,"Unsupported clock type!\n" ); +return -EINVAL ; + } + +if (min) + *min = dpm_table->min; +if (max) + *max = dpm_table->max; + +return 0 ; +} + static int smu_v13_0_0_read_sensor(struct smu_context *smu, enum amd_pp_sensors sensor, void *data,
@@ -1908,7 +1976,7 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = { .get_enabled_mask = smu_cmn_get_enabled_mask, .dpm_set_vcn_enable = smu_v13_0_set_vcn_enable, .dpm_set_jpeg_enable = smu_v13_0_set_jpeg_enable, - .get_dpm_ultimate_freq = smu_v13_0_get_dpm_ultimate_freq, + .get_dpm_ultimate_freq = smu_v13_0_0_get_dpm_ultimate_freq, .get_vbios_bootup_values = smu_v13_0_get_vbios_bootup_values, .read_sensor = smu_v13_0_0_read_sensor, .feature_is_enabled = smu_cmn_feature_is_enabled,
Signature · 1 line
2.34.1