Various Polaris fixes and optimizations
cover Various Polaris fixes and optimizations
The fixes and optimizations include:
- Enable zero rpm fan feature
- Reduce the idle power for multiple displays setup
- Fix screen flicker issue seen on some mutiple displays setup
- Enable mclk switch for multiple synced displays
- Other alignments with Windows
Evan Quan (40):
drm/amd/pm: correct the checks for polaris kickers drm/amd/pm: populate smc vddc table
drm/amd/pm: populate smc samu table
drm/amd/pm: correct vddci table setup
drm/amd/pm: correct sclk table setup
drm/amd/pm: correct mclk table setup
drm/amd/pm: correct the ACPI table setup V2 drm/amd/pm: correct the BootLinkLevel setup drm/amd/pm: add pptable VRHotLevel setting
drm/amd/pm: drop arb table first byte workaround drm/amdgpu: correct CG_ACLK_CNTL setting
drm/amd/pm: add PWR_CKS_CNTL setting drm/amd/powerplay: separate Polaris fan table setup from Tonga drm/amd/pm: optimize AC timing programming
drm/amd/pm: drop redundant efuse mask calculations drm/amd/pm: correct the settings for ro range minimum and maximum drm/amd/pm: correct polaris10 clock stretcher data table setting drm/amd/pm: setup zero rpm parameters for polaris10 drm/amd/pm: add edc leakage controller setting drm/amd/pm: add mc register table initialization drm/amd/pm: correct VR shared rail info
drm/amd/pm: correct the checks for sclk/mclk SS support drm/amd/pm: correct Polaris powertune table setup drm/amd/pm: correct Polaris DIDT configurations drm/amd/pm: correct avfs fuse settings
drm/amd/pm: correct vddc phase control setting drm/amd/pm: correct VRconfig setting
drm/amd/pm: correct platformcaps setup
drm/amd/pm: correct smc voltage controller setup drm/amd/pm: correct sclk/mclk dpm enablement drm/amd/pm: correct the way to get the highest vddc drm/amd/pm: correct clk/voltage dependence setup drm/amd/pm: correct pcie spc cap setup
drm/amd/pm: correct SMC sclk/mclk boot level setup drm/amd/pm: correct vddc_dep_on_dal_pwrl setup drm/amd/pm: fulfill the Polaris implementation for
get_clock_by_type_with_latency()
drm/amd/pm: enable Polaris watermark table setting drm/amd/pm: correct the mclk switching setting drm/amd/pm: reconfigure smc on display vbitimeout setting change drm/amd/pm: drop redundant display setting
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 39 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 34 +- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 14 +- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 24 +- .../amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c | 11 +- drivers/gpu/drm/amd/include/atombios.h | 20 +- drivers/gpu/drm/amd/pm/inc/hwmgr.h | 1 + drivers/gpu/drm/amd/pm/inc/smu74_discrete.h | 3 +- drivers/gpu/drm/amd/pm/inc/smu7_ppsmc.h | 6 + .../gpu/drm/amd/pm/powerplay/hwmgr/hwmgr.c | 10 +- .../drm/amd/pm/powerplay/hwmgr/ppatomctrl.c | 125 +++- .../drm/amd/pm/powerplay/hwmgr/ppatomctrl.h | 28 +- .../drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h | 66 ++ .../powerplay/hwmgr/process_pptables_v1_0.c | 107 +++- .../drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 572 ++++++++++++++++-- .../drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.h | 20 + .../amd/pm/powerplay/hwmgr/smu7_powertune.c | 34 +- .../drm/amd/pm/powerplay/hwmgr/smu7_thermal.c | 11 + .../drm/amd/pm/powerplay/hwmgr/smu_helper.c | 18 +- .../drm/amd/pm/powerplay/smumgr/fiji_smumgr.c | 3 +- .../pm/powerplay/smumgr/polaris10_smumgr.c | 356 +++++++---- .../pm/powerplay/smumgr/polaris10_smumgr.h | 1 + .../amd/pm/powerplay/smumgr/vegam_smumgr.c | 3 +- 23 files changed, 1266 insertions(+), 240 deletions(-)
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 1/40 drm/amd/pm: correct the checks for polaris kickers
By defining new Macros.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 39 +++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 34 ++++----------------- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 24 +++------------ 3 files changed, 48 insertions(+), 49 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +39 -0
@@ -728,6 +728,45 @@ struct amd_powerplay {const struct amd_pm_funcs *pp_funcs; }; +/* polaris10 kickers */ +#define ASICID_IS_P20 (did, rid) (((did == 0x67DF) && \ + ((rid == 0xE3) || \ + (rid == 0xE4) || \ + (rid == 0xE5) || \ + (rid == 0xE7) || \ + (rid == 0xEF))) || \ + ((did == 0x6FDF) && \ + ((rid == 0xE7) || \ + (rid == 0xEF) || \ + (rid == 0xFF)))) + +#define ASICID_IS_P30 (did, rid) ((did == 0x67DF) && \ + ((rid == 0xE1) || \ + (rid == 0xF7))) + +/* polaris11 kickers */ +#define ASICID_IS_P21 (did, rid) (((did == 0x67EF) && \ + ((rid == 0xE0) || \ + (rid == 0xE5))) || \ + ((did == 0x67FF) && \ + ((rid == 0xCF) || \ + (rid == 0xEF) || \ + (rid == 0xFF)))) + +#define ASICID_IS_P31 (did, rid) ((did == 0x67EF) && \ + ((rid == 0xE2))) + +/* polaris12 kickers */ +#define ASICID_IS_P23 (did, rid) (((did == 0x6987) && \ + ((rid == 0xC0) || \ + (rid == 0xC1) || \ + (rid == 0xC3) || \ + (rid == 0xC7))) || \ + ((did == 0x6981) && \ + ((rid == 0x00) || \ + (rid == 0x01) || \ + (rid == 0x10)))) +#define AMDGPU_RESET_MAGIC_NUM 64#define AMDGPU_MAX_DF_PERFMONS 4struct amdgpu_device {
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +5 -29
@@ -352,17 +352,10 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,break ;case CHIP_POLARIS11 :if (type ==CGS_UCODE_ID_SMU ) { -if (((adev->pdev->device ==0x67ef ) && - ((adev->pdev->revision ==0xe0 ) || - (adev->pdev->revision ==0xe5 ))) || - ((adev->pdev->device ==0x67ff ) && - ((adev->pdev->revision ==0xcf ) || - (adev->pdev->revision ==0xef ) || - (adev->pdev->revision ==0xff )))) { +if (ASICID_IS_P21 (adev->pdev->device, adev->pdev->revision)) { info->is_kicker = true;strcpy (fw_name,"amdgpu/polaris11_k_smc.bin" ); - }else if ((adev->pdev->device ==0x67ef ) && - (adev->pdev->revision ==0xe2 )) { + }else if (ASICID_IS_P31 (adev->pdev->device, adev->pdev->revision)) { info->is_kicker = true;strcpy (fw_name,"amdgpu/polaris11_k2_smc.bin" ); }else {
@@ -374,21 +367,10 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,break ;case CHIP_POLARIS10 :if (type ==CGS_UCODE_ID_SMU ) { -if (((adev->pdev->device ==0x67df ) && - ((adev->pdev->revision ==0xe0 ) || - (adev->pdev->revision ==0xe3 ) || - (adev->pdev->revision ==0xe4 ) || - (adev->pdev->revision ==0xe5 ) || - (adev->pdev->revision ==0xe7 ) || - (adev->pdev->revision ==0xef ))) || - ((adev->pdev->device ==0x6fdf ) && - ((adev->pdev->revision ==0xef ) || - (adev->pdev->revision ==0xff )))) { +if (ASICID_IS_P20 (adev->pdev->device, adev->pdev->revision)) { info->is_kicker = true;strcpy (fw_name,"amdgpu/polaris10_k_smc.bin" ); - }else if ((adev->pdev->device ==0x67df ) && - ((adev->pdev->revision ==0xe1 ) || - (adev->pdev->revision ==0xf7 ))) { + }else if (ASICID_IS_P30 (adev->pdev->device, adev->pdev->revision)) { info->is_kicker = true;strcpy (fw_name,"amdgpu/polaris10_k2_smc.bin" ); }else {
@@ -399,13 +381,7 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device, }break ;case CHIP_POLARIS12 : -if (((adev->pdev->device ==0x6987 ) && - ((adev->pdev->revision ==0xc0 ) || - (adev->pdev->revision ==0xc3 ))) || - ((adev->pdev->device ==0x6981 ) && - ((adev->pdev->revision ==0x00 ) || - (adev->pdev->revision ==0x01 ) || - (adev->pdev->revision ==0x10 )))) { +if (ASICID_IS_P23 (adev->pdev->device, adev->pdev->revision)) { info->is_kicker = true;strcpy (fw_name,"amdgpu/polaris12_k_smc.bin" ); }else {
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +4 -20
@@ -230,36 +230,20 @@ static int gmc_v8_0_init_microcode(struct amdgpu_device *adev) chip_name ="tonga" ;break ;case CHIP_POLARIS11 : -if (((adev->pdev->device ==0x67ef ) && - ((adev->pdev->revision ==0xe0 ) || - (adev->pdev->revision ==0xe5 ))) || - ((adev->pdev->device ==0x67ff ) && - ((adev->pdev->revision ==0xcf ) || - (adev->pdev->revision ==0xef ) || - (adev->pdev->revision ==0xff )))) - chip_name ="polaris11_k" ; -else if ((adev->pdev->device ==0x67ef ) && - (adev->pdev->revision ==0xe2 )) +if (ASICID_IS_P21 (adev->pdev->device, adev->pdev->revision) || +ASICID_IS_P31 (adev->pdev->device, adev->pdev->revision)) chip_name ="polaris11_k" ;else chip_name ="polaris11" ;break ;case CHIP_POLARIS10 : -if ((adev->pdev->device ==0x67df ) && - ((adev->pdev->revision ==0xe1 ) || - (adev->pdev->revision ==0xf7 ))) +if (ASICID_IS_P30 (adev->pdev->device, adev->pdev->revision)) chip_name ="polaris10_k" ;else chip_name ="polaris10" ;break ;case CHIP_POLARIS12 : -if (((adev->pdev->device ==0x6987 ) && - ((adev->pdev->revision ==0xc0 ) || - (adev->pdev->revision ==0xc3 ))) || - ((adev->pdev->device ==0x6981 ) && - ((adev->pdev->revision ==0x00 ) || - (adev->pdev->revision ==0x01 ) || - (adev->pdev->revision ==0x10 )))) +if (ASICID_IS_P23 (adev->pdev->device, adev->pdev->revision)) chip_name ="polaris12_k" ;else chip_name ="polaris12" ;
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/40 drm/amd/pm: populate smc vddc table
In reply to Evan QuanAdd missing vddc table setup.
--- .../pm/powerplay/smumgr/polaris10_smumgr.c | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +26 -0
@@ -671,6 +671,31 @@ static int polaris10_populate_smc_mvdd_table(struct pp_hwmgr *hwmgr,return 0 ; } +static int polaris10_populate_smc_vddc_table (struct pp_hwmgr *hwmgr, +struct SMU74_Discrete_DpmTable *table) +{ +uint32_t count, level; +struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); + + count = data->vddc_voltage_table.count; + +if (SMU7_VOLTAGE_CONTROL_BY_GPIO == data->voltage_control) { +if (count >SMU_MAX_SMIO_LEVELS ) + count =SMU_MAX_SMIO_LEVELS ; +for (level =0 ; level < count; ++level) { + table->SmioTable1.Pattern[level].Voltage = +PP_HOST_TO_SMC_US (data->vddc_voltage_table.entries[level].value *VOLTAGE_SCALE ); + table->SmioTable1.Pattern[level].Smio = (uint8_t ) level; + + table->Smio[level] |= data->vddc_voltage_table.entries[level].smio_low; + } + + table->SmioMask1 = data->vddc_voltage_table.mask_low; + } + +return 0 ; +} +static int polaris10_populate_smc_vddci_table (struct pp_hwmgr *hwmgr,struct SMU74_Discrete_DpmTable *table) {
@@ -725,6 +750,7 @@ static int polaris10_populate_cac_table(struct pp_hwmgr *hwmgr,static int polaris10_populate_smc_voltage_tables (struct pp_hwmgr *hwmgr,struct SMU74_Discrete_DpmTable *table) { +polaris10_populate_smc_vddc_table (hwmgr, table);polaris10_populate_smc_vddci_table (hwmgr, table);polaris10_populate_smc_mvdd_table (hwmgr, table);polaris10_populate_cac_table (hwmgr, table);
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/40 drm/amd/pm: populate smc samu table
In reply to Evan QuanAdd missing smc samu table setup.
--- .../pm/powerplay/smumgr/polaris10_smumgr.c | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +53 -0
@@ -1360,6 +1360,55 @@ static int polaris10_populate_smc_vce_level(struct pp_hwmgr *hwmgr,return result; } +static int polaris10_populate_smc_samu_level (struct pp_hwmgr *hwmgr, +SMU74_Discrete_DpmTable *table) +{ +int result = -EINVAL ; +uint8_t count; +struct pp_atomctrl_clock_dividers_vi dividers; +struct phm_ppt_v1_information *table_info = + (struct phm_ppt_v1_information *)(hwmgr->pptable); +struct phm_ppt_v1_mm_clock_voltage_dependency_table *mm_table = + table_info->mm_dep_table; +struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); +uint32_t vddci; + + table->SamuLevelCount = (uint8_t )(mm_table->count); + table->SamuBootLevel =0 ; + +for (count =0 ; count < table->SamuLevelCount; count++) { + table->SamuLevel[count].Frequency = mm_table->entries[count].samclock; + table->SamuLevel[count].MinVoltage |= + (mm_table->entries[count].vddc *VOLTAGE_SCALE ) <<VDDC_SHIFT ; + +if (SMU7_VOLTAGE_CONTROL_BY_GPIO == data->vddci_control) + vddci = (uint32_t )phm_find_closest_vddci (&(data->vddci_voltage_table), + mm_table->entries[count].vddc -VDDC_VDDCI_DELTA ); +else if (SMU7_VOLTAGE_CONTROL_BY_SVID2 == data->vddci_control) + vddci = mm_table->entries[count].vddc -VDDC_VDDCI_DELTA ; +else + vddci = (data->vbios_boot_state.vddci_bootup_value *VOLTAGE_SCALE ) <<VDDCI_SHIFT ; + + + table->SamuLevel[count].MinVoltage |= + (vddci *VOLTAGE_SCALE ) <<VDDCI_SHIFT ; + table->SamuLevel[count].MinVoltage |=1 <<PHASES_SHIFT ; + +/*retrieve divider value for VBIOS */ + result =atomctrl_get_dfs_pll_dividers_vi (hwmgr, + table->SamuLevel[count].Frequency, ÷rs); +PP_ASSERT_WITH_CODE ((0 == result), +"can not find divide id for VCE engine clock" , + return result); + + table->SamuLevel[count].Divider = (uint8_t )dividers.pll_post_divider; + +CONVERT_FROM_HOST_TO_SMC_UL (table->SamuLevel[count].Frequency); +CONVERT_FROM_HOST_TO_SMC_UL (table->SamuLevel[count].MinVoltage); + } +return result; +} +static int polaris10_populate_memory_timing_parameters (struct pp_hwmgr *hwmgr,int32_t eng_clock,int32_t mem_clock,SMU74_Discrete_MCArbDramTimingTableEntry *arb_regs)
@@ -1902,6 +1951,10 @@ static int polaris10_init_smc_table(struct pp_hwmgr *hwmgr)PP_ASSERT_WITH_CODE (0 == result, "Failed to initialize VCE Level!", return result); + result =polaris10_populate_smc_samu_level (hwmgr, table); +PP_ASSERT_WITH_CODE (0 == result, + "Failed to initialize SAMU Level!", return result); +/* Since only the initial state is completely set up at this point * (the other states are just copies of the boot state) we only * need to populate the ARB settings for the initial state.
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/40 drm/amd/pm: correct vddci table setup
In reply to Evan QuanMake sure the settings are applied only when voltage controlled by gpio.
--- drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +2 -2
@@ -714,9 +714,9 @@ static int polaris10_populate_smc_vddci_table(struct pp_hwmgr *hwmgr, table->Smio[level] |= data->vddci_voltage_table.entries[level].smio_low; } - } - table->SmioMask1 = data->vddci_voltage_table.mask_low; + table->SmioMask1 = data->vddci_voltage_table.mask_low; + }return 0 ; }
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/40 drm/amd/pm: correct sclk table setup
In reply to Evan QuanCorrect Polaris10 sclk table setup.
--- .../pm/powerplay/smumgr/polaris10_smumgr.c | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +21 -2
@@ -1022,6 +1022,9 @@ static int polaris10_populate_all_graphic_levels(struct pp_hwmgr *hwmgr) lowest_pcie_level_enabled =0 , mid_pcie_level_enabled =0 , count =0 ; +struct amdgpu_device *adev = hwmgr->adev; +pp_atomctrl_clock_dividers_vi dividers; +uint32_t dpm0_sclkfrequency = levels[0 ].SclkSetting.SclkFrequency;polaris10_get_sclk_range_table (hwmgr, &(smu_data->smc_state_table));
@@ -1038,15 +1041,31 @@ static int polaris10_populate_all_graphic_levels(struct pp_hwmgr *hwmgr) levels[i].DeepSleepDivId =0 ; }if (phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, - PHM_PlatformCaps_SPLLShutdownSupport)) + PHM_PlatformCaps_SPLLShutdownSupport)) { smu_data->smc_state_table.GraphicsLevel[0 ].SclkSetting.SSc_En =0 ; +if (dpm0_sclkfrequency != levels[0 ].SclkSetting.SclkFrequency) { + result =atomctrl_get_dfs_pll_dividers_vi (hwmgr, + dpm_table->sclk_table.dpm_levels[0 ].value, + ÷rs); +PP_ASSERT_WITH_CODE ((0 == result), +"can not find divide id for sclk" , + return result); +smum_send_msg_to_smc_with_parameter (hwmgr, + PPSMC_MSG_SetGpuPllDfsForSclk, + dividers.real_clock < dpm_table->sclk_table.dpm_levels[0 ].value ? + dividers.pll_post_divider -1 : dividers.pll_post_divider, +NULL ); + } + } - smu_data->smc_state_table.GraphicsLevel[0 ].EnabledForActivity =1 ; smu_data->smc_state_table.GraphicsDpmLevelCount = (uint8_t )dpm_table->sclk_table.count; hw_data->dpm_level_enable_mask.sclk_dpm_enable_mask =phm_get_dpm_level_enable_mask_value (&dpm_table->sclk_table); +for (i =0 ; i < smu_data->smc_state_table.GraphicsDpmLevelCount; i++) + smu_data->smc_state_table.GraphicsLevel[i].EnabledForActivity = + (hw_data->dpm_level_enable_mask.sclk_dpm_enable_mask & (1 << i)) >> i;if (pcie_table !=NULL ) { PP_ASSERT_WITH_CODE((1 <= pcie_entry_cnt),
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/40 drm/amd/pm: correct mclk table setup
In reply to Evan QuanCorrect the settings for "StutterEnable" and "EnabledForActivity".
--- .../pm/powerplay/smumgr/polaris10_smumgr.c | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +8 -12
@@ -1155,7 +1155,9 @@ static int polaris10_populate_single_memory_level(struct pp_hwmgr *hwmgr,if (mclk_stutter_mode_threshold && (clock <= mclk_stutter_mode_threshold) && (PHM_READ_FIELD (hwmgr->device,DPG_PIPE_STUTTER_CONTROL , -STUTTER_ENABLE ) &0x1 )) +STUTTER_ENABLE ) &0x1 ) && + (data->display_timing.num_existing_displays <=2 ) && + data->display_timing.num_existing_displays) mem_level->StutterEnable = true;if (!result) {
@@ -1189,27 +1191,21 @@ static int polaris10_populate_all_memory_levels(struct pp_hwmgr *hwmgr) result =polaris10_populate_single_memory_level (hwmgr, dpm_table->mclk_table.dpm_levels[i].value, &levels[i]); -if (i == dpm_table->mclk_table.count -1 ) { +if (i == dpm_table->mclk_table.count -1 ) levels[i].DisplayWatermark =PPSMC_DISPLAY_WATERMARK_HIGH ; - levels[i].EnabledForActivity =1 ; - }if (result)return result; } -/* In order to prevent MC activity from stutter mode to push DPM up, -* the UVD change complements this by putting the MCLK in -* a higher state by default such that we are not affected by -* up threshold or and MCLK DPM latency. -*/ - levels[0 ].ActivityLevel =0x1f ; -CONVERT_FROM_HOST_TO_SMC_US (levels[0 ].ActivityLevel); - smu_data->smc_state_table.MemoryDpmLevelCount = (uint8_t )dpm_table->mclk_table.count; hw_data->dpm_level_enable_mask.mclk_dpm_enable_mask =phm_get_dpm_level_enable_mask_value (&dpm_table->mclk_table); +for (i =0 ; i < smu_data->smc_state_table.MemoryDpmLevelCount; i++) + smu_data->smc_state_table.MemoryLevel[i].EnabledForActivity = + (hw_data->dpm_level_enable_mask.mclk_dpm_enable_mask & (1 << i)) >> i; +/* level count will send to smc once at init smc table and never change */ result =smu7_copy_bytes_to_smc (hwmgr, array, (uint8_t *)levels, (uint32_t )array_size,SMC_RAM_END );
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/40 drm/amd/pm: correct the ACPI table setup V2
In reply to Evan QuanCorrect the setting for "ActivityLevel".
V2: rich the comment
--- drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +2 -1
@@ -1316,8 +1316,9 @@ static int polaris10_populate_smc_acpi_level(struct pp_hwmgr *hwmgr, table->MemoryACPILevel.UpHyst =0 ; table->MemoryACPILevel.DownHyst =100 ; table->MemoryACPILevel.VoltageDownHyst =0 ; +/* To align with the settings from other OSes */ table->MemoryACPILevel.ActivityLevel = -PP_HOST_TO_SMC_US (data->current_profile_setting.mclk_activity); +PP_HOST_TO_SMC_US (data->current_profile_setting.sclk_activity);CONVERT_FROM_HOST_TO_SMC_UL (table->MemoryACPILevel.MclkFrequency);CONVERT_FROM_HOST_TO_SMC_UL (table->MemoryACPILevel.MinVoltage);
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/40 drm/amd/pm: correct the BootLinkLevel setup
In reply to Evan QuanSet the BootLinkLevel as the max level.
--- drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +1 -1
@@ -2023,7 +2023,7 @@ static int polaris10_init_smc_table(struct pp_hwmgr *hwmgr) table->VoltageResponseTime =0 ; table->PhaseResponseTime =0 ; table->MemoryThermThrottleEnable =1 ; - table->PCIeBootLinkLevel =0 ; + table->PCIeBootLinkLevel = hw_data->dpm_table.pcie_speed_table.count; table->PCIeGenInterval =1 ; table->VRConfig =0 ;
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 9/40 drm/amd/pm: add pptable VRHotLevel setting
In reply to Evan QuanAdd missing VRHotLevel setting.
--- drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +3 -0
@@ -1921,6 +1921,7 @@ static int polaris10_init_smc_table(struct pp_hwmgr *hwmgr)uint8_t i;struct pp_atomctrl_gpio_pin_assignment gpio_pin;pp_atomctrl_clock_dividers_vi dividers; +struct phm_ppt_v1_gpio_table *gpio_table = table_info->gpio_table;polaris10_initialize_power_tune_defaults (hwmgr);
@@ -2036,6 +2037,8 @@ static int polaris10_init_smc_table(struct pp_hwmgr *hwmgr)if (atomctrl_get_pp_assign_pin (hwmgr,VDDC_VRHOT_GPIO_PINID , &gpio_pin)) { table->VRHotGpio = gpio_pin.uc_gpio_pin_bit_shift; +if (gpio_table) + table->VRHotLevel = gpio_table->vrhot_triggered_sclk_dpm_index; }else { table->VRHotGpio =SMU7_UNUSED_GPIO_PIN ; phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 10/40 drm/amd/pm: drop arb table first byte workaround
In reply to Evan QuanAs this is not needed for polaris.
--- .../pm/powerplay/smumgr/polaris10_smumgr.c | 31 ------------------- 1 file changed, 31 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +0 -31
@@ -1865,33 +1865,6 @@ static int polaris10_populate_avfs_parameters(struct pp_hwmgr *hwmgr)return result; } -static int polaris10_init_arb_table_index (struct pp_hwmgr *hwmgr) -{ -struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); -uint32_t tmp; -int result; - -/* This is a read-modify-write on the first byte of the ARB table. -* The first byte in the SMU73_Discrete_MCArbDramTimingTable structure -* is the field 'current'. -* This solution is ugly, but we never write the whole table only -* individual fields in it. -* In reality this field should not be in that structure -* but in a soft register. -*/ - result =smu7_read_smc_sram_dword (hwmgr, - smu_data->smu7_data.arb_table_start, &tmp,SMC_RAM_END ); - -if (result) -return result; - - tmp &=0x00FFFFFF ; - tmp |= ((uint32_t )MC_CG_ARB_FREQ_F1 ) <<24 ; - -return smu7_write_smc_sram_dword (hwmgr, - smu_data->smu7_data.arb_table_start, tmp,SMC_RAM_END ); -} -static void polaris10_initialize_power_tune_defaults (struct pp_hwmgr *hwmgr) {struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend);
@@ -2118,10 +2091,6 @@ static int polaris10_init_smc_table(struct pp_hwmgr *hwmgr)PP_ASSERT_WITH_CODE (0 == result, "Failed to upload dpm data to SMC memory!", return result); - result =polaris10_init_arb_table_index (hwmgr); -PP_ASSERT_WITH_CODE (0 == result, - "Failed to upload arb data to SMC memory!", return result); - result =polaris10_populate_pm_fuses (hwmgr);PP_ASSERT_WITH_CODE (0 == result, "Failed to populate PM fuses to SMC memory!", return result);
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 11/40 drm/amdgpu: correct CG_ACLK_CNTL setting
In reply to Evan QuanCorrect polaris CG_ACLK_CNTL setting.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +11 -3
@@ -729,8 +729,13 @@ static void gfx_v8_0_get_cu_info(struct amdgpu_device *adev);static void gfx_v8_0_ring_emit_ce_meta (struct amdgpu_ring *ring);static void gfx_v8_0_ring_emit_de_meta (struct amdgpu_ring *ring); +#define CG_ACLK_CNTL__ACLK_DIVIDER_MASK 0x0000007fL +#define CG_ACLK_CNTL__ACLK_DIVIDER__SHIFT 0x00000000L +static void gfx_v8_0_init_golden_registers (struct amdgpu_device *adev) { +uint32_t data; +switch (adev->asic_type) {case CHIP_TOPAZ : amdgpu_device_program_register_sequence(adev,
@@ -790,11 +795,14 @@ static void gfx_v8_0_init_golden_registers(struct amdgpu_device *adev)amdgpu_device_program_register_sequence (adev, polaris10_golden_common_all,ARRAY_SIZE (polaris10_golden_common_all)); -WREG32_SMC (ixCG_ACLK_CNTL,0x0000001C ); -if (adev->pdev->revision ==0xc7 && + data =RREG32_SMC (ixCG_ACLK_CNTL); + data &= ~CG_ACLK_CNTL__ACLK_DIVIDER_MASK ; + data |=0x18 <<CG_ACLK_CNTL__ACLK_DIVIDER__SHIFT ; +WREG32_SMC (ixCG_ACLK_CNTL, data); +if ((adev->pdev->device ==0x67DF ) && (adev->pdev->revision ==0xc7 ) && ((adev->pdev->subsystem_device ==0xb37 && adev->pdev->subsystem_vendor ==0x1002 ) || (adev->pdev->subsystem_device ==0x4a8 && adev->pdev->subsystem_vendor ==0x1043 ) || - (adev->pdev->subsystem_device ==0x9480 && adev->pdev->subsystem_vendor ==0x1682 ))) { + (adev->pdev->subsystem_device ==0x9480 && adev->pdev->subsystem_vendor ==0x1680 ))) {amdgpu_atombios_i2c_channel_trans (adev,0x10 ,0x96 ,0x1E ,0xDD );amdgpu_atombios_i2c_channel_trans (adev,0x10 ,0x96 ,0x1F ,0xD0 ); }
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 12/40 drm/amd/pm: add PWR_CKS_CNTL setting
In reply to Evan QuanThis is for some special Polaris10 ASICs.
--- .../gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +11 -4
@@ -2138,10 +2138,17 @@ static int smu7_patch_voltage_workaround(struct pp_hwmgr *hwmgr) sub_sys_id = adev->pdev->subsystem_device; sub_vendor_id = adev->pdev->subsystem_vendor; -if (hwmgr->chip_id ==CHIP_POLARIS10 && hw_revision ==0xC7 && - ((sub_sys_id ==0xb37 && sub_vendor_id ==0x1002 ) || - (sub_sys_id ==0x4a8 && sub_vendor_id ==0x1043 ) || - (sub_sys_id ==0x9480 && sub_vendor_id ==0x1682 ))) { +if (adev->pdev->device ==0x67DF && hw_revision ==0xC7 && + ((sub_sys_id ==0xb37 && sub_vendor_id ==0x1002 ) || + (sub_sys_id ==0x4a8 && sub_vendor_id ==0x1043 ) || + (sub_sys_id ==0x9480 && sub_vendor_id ==0x1682 ))) { + +PHM_WRITE_VFPF_INDIRECT_FIELD (hwmgr->device, +CGS_IND_REG__SMC , +PWR_CKS_CNTL , +CKS_STRETCH_AMOUNT , +0x3 ); +if (lookup_table->entries[dep_mclk_table->entries[dep_mclk_table->count-1 ].vddInd].us_vdd >=1000 )return 0 ;
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 13/40 drm/amd/powerplay: separate Polaris fan table setup from Tonga
In reply to Evan QuanInstead of sharing the fan table setup with Tonga, Polaris has its own fan table setup.
--- .../drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h | 30 ++++++++++ .../powerplay/hwmgr/process_pptables_v1_0.c | 58 ++++++++++++++++++- 2 files changed, 87 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h +30 -0
@@ -315,6 +315,36 @@ typedef struct _ATOM_Fiji_Fan_Table {USHORT usReserved; } ATOM_Fiji_Fan_Table; +typedef struct _ATOM_Polaris_Fan_Table { +UCHAR ucRevId;/* Change this if the table format changes or version changes so that the other fields are not the same. */ +UCHAR ucTHyst;/* Temperature hysteresis. Integer. */ +USHORT usTMin;/* The temperature, in 0.01 centigrades, below which we just run at a minimal PWM. */ +USHORT usTMed;/* The middle temperature where we change slopes. */ +USHORT usTHigh;/* The high point above TMed for adjusting the second slope. */ +USHORT usPWMMin;/* The minimum PWM value in percent (0.01% increments). */ +USHORT usPWMMed;/* The PWM value (in percent) at TMed. */ +USHORT usPWMHigh;/* The PWM value at THigh. */ +USHORT usTMax;/* The max temperature */ +UCHAR ucFanControlMode;/* Legacy or Fuzzy Fan mode */ +USHORT usFanPWMMax;/* Maximum allowed fan power in percent */ +USHORT usFanOutputSensitivity;/* Sensitivity of fan reaction to temepature changes */ +USHORT usFanRPMMax;/* The default value in RPM */ +ULONG ulMinFanSCLKAcousticLimit;/* Minimum Fan Controller SCLK Frequency Acoustic Limit. */ +UCHAR ucTargetTemperature;/* Advanced fan controller target temperature. */ +UCHAR ucMinimumPWMLimit;/* The minimum PWM that the advanced fan controller can set. This should be set to the highest PWM that will run the fan at its lowest RPM. */ +USHORT usFanGainEdge; +USHORT usFanGainHotspot; +USHORT usFanGainLiquid; +USHORT usFanGainVrVddc; +USHORT usFanGainVrMvdd; +USHORT usFanGainPlx; +USHORT usFanGainHbm; +UCHAR ucEnableZeroRPM; +UCHAR ucFanStopTemperature; +UCHAR ucFanStartTemperature; +USHORT usReserved; +}ATOM_Polaris_Fan_Table ; + typedef struct _ATOM_Tonga_Thermal_Controller { UCHAR ucRevId; UCHAR ucType; /* one of ATOM_TONGA_PP_THERMALCONTROLLER_* */
drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c +57 -1
70 lines not on this page · raw message
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 14/40 drm/amd/pm: optimize AC timing programming
In reply to Evan QuanProgramming AC Timing Parameters is only dependent on MCLK. No need to nest loop for each SCLK DPM level.
--- drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +1 -1
@@ -1465,7 +1465,7 @@ static int polaris10_program_memory_timing_parameters(struct pp_hwmgr *hwmgr) hw_data->dpm_table.sclk_table.dpm_levels[i].value, hw_data->dpm_table.mclk_table.dpm_levels[j].value, &arb_regs.entries[i][j]); -if (result ==0 ) +if (result ==0 && i ==0 ) result =atomctrl_set_ac_timing_ai (hwmgr, hw_data->dpm_table.mclk_table.dpm_levels[j].value, j);if (result !=0 )return result;
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 15/40 drm/amd/pm: drop redundant efuse mask calculations
In reply to Evan QuanBy moving that in atomfw_read_efuse().
--- drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c | 8 +++++++- drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.h | 2 +- drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c | 3 +-- drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c | 3 +-- 4 files changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c +7 -1
@@ -1295,12 +1295,18 @@ int atomctrl_get_engine_clock_spread_spectrum( }int atomctrl_read_efuse (struct pp_hwmgr *hwmgr,uint16_t start_index, -uint16_t end_index,uint32_t mask,uint32_t *efuse) +uint16_t end_index,uint32_t *efuse) {struct amdgpu_device *adev = hwmgr->adev; +uint32_t mask;int result;READ_EFUSE_VALUE_PARAMETER efuse_param; +if ((end_index - start_index) ==31 ) + mask =0xFFFFFFFF ; +else + mask = (1 << ((end_index - start_index) +1 )) -1 ; + efuse_param.sEfuse.usEfuseIndex =cpu_to_le16 ((start_index /32 ) *4 ); efuse_param.sEfuse.ucBitShift = (uint8_t ) (start_index - ((start_index /32 ) *32 ));
drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.h +1 -1
@@ -300,7 +300,7 @@ extern int atomctrl_get_engine_pll_dividers_kong(struct pp_hwmgr *hwmgr,uint32_t clock_value, pp_atomctrl_clock_dividers_kong *dividers);extern int atomctrl_read_efuse (struct pp_hwmgr *hwmgr,uint16_t start_index, -uint16_t end_index,uint32_t mask,uint32_t *efuse); +uint16_t end_index,uint32_t *efuse);extern int atomctrl_calculate_voltage_evv_on_sclk (struct pp_hwmgr *hwmgr,uint8_t voltage_type,uint32_t sclk,uint16_t virtual_voltage_Id,uint16_t *voltage,uint16_t dpm_level,bool debug);extern int atomctrl_get_engine_pll_dividers_ai (struct pp_hwmgr *hwmgr,uint32_t clock_value,pp_atomctrl_clock_dividers_ai *dividers);
drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c +1 -2
@@ -318,13 +318,12 @@ static bool fiji_is_hw_avfs_present(struct pp_hwmgr *hwmgr) {uint32_t efuse =0 ; -uint32_t mask = (1 << ((AVFS_EN_MSB -AVFS_EN_LSB ) +1 )) -1 ;if (!hwmgr->not_vf)return false;if (!atomctrl_read_efuse (hwmgr,AVFS_EN_LSB ,AVFS_EN_MSB , - mask, &efuse)) { + &efuse)) {if (efuse)return true; }
drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c +1 -2
@@ -1495,12 +1495,11 @@ static int vegam_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr) (struct phm_ppt_v1_information *)(hwmgr->pptable);struct phm_ppt_v1_clock_voltage_dependency_table *sclk_table = table_info->vdd_dep_on_sclk; -uint32_t mask = (1 << ((STRAP_ASIC_RO_MSB -STRAP_ASIC_RO_LSB ) +1 )) -1 ; stretch_amount = (uint8_t )table_info->cac_dtp_table->usClockStretchAmount;atomctrl_read_efuse (hwmgr,STRAP_ASIC_RO_LSB ,STRAP_ASIC_RO_MSB , - mask, &efuse); + &efuse); min =1200 ; max =2500 ;
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 16/40 drm/amd/pm: correct the settings for ro range minimum and maximum
In reply to Evan QuanMake the settings more precise.
--- .../drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 62 +++++++++++++++++++ .../drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.h | 3 + 2 files changed, 65 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +62 -0
@@ -97,6 +97,9 @@ static struct profile_mode_setting smu7_profiling[7] =#define PWR_SVI2_PLANE1_LOAD__PSI1__SHIFT 0x00000005#define PWR_SVI2_PLANE1_LOAD__PSI0_EN__SHIFT 0x00000006 +#define STRAP_EVV_REVISION_MSB 2211 +#define STRAP_EVV_REVISION_LSB 2208 +/** Values for the CG_THERMAL_CTRL::DPM_EVENT_SRC field. */ enum DPM_EVENT_SRC {DPM_EVENT_SRC_ANALOG =0 ,
@@ -1696,6 +1699,61 @@ static void smu7_init_dpm_defaults(struct pp_hwmgr *hwmgr) PHM_PlatformCaps_VCEPowerGating); } +static int smu7_calculate_ro_range (struct pp_hwmgr *hwmgr) +{ +struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); +struct amdgpu_device *adev = hwmgr->adev; +uint32_t asicrev1, evv_revision, max, min; + +atomctrl_read_efuse (hwmgr,STRAP_EVV_REVISION_LSB ,STRAP_EVV_REVISION_MSB , + &evv_revision); + +atomctrl_read_efuse (hwmgr,568 ,579 , &asicrev1); + +if (ASICID_IS_P20 (adev->pdev->device, adev->pdev->revision) || +ASICID_IS_P30 (adev->pdev->device, adev->pdev->revision)) { + min =1200 ; + max =2500 ; + }else if (ASICID_IS_P21 (adev->pdev->device, adev->pdev->revision) || +ASICID_IS_P31 (adev->pdev->device, adev->pdev->revision)) { + min =900 ; + max=2100 ; + }else if (hwmgr->chip_id ==CHIP_POLARIS10 ) { +if (adev->pdev->subsystem_vendor ==0x106B ) { + min =1000 ; + max =2300 ; + }else { +if (evv_revision ==0 ) { + min =1000 ; + max =2300 ; + }else if (evv_revision ==1 ) { +if (asicrev1 ==326 ) { + min =1200 ; + max =2500 ; +/* TODO: PATCH RO in VBIOS */ + }else { + min =1200 ; + max =2000 ; + } + }else if (evv_revision ==2 ) { + min =1200 ; + max =2500 ; + } + } + }else if ((hwmgr->chip_id ==CHIP_POLARIS11 ) || + (hwmgr->chip_id ==CHIP_POLARIS12 )) { + min =1100 ; + max =2100 ; + } + + data->ro_range_minimum = min; + data->ro_range_maximum = max; + +/* TODO: PATCH RO in VBIOS here */ + +return 0 ; +} +/** * Get Leakage VDDC based on leakage ID. *
@@ -1714,6 +1772,10 @@ static int smu7_get_evv_voltages(struct pp_hwmgr *hwmgr) (struct phm_ppt_v1_information *)hwmgr->pptable;struct phm_ppt_v1_clock_voltage_dependency_table *sclk_table =NULL ; +if (hwmgr->chip_id ==CHIP_POLARIS10 || + hwmgr->chip_id ==CHIP_POLARIS11 || + hwmgr->chip_id ==CHIP_POLARIS12 ) +smu7_calculate_ro_range (hwmgr);for (i =0 ; i <SMU7_MAX_LEAKAGE_COUNT ; i++) { vv_id =ATOM_VIRTUAL_VOLTAGE_ID0 + i;
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.h +3 -0
@@ -328,6 +328,9 @@ struct smu7_hwmgr {uint16_t mem_latency_low;uint32_t vr_config;struct profile_mode_setting current_profile_setting; + +uint32_t ro_range_minimum; +uint32_t ro_range_maximum; };/* To convert to Q8.8 format for firmware */
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 17/40 drm/amd/pm: correct polaris10 clock stretcher data table setting
In reply to Evan QuanBy using the saved copy of ro_range_maximum and ro_range_minimum. Correct the setting for "LdoRefSel".
--- .../pm/powerplay/smumgr/polaris10_smumgr.c | 42 +++++-------------- 1 file changed, 11 insertions(+), 31 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +11 -31
@@ -1600,49 +1600,28 @@ static int polaris10_populate_smc_initailial_state(struct pp_hwmgr *hwmgr)return 0 ; } +#define STRAP_ASIC_RO_LSB 2168 +#define STRAP_ASIC_RO_MSB 2175 +static int polaris10_populate_clock_stretcher_data_table (struct pp_hwmgr *hwmgr) { -uint32_t ro, efuse, volt_without_cks, volt_with_cks, value, max, min;struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); - -uint8_t i, stretch_amount, volt_offset =0 ; +struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);struct phm_ppt_v1_information *table_info = (struct phm_ppt_v1_information *)(hwmgr->pptable);struct phm_ppt_v1_clock_voltage_dependency_table *sclk_table = table_info->vdd_dep_on_sclk; +uint32_t ro, efuse, volt_without_cks, volt_with_cks, value; +uint8_t i, stretch_amount, volt_offset =0 ; stretch_amount = (uint8_t )table_info->cac_dtp_table->usClockStretchAmount;/* Read SMU_Eefuse to read and calculate RO and determine * if the part is SS or FF. if RO >= 1660MHz, part is FF. */ - efuse =cgs_read_ind_register (hwmgr->device,CGS_IND_REG__SMC , - ixSMU_EFUSE_0 + (67 *4 )); - efuse &=0xFF000000 ; - efuse = efuse >>24 ; - -if (hwmgr->chip_id ==CHIP_POLARIS10 ) { -if (hwmgr->is_kicker) { - min =1200 ; - max =2500 ; - }else { - min =1000 ; - max =2300 ; - } - }else if (hwmgr->chip_id ==CHIP_POLARIS11 ) { -if (hwmgr->is_kicker) { - min =900 ; - max =2100 ; - }else { - min =1100 ; - max =2100 ; - } - }else { - min =1100 ; - max =2100 ; - } - - ro = efuse * (max - min) /255 + min; +atomctrl_read_efuse (hwmgr,STRAP_ASIC_RO_LSB ,STRAP_ASIC_RO_MSB , &efuse); + ro = ((efuse * (data->ro_range_maximum - data->ro_range_minimum)) /255 ) + + data->ro_range_minimum;/* Populate Sclk_CKS_masterEn0_7 and Sclk_voltageOffset */ for (i =0 ; i < sclk_table->count; i++) {
@@ -1667,7 +1646,8 @@ static int polaris10_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr) smu_data->smc_state_table.Sclk_voltageOffset[i] = volt_offset; } - smu_data->smc_state_table.LdoRefSel = (table_info->cac_dtp_table->ucCKS_LDO_REFSEL !=0 ) ? table_info->cac_dtp_table->ucCKS_LDO_REFSEL :6 ; + smu_data->smc_state_table.LdoRefSel = (table_info->cac_dtp_table->ucCKS_LDO_REFSEL !=0 ) ? table_info->cac_dtp_table->ucCKS_LDO_REFSEL :5 ; +/* Populate CKS Lookup Table */ if (stretch_amount ==0 || stretch_amount >5 ) { phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 18/40 drm/amd/pm: setup zero rpm parameters for polaris10
In reply to Evan QuanOnly if the ZeroRPM feature is supported.
--- drivers/gpu/drm/amd/pm/inc/smu7_ppsmc.h | 1 + .../drm/amd/pm/powerplay/hwmgr/smu7_thermal.c | 11 +++++++++++ .../amd/pm/powerplay/smumgr/polaris10_smumgr.c | 17 +++++++++++++++++ 3 files changed, 29 insertions(+)
drivers/gpu/drm/amd/pm/inc/smu7_ppsmc.h +1 -0
@@ -394,6 +394,7 @@ typedef uint16_t PPSMC_Result;#define PPSMC_MSG_SetGpuPllDfsForSclk ((uint16_t) 0x300)#define PPSMC_MSG_Didt_Block_Function ((uint16_t) 0x301) +#define PPSMC_MSG_EnableZeroRpm ((uint16_t) 0x302)#define PPSMC_MSG_SetVBITimeout ((uint16_t) 0x306)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_thermal.c +11 -0
@@ -175,6 +175,17 @@ int smu7_fan_ctrl_start_smc_fan_control(struct pp_hwmgr *hwmgr) hwmgr->thermal_controller. advanceFanControlParameters.ucTargetTemperature, NULL); + +if (!result && + (hwmgr->chip_id ==CHIP_POLARIS10 || + hwmgr->chip_id ==CHIP_POLARIS11 || + hwmgr->chip_id ==CHIP_POLARIS12 ) && + hwmgr->thermal_controller.advanceFanControlParameters.ucEnableZeroRPM && + !PP_CAP (PHM_PlatformCaps_customThermalManagement)) + result =smum_send_msg_to_smc (hwmgr, + PPSMC_MSG_EnableZeroRpm, +NULL ); + hwmgr->fan_ctrl_enabled = true;return result;
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +17 -0
@@ -470,6 +470,21 @@ static int polaris10_populate_bapm_parameters_in_dpm_table(struct pp_hwmgr *hwmgreturn 0 ; } +static void polaris10_populate_zero_rpm_parameters (struct pp_hwmgr *hwmgr) +{ +struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); +SMU74_Discrete_DpmTable *table = &(smu_data->smc_state_table); +uint16_t fan_stop_temp = + ((uint16_t )hwmgr->thermal_controller.advanceFanControlParameters.ucFanStopTemperature) <<8 ; +uint16_t fan_start_temp = + ((uint16_t )hwmgr->thermal_controller.advanceFanControlParameters.ucFanStartTemperature) <<8 ; + +if (hwmgr->thermal_controller.advanceFanControlParameters.ucEnableZeroRPM) { + table->FanStartTemperature =PP_HOST_TO_SMC_US (fan_start_temp); + table->FanStopTemperature =PP_HOST_TO_SMC_US (fan_stop_temp); + } +} +static int polaris10_populate_svi_load_line (struct pp_hwmgr *hwmgr) {struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend);
@@ -1949,6 +1964,8 @@ static int polaris10_init_smc_table(struct pp_hwmgr *hwmgr)PP_ASSERT_WITH_CODE (0 == result, "Failed to populate BAPM Parameters!", return result); +polaris10_populate_zero_rpm_parameters (hwmgr); +if (phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_ClockStretcher)) { result =polaris10_populate_clock_stretcher_data_table (hwmgr);
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 19/40 drm/amd/pm: add edc leakage controller setting
In reply to Evan QuanEnable edc controller table setting.
--- drivers/gpu/drm/amd/include/atombios.h | 16 ++ drivers/gpu/drm/amd/pm/inc/smu7_ppsmc.h | 3 + .../drm/amd/pm/powerplay/hwmgr/ppatomctrl.c | 53 ++++++ .../drm/amd/pm/powerplay/hwmgr/ppatomctrl.h | 22 +++ .../drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 154 ++++++++++++++++++ .../drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.h | 4 + 6 files changed, 252 insertions(+)
drivers/gpu/drm/amd/include/atombios.h +16 -0
@@ -5655,6 +5655,22 @@ typedef struct _ATOM_GFX_INFO_V2_1UCHAR max_texture_channel_caches; }ATOM_GFX_INFO_V2_1 ; +typedef struct _ATOM_GFX_INFO_V2_3 +{ +ATOM_COMMON_TABLE_HEADER asHeader; +UCHAR GfxIpMinVer; +UCHAR GfxIpMajVer; +UCHAR max_shader_engines; +UCHAR max_tile_pipes; +UCHAR max_cu_per_sh; +UCHAR max_sh_per_se; +UCHAR max_backends_per_se; +UCHAR max_texture_channel_caches; +USHORT usHiLoLeakageThreshold; +USHORT usEdcDidtLoDpm7TableOffset;//offset of DPM7 low leakage table _ATOM_EDC_DIDT_TABLE_V1 +USHORT usEdcDidtHiDpm7TableOffset;//offset of DPM7 high leakage table _ATOM_EDC_DIDT_TABLE_V1 +USHORT usReserverd[3 ]; +}ATOM_GFX_INFO_V2_3 ; typedef struct _ATOM_POWER_SOURCE_OBJECT {
drivers/gpu/drm/amd/pm/inc/smu7_ppsmc.h +3 -0
@@ -404,6 +404,9 @@ typedef uint16_t PPSMC_Result;#define PPSMC_MSG_EnableDpmDidt ((uint16_t) 0x309)#define PPSMC_MSG_DisableDpmDidt ((uint16_t) 0x30A) +#define PPSMC_MSG_EnableEDCController ((uint16_t) 0x316) +#define PPSMC_MSG_DisableEDCController ((uint16_t) 0x317) +#define PPSMC_MSG_SecureSRBMWrite ((uint16_t) 0x600)#define PPSMC_MSG_SecureSRBMRead ((uint16_t) 0x601)#define PPSMC_MSG_SetAddress ((uint16_t) 0x800)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c +53 -0
56 lines not on this page · raw message
drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.h +22 -0
@@ -278,6 +278,20 @@ struct pp_atom_ctrl__avfs_parameters {uint8_t ucReserved; }; +struct _AtomCtrl_HiLoLeakageOffsetTable +{ +USHORT usHiLoLeakageThreshold; +USHORT usEdcDidtLoDpm7TableOffset; +USHORT usEdcDidtHiDpm7TableOffset; +}; +typedef struct _AtomCtrl_HiLoLeakageOffsetTable AtomCtrl_HiLoLeakageOffsetTable ; + +struct _AtomCtrl_EDCLeakgeTable +{ +ULONG DIDT_REG[24 ]; +}; +typedef struct _AtomCtrl_EDCLeakgeTable AtomCtrl_EDCLeakgeTable ; +extern bool atomctrl_get_pp_assign_pin (struct pp_hwmgr *hwmgr,const uint32_t pinId,pp_atomctrl_gpio_pin_assignment *gpio_pin_assignment);extern int atomctrl_get_voltage_evv_on_sclk (struct pp_hwmgr *hwmgr,uint8_t voltage_type,uint32_t sclk,uint16_t virtual_voltage_Id,uint16_t *voltage);extern int atomctrl_get_voltage_evv (struct pp_hwmgr *hwmgr,uint16_t virtual_voltage_id,uint16_t *voltage);
@@ -324,5 +338,13 @@ extern int atomctrl_get_leakage_id_from_efuse(struct pp_hwmgr *hwmgr, uint16_t *extern void atomctrl_get_voltage_range (struct pp_hwmgr *hwmgr,uint32_t *max_vddc,uint32_t *min_vddc); + +extern int atomctrl_get_edc_hilo_leakage_offset_table (struct pp_hwmgr *hwmgr, +AtomCtrl_HiLoLeakageOffsetTable *table); + +extern int atomctrl_get_edc_leakage_table (struct pp_hwmgr *hwmgr, +AtomCtrl_EDCLeakgeTable *table, +uint16_t offset); +#endif
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +154 -0
190 lines not on this page · raw message
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.h +4 -0
@@ -331,6 +331,10 @@ struct smu7_hwmgr {uint32_t ro_range_minimum;uint32_t ro_range_maximum; + +bool disable_edc_leakage_controller; +AtomCtrl_HiLoLeakageOffsetTable edc_hilo_leakage_offset_from_vbios; +AtomCtrl_EDCLeakgeTable edc_leakage_table; };/* To convert to Q8.8 format for firmware */
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 20/40 drm/amd/pm: add mc register table initialization
In reply to Evan QuanAdd mc register table initialization.
--- .../drm/amd/pm/powerplay/hwmgr/ppatomctrl.c | 37 +++++++++++++++++++ .../drm/amd/pm/powerplay/hwmgr/ppatomctrl.h | 1 + .../pm/powerplay/smumgr/polaris10_smumgr.c | 19 ++++++++++ .../pm/powerplay/smumgr/polaris10_smumgr.h | 1 + 4 files changed, 58 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c +37 -0
@@ -166,6 +166,43 @@ int atomctrl_initialize_mc_reg_table(return result; } +int atomctrl_initialize_mc_reg_table_v2_2 ( +struct pp_hwmgr *hwmgr, +uint8_t module_index, +pp_atomctrl_mc_reg_table *table) +{ +ATOM_VRAM_INFO_HEADER_V2_2 *vram_info; +ATOM_INIT_REG_BLOCK *reg_block; +int result =0 ; +u8 frev, crev; +u16 size; + + vram_info = (ATOM_VRAM_INFO_HEADER_V2_2 *) +smu_atom_get_data_table (hwmgr->adev, +GetIndexIntoMasterTable (DATA , VRAM_Info), &size, &frev, &crev); + +if (module_index >= vram_info->ucNumOfVRAMModule) { +pr_err ("Invalid VramInfo table." ); + result =-1 ; + }else if (vram_info->sHeader.ucTableFormatRevision <2 ) { +pr_err ("Invalid VramInfo table." ); + result =-1 ; + } + +if (0 == result) { + reg_block = (ATOM_INIT_REG_BLOCK *) + ((uint8_t *)vram_info +le16_to_cpu (vram_info->usMemClkPatchTblOffset)); + result =atomctrl_set_mc_reg_address_table (reg_block, table); + } + +if (0 == result) { + result =atomctrl_retrieve_ac_timing (module_index, + reg_block, table); + } + +return result; +} +/** * Set DRAM timings based on engine clock and memory clock. */
drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.h +1 -0
@@ -299,6 +299,7 @@ extern uint32_t atomctrl_get_mpll_reference_clock(struct pp_hwmgr *hwmgr);extern int atomctrl_get_memory_clock_spread_spectrum (struct pp_hwmgr *hwmgr,const uint32_t memory_clock,pp_atomctrl_internal_ss_info *ssInfo);extern int atomctrl_get_engine_clock_spread_spectrum (struct pp_hwmgr *hwmgr,const uint32_t engine_clock,pp_atomctrl_internal_ss_info *ssInfo);extern int atomctrl_initialize_mc_reg_table (struct pp_hwmgr *hwmgr,uint8_t module_index,pp_atomctrl_mc_reg_table *table); +extern int atomctrl_initialize_mc_reg_table_v2_2 (struct pp_hwmgr *hwmgr,uint8_t module_index,pp_atomctrl_mc_reg_table *table);extern int atomctrl_set_engine_dram_timings_rv770 (struct pp_hwmgr *hwmgr,uint32_t engine_clock,uint32_t memory_clock);extern uint32_t atomctrl_get_reference_clock (struct pp_hwmgr *hwmgr);extern int atomctrl_get_memory_pll_dividers_si (struct pp_hwmgr *hwmgr,uint32_t clock_value,pp_atomctrl_memory_clock_param *mpll_param,bool strobe_mode);
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +19 -0
@@ -2522,6 +2522,24 @@ static int polaris10_process_firmware_header(struct pp_hwmgr *hwmgr)return error ?-1 :0 ; } +static uint8_t polaris10_get_memory_modile_index (struct pp_hwmgr *hwmgr) +{ +return (uint8_t ) (0xFF & (cgs_read_register (hwmgr->device, mmBIOS_SCRATCH_4) >>16 )); +} + +static int polaris10_initialize_mc_reg_table (struct pp_hwmgr *hwmgr) +{ +int result; +struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); +pp_atomctrl_mc_reg_table *mc_reg_table = &smu_data->mc_reg_table; +uint8_t module_index =polaris10_get_memory_modile_index (hwmgr); + +memset (mc_reg_table,0 ,sizeof (pp_atomctrl_mc_reg_table)); + result =atomctrl_initialize_mc_reg_table_v2_2 (hwmgr, module_index, mc_reg_table); + +return result; +} + static bool polaris10_is_dpm_running(struct pp_hwmgr *hwmgr) { return (1 == PHM_READ_INDIRECT_FIELD(hwmgr->device,
@@ -2648,6 +2666,7 @@ const struct pp_smumgr_func polaris10_smu_funcs = { .populate_all_graphic_levels = polaris10_populate_all_graphic_levels, .populate_all_memory_levels = polaris10_populate_all_memory_levels, .get_mac_definition = polaris10_get_mac_definition, + .initialize_mc_reg_table = polaris10_initialize_mc_reg_table, .is_dpm_running = polaris10_is_dpm_running, .is_hw_avfs_present = polaris10_is_hw_avfs_present, .update_dpm_settings = polaris10_update_dpm_settings,
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.h +1 -0
@@ -60,6 +60,7 @@ struct polaris10_smumgr {struct polaris10_range_table range_table[NUM_SCLK_RANGE ];const struct polaris10_pt_defaults *power_tune_defaults;uint32_t bif_sclk_table[SMU74_MAX_LEVELS_LINK ]; +pp_atomctrl_mc_reg_table mc_reg_table; };
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 21/40 drm/amd/pm: correct VR shared rail info
In reply to Evan QuanAdd VR shared rail info.
--- drivers/gpu/drm/amd/include/atombios.h | 4 +++- drivers/gpu/drm/amd/pm/inc/smu74_discrete.h | 3 ++- .../gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c | 14 ++++++++++++++ .../gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.h | 1 + .../drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c | 14 ++++++++++++++ 5 files changed, 34 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/include/atombios.h +3 -1
@@ -5636,7 +5636,9 @@ typedef struct _ATOM_SMU_INFO_V2_1 {ATOM_COMMON_TABLE_HEADER asHeader;UCHAR ucSclkEntryNum;// for potential future extend, indicate the number of ATOM_SCLK_FCW_RANGE_ENTRY_V1 -UCHAR ucReserved[3 ]; +UCHAR ucSMUVer; +UCHAR ucSharePowerSource; +UCHAR ucReserved;ATOM_SCLK_FCW_RANGE_ENTRY_V1 asSclkFcwRangeEntry[8 ]; }ATOM_SMU_INFO_V2_1 ;
drivers/gpu/drm/amd/pm/inc/smu74_discrete.h +2 -1
@@ -271,7 +271,8 @@ struct SMU74_Discrete_DpmTable {uint8_t VRHotLevel;uint8_t LdoRefSel; -uint8_t Reserved1[2 ]; +uint8_t SharedRails; +uint8_t Reserved1;uint16_t FanStartTemperature;uint16_t FanStopTemperature;uint16_t MaxVoltage;
drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c +14 -0
@@ -1427,6 +1427,20 @@ int atomctrl_get_smc_sclk_range_table(struct pp_hwmgr *hwmgr, struct pp_atom_ctrreturn 0 ; } +int atomctrl_get_vddc_shared_railinfo (struct pp_hwmgr *hwmgr,uint8_t *shared_rail) +{ +ATOM_SMU_INFO_V2_1 *psmu_info = + (ATOM_SMU_INFO_V2_1 *)smu_atom_get_data_table (hwmgr->adev, +GetIndexIntoMasterTable (DATA , SMU_Info), +NULL ,NULL ,NULL ); +if (!psmu_info) +return -1 ; + + *shared_rail = psmu_info->ucSharePowerSource; + +return 0 ; +} +int atomctrl_get_avfs_information (struct pp_hwmgr *hwmgr,struct pp_atom_ctrl__avfs_parameters *param) {
drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.h +1 -0
@@ -347,5 +347,6 @@ extern int atomctrl_get_edc_leakage_table(struct pp_hwmgr *hwmgr,AtomCtrl_EDCLeakgeTable *table, uint16_t offset); +extern int atomctrl_get_vddc_shared_railinfo (struct pp_hwmgr *hwmgr,uint8_t *shared_rail);#endif
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +14 -0
@@ -1016,6 +1016,16 @@ static int polaris10_populate_single_graphic_level(struct pp_hwmgr *hwmgr,return 0 ; } +static void polaris10_get_vddc_shared_railinfo (struct pp_hwmgr *hwmgr) +{ +struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend); +SMU74_Discrete_DpmTable *table = &(smu_data->smc_state_table); +uint8_t shared_rail; + +if (!atomctrl_get_vddc_shared_railinfo (hwmgr, &shared_rail)) + table->SharedRails = shared_rail; +} +static int polaris10_populate_all_graphic_levels (struct pp_hwmgr *hwmgr) {struct smu7_hwmgr *hw_data = (struct smu7_hwmgr *)(hwmgr->backend);
@@ -1041,6 +1051,10 @@ static int polaris10_populate_all_graphic_levels(struct pp_hwmgr *hwmgr)pp_atomctrl_clock_dividers_vi dividers;uint32_t dpm0_sclkfrequency = levels[0 ].SclkSetting.SclkFrequency; +if (ASICID_IS_P20 (adev->pdev->device, adev->pdev->revision) || +ASICID_IS_P30 (adev->pdev->device, adev->pdev->revision)) +polaris10_get_vddc_shared_railinfo (hwmgr); +polaris10_get_sclk_range_table (hwmgr, &(smu_data->smc_state_table));for (i =0 ; i < dpm_table->sclk_table.count; i++) {
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 22/40 drm/amd/pm: correct the checks for sclk/mclk SS support
In reply to Evan QuanCorrect sclk/mclk SS support checks.
--- drivers/gpu/drm/amd/pm/powerplay/hwmgr/hwmgr.c | 5 +++++ drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c | 13 ++++++++++++- drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.h | 2 ++ drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 7 +++++++ 4 files changed, 26 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/hwmgr.c +5 -0
@@ -478,6 +478,11 @@ int polaris_set_asic_special_caps(struct pp_hwmgr *hwmgr)phm_cap_set (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_RegulatorHot); +phm_cap_set (hwmgr->platform_descriptor.platformCaps, + PHM_PlatformCaps_MemorySpreadSpectrumSupport); +phm_cap_set (hwmgr->platform_descriptor.platformCaps, + PHM_PlatformCaps_EngineSpreadSpectrumSupport); +phm_cap_set (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_AutomaticDCTransition);
drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c +12 -1
@@ -1231,7 +1231,7 @@ uint32_t atomctrl_get_mpll_reference_clock(struct pp_hwmgr *hwmgr)/** * Get the asic internal spread spectrum table */ -static ATOM_ASIC_INTERNAL_SS_INFO *asic_internal_ss_get_ss_table (void *device) +ATOM_ASIC_INTERNAL_SS_INFO *asic_internal_ss_get_ss_table (void *device) {ATOM_ASIC_INTERNAL_SS_INFO *table =NULL ;u8 frev, crev;
@@ -1245,6 +1245,17 @@ static ATOM_ASIC_INTERNAL_SS_INFO *asic_internal_ss_get_ss_table(void *device)return table; } +bool atomctrl_is_asic_internal_ss_supported (struct pp_hwmgr *hwmgr) +{ +ATOM_ASIC_INTERNAL_SS_INFO *table = +asic_internal_ss_get_ss_table (hwmgr->adev); + +if (table) +return true; +else +return false; +} +/** * Get the asic internal spread spectrum assignment */
drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.h +2 -0
@@ -296,6 +296,8 @@ extern bool atomctrl_get_pp_assign_pin(struct pp_hwmgr *hwmgr, const uint32_t piextern int atomctrl_get_voltage_evv_on_sclk (struct pp_hwmgr *hwmgr,uint8_t voltage_type,uint32_t sclk,uint16_t virtual_voltage_Id,uint16_t *voltage);extern int atomctrl_get_voltage_evv (struct pp_hwmgr *hwmgr,uint16_t virtual_voltage_id,uint16_t *voltage);extern uint32_t atomctrl_get_mpll_reference_clock (struct pp_hwmgr *hwmgr); + +bool atomctrl_is_asic_internal_ss_supported (struct pp_hwmgr *hwmgr);extern int atomctrl_get_memory_clock_spread_spectrum (struct pp_hwmgr *hwmgr,const uint32_t memory_clock,pp_atomctrl_internal_ss_info *ssInfo);extern int atomctrl_get_engine_clock_spread_spectrum (struct pp_hwmgr *hwmgr,const uint32_t engine_clock,pp_atomctrl_internal_ss_info *ssInfo);extern int atomctrl_initialize_mc_reg_table (struct pp_hwmgr *hwmgr,uint8_t module_index,pp_atomctrl_mc_reg_table *table);
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +7 -0
@@ -1811,6 +1811,13 @@ static void smu7_init_dpm_defaults(struct pp_hwmgr *hwmgr) (adev->asic_type ==CHIP_POLARIS12 ) || (adev->asic_type == CHIP_VEGAM)) data->disable_edc_leakage_controller = false; + +if (!atomctrl_is_asic_internal_ss_supported (hwmgr)) { +phm_cap_unset (hwmgr->platform_descriptor.platformCaps, + PHM_PlatformCaps_MemorySpreadSpectrumSupport); +phm_cap_unset (hwmgr->platform_descriptor.platformCaps, + PHM_PlatformCaps_EngineSpreadSpectrumSupport); + } }static int smu7_calculate_ro_range (struct pp_hwmgr *hwmgr)
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 23/40 drm/amd/pm: correct Polaris powertune table setup
In reply to Evan QuanCorrect powertune table setup for Polaris.
--- drivers/gpu/drm/amd/pm/inc/hwmgr.h | 1 + .../drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h | 36 ++++++++++++++ .../powerplay/hwmgr/process_pptables_v1_0.c | 49 ++++++++++++++++++- 3 files changed, 85 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/inc/hwmgr.h +1 -0
@@ -441,6 +441,7 @@ struct phm_cac_tdp_table {uint8_t ucPlx_I2C_Line;uint32_t usBoostPowerLimit;uint8_t ucCKS_LDO_REFSEL; +uint8_t ucHotSpotOnly; };struct phm_tdp_table {
drivers/gpu/drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h +36 -0
@@ -419,6 +419,42 @@ typedef struct _ATOM_Fiji_PowerTune_Table {USHORT usReserved; } ATOM_Fiji_PowerTune_Table; +typedef struct _ATOM_Polaris_PowerTune_Table +{ +UCHAR ucRevId; +USHORT usTDP; +USHORT usConfigurableTDP; +USHORT usTDC; +USHORT usBatteryPowerLimit; +USHORT usSmallPowerLimit; +USHORT usLowCACLeakage; +USHORT usHighCACLeakage; +USHORT usMaximumPowerDeliveryLimit; +USHORT usTjMax;// For Fiji, this is also usTemperatureLimitEdge; +USHORT usPowerTuneDataSetID; +USHORT usEDCLimit; +USHORT usSoftwareShutdownTemp; +USHORT usClockStretchAmount; +USHORT usTemperatureLimitHotspot;//The following are added for Fiji +USHORT usTemperatureLimitLiquid1; +USHORT usTemperatureLimitLiquid2; +USHORT usTemperatureLimitVrVddc; +USHORT usTemperatureLimitVrMvdd; +USHORT usTemperatureLimitPlx; +UCHAR ucLiquid1_I2C_address;//Liquid +UCHAR ucLiquid2_I2C_address; +UCHAR ucLiquid_I2C_Line; +UCHAR ucVr_I2C_address;//VR +UCHAR ucVr_I2C_Line; +UCHAR ucPlx_I2C_address;//PLX +UCHAR ucPlx_I2C_Line; +USHORT usBoostPowerLimit; +UCHAR ucCKS_LDO_REFSEL; +UCHAR ucHotSpotOnly; +UCHAR ucReserve; +USHORT usReserve; +}ATOM_Polaris_PowerTune_Table ; +#define ATOM_PPM_A_A 1#define ATOM_PPM_A_I 2 typedef struct _ATOM_Tonga_PPM_Table {
drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c +48 -1
61 lines not on this page · raw message
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 24/40 drm/amd/pm: correct Polaris DIDT configurations
In reply to Evan QuanCorrect Polaris DIDT enablement.
--- drivers/gpu/drm/amd/pm/inc/smu7_ppsmc.h | 2 ++ .../amd/pm/powerplay/hwmgr/smu7_powertune.c | 34 +++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/inc/smu7_ppsmc.h +2 -0
@@ -403,6 +403,8 @@ typedef uint16_t PPSMC_Result;#define PPSMC_MSG_EnableDpmDidt ((uint16_t) 0x309)#define PPSMC_MSG_DisableDpmDidt ((uint16_t) 0x30A) +#define PPSMC_MSG_EnableDpmMcBlackout ((uint16_t) 0x30B) +#define PPSMC_MSG_DisableDpmMcBlackout ((uint16_t) 0x30C)#define PPSMC_MSG_EnableEDCController ((uint16_t) 0x316)#define PPSMC_MSG_DisableEDCController ((uint16_t) 0x317)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_powertune.c +32 -2
@@ -852,12 +852,14 @@ static const struct gpu_pt_config_reg DIDTConfig_VegaM[] = };static int smu7_enable_didt (struct pp_hwmgr *hwmgr,const bool enable) { +struct amdgpu_device *adev = hwmgr->adev;uint32_t en = enable ?1 :0 ;uint32_t block_en =0 ;int32_t result =0 ;uint32_t didt_block; -if (hwmgr->chip_id ==CHIP_POLARIS11 ) +if ((hwmgr->chip_id ==CHIP_POLARIS11 ) && + (adev->pdev->subsystem_vendor !=0x106B )) didt_block = Polaris11_DIDTBlock_Info;else didt_block = DIDTBlock_Info;
@@ -962,6 +964,7 @@ int smu7_enable_didt_config(struct pp_hwmgr *hwmgr)uint32_t num_se =0 ;uint32_t count, value, value2;struct amdgpu_device *adev = hwmgr->adev; +uint32_t efuse; num_se = adev->gfx.config.max_shader_engines;
@@ -988,7 +991,9 @@ int smu7_enable_didt_config(struct pp_hwmgr *hwmgr) }else if (hwmgr->chip_id ==CHIP_POLARIS11 ) { result =smu7_program_pt_config_registers (hwmgr, GCCACConfig_Polaris11); PP_ASSERT_WITH_CODE((result == 0), "DIDT Config failed.", goto error); -if (hwmgr->is_kicker) + +if (ASICID_IS_P21 (adev->pdev->device, adev->pdev->revision) || +ASICID_IS_P31 (adev->pdev->device, adev->pdev->revision)) result =smu7_program_pt_config_registers (hwmgr, DIDTConfig_Polaris11_Kicker);else result =smu7_program_pt_config_registers (hwmgr, DIDTConfig_Polaris11);
@@ -1016,7 +1021,32 @@ int smu7_enable_didt_config(struct pp_hwmgr *hwmgr) NULL);PP_ASSERT_WITH_CODE ((0 == result), "Failed to enable DPM DIDT.", goto error); + +if (ASICID_IS_P21 (adev->pdev->device, adev->pdev->revision) || +ASICID_IS_P31 (adev->pdev->device, adev->pdev->revision)) { + result =smum_send_msg_to_smc (hwmgr, + (uint16_t )(PPSMC_MSG_EnableDpmMcBlackout), +NULL ); +PP_ASSERT_WITH_CODE ((0 == result), + "Failed to enable workaround for CRC issue.", goto error); + }else { +atomctrl_read_efuse (hwmgr,547 ,547 , &efuse); +if (efuse ==1 ) { + result =smum_send_msg_to_smc (hwmgr, + (uint16_t )(PPSMC_MSG_EnableDpmMcBlackout), +NULL ); +PP_ASSERT_WITH_CODE ((0 == result), + "Failed to enable workaround for CRC issue.", goto error); + }else { + result =smum_send_msg_to_smc (hwmgr, + (uint16_t )(PPSMC_MSG_DisableDpmMcBlackout), +NULL ); +PP_ASSERT_WITH_CODE ((0 == result), + "Failed to enable workaround for CRC issue.", goto error); + } + } } +mutex_unlock (&adev->grbm_idx_mutex);amdgpu_gfx_rlc_exit_safe_mode (adev); }
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 25/40 drm/amd/pm: correct avfs fuse settings
In reply to Evan QuanCorrect Polaris10 avfs fuse setting.
--- .../pm/powerplay/smumgr/polaris10_smumgr.c | 55 ++++++++----------- 1 file changed, 23 insertions(+), 32 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +23 -32
@@ -1760,16 +1760,18 @@ static int polaris10_populate_avfs_parameters(struct pp_hwmgr *hwmgr)if (!hwmgr->avfs_supported)return 0 ; + +if (SMU7_VOLTAGE_CONTROL_BY_GPIO == data->voltage_control) { + hwmgr->avfs_supported =0 ; +return 0 ; + } + result =atomctrl_get_avfs_information (hwmgr, &avfs_params);if (0 == result) { -if (((adev->pdev->device ==0x67ef ) && - ((adev->pdev->revision ==0xe0 ) || - (adev->pdev->revision ==0xe5 ))) || - ((adev->pdev->device ==0x67ff ) && - ((adev->pdev->revision ==0xcf ) || - (adev->pdev->revision ==0xef ) || - (adev->pdev->revision ==0xff )))) { +if (ASICID_IS_P20 (adev->pdev->device, adev->pdev->revision) || + ((hwmgr->chip_id ==CHIP_POLARIS12 ) && !ASICID_IS_P23 (adev->pdev->device, adev->pdev->revision)) || +ASICID_IS_P21 (adev->pdev->device, adev->pdev->revision)) { avfs_params.ucEnableApplyAVFS_CKS_OFF_Voltage =1 ;if ((adev->pdev->device ==0x67ef && adev->pdev->revision ==0xe5 ) || (adev->pdev->device ==0x67ff && adev->pdev->revision ==0xef )) {
@@ -1786,32 +1788,21 @@ static int polaris10_populate_avfs_parameters(struct pp_hwmgr *hwmgr) avfs_params.usAVFSGB_FUSE_TABLE_CKSOFF_m2 =0 ; avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_b =0x23 ; } + }else if (hwmgr->chip_id ==CHIP_POLARIS12 && !ASICID_IS_P23 (adev->pdev->device, adev->pdev->revision)) { + avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a0 =0xF6B024DD ; + avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a1 =0x3005E ; + avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a2 =0x18A5F ; + avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_m1 =0x315 ; + avfs_params.usAVFSGB_FUSE_TABLE_CKSOFF_m2 =0xFED1 ; + avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_b =0x3B ; + }else if (ASICID_IS_P20 (adev->pdev->device, adev->pdev->revision)) { + avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a0 =0xF843B66B ; + avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a1 =0x59CB5 ; + avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a2 =0xFFFF287F ; + avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_m1 =0 ; + avfs_params.usAVFSGB_FUSE_TABLE_CKSOFF_m2 =0xFF23 ; + avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_b =0x58 ; } - }else if (hwmgr->chip_id ==CHIP_POLARIS12 && !hwmgr->is_kicker) { - avfs_params.ucEnableApplyAVFS_CKS_OFF_Voltage =1 ; - avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a0 =0xF6B024DD ; - avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a1 =0x3005E ; - avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a2 =0x18A5F ; - avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_m1 =0x315 ; - avfs_params.usAVFSGB_FUSE_TABLE_CKSOFF_m2 =0xFED1 ; - avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_b =0x3B ; - }else if (((adev->pdev->device ==0x67df ) && - ((adev->pdev->revision ==0xe0 ) || - (adev->pdev->revision ==0xe3 ) || - (adev->pdev->revision ==0xe4 ) || - (adev->pdev->revision ==0xe5 ) || - (adev->pdev->revision ==0xe7 ) || - (adev->pdev->revision ==0xef ))) || - ((adev->pdev->device ==0x6fdf ) && - ((adev->pdev->revision ==0xef ) || - (adev->pdev->revision ==0xff )))) { - avfs_params.ucEnableApplyAVFS_CKS_OFF_Voltage =1 ; - avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a0 =0xF843B66B ; - avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a1 =0x59CB5 ; - avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a2 =0xFFFF287F ; - avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_m1 =0 ; - avfs_params.usAVFSGB_FUSE_TABLE_CKSOFF_m2 =0xFF23 ; - avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_b =0x58 ; } }
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 26/40 drm/amd/pm: correct vddc phase control setting
In reply to Evan QuanCorrect Polaris10 vddc phase control.
--- .../drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 31 +++++++++++-------- .../pm/powerplay/smumgr/polaris10_smumgr.c | 7 ++++- 2 files changed, 24 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +18 -13
@@ -1664,6 +1664,8 @@ static void smu7_init_dpm_defaults(struct pp_hwmgr *hwmgr)struct phm_ppt_v1_information *table_info = (struct phm_ppt_v1_information *)(hwmgr->pptable);struct amdgpu_device *adev = hwmgr->adev; +uint8_t tmp1, tmp2; +uint16_t tmp3 =0 ; data->dll_default_on = false; data->mclk_dpm0_activity_target =0xa ;
@@ -1712,19 +1714,6 @@ static void smu7_init_dpm_defaults(struct pp_hwmgr *hwmgr) hwmgr->power_profile_mode =PP_SMC_POWER_PROFILE_FULLSCREEN3D ; hwmgr->default_power_profile_mode =PP_SMC_POWER_PROFILE_FULLSCREEN3D ; -if (hwmgr->chip_id ==CHIP_POLARIS12 || hwmgr->is_kicker) { -uint8_t tmp1, tmp2; -uint16_t tmp3 =0 ; -atomctrl_get_svi2_info (hwmgr,VOLTAGE_TYPE_VDDC , &tmp1, &tmp2, - &tmp3); - tmp3 = (tmp3 >>5 ) &0x3 ; - data->vddc_phase_shed_control = ((tmp3 <<1 ) | (tmp3 >>1 )) &0x3 ; - }else if (hwmgr->chip_family ==AMDGPU_FAMILY_CI ) { - data->vddc_phase_shed_control =1 ; - }else { - data->vddc_phase_shed_control =0 ; - } -if (hwmgr->chip_id ==CHIP_HAWAII ) { data->thermal_temp_setting.temperature_low =94500 ; data->thermal_temp_setting.temperature_high =95000 ;
@@ -1783,6 +1772,22 @@ static void smu7_init_dpm_defaults(struct pp_hwmgr *hwmgr)phm_cap_unset (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_ControlVDDCI); + data->vddc_phase_shed_control =1 ; +if ((hwmgr->chip_id ==CHIP_POLARIS12 ) || +ASICID_IS_P20 (adev->pdev->device, adev->pdev->revision) || +ASICID_IS_P21 (adev->pdev->device, adev->pdev->revision) || +ASICID_IS_P30 (adev->pdev->device, adev->pdev->revision) || +ASICID_IS_P31 (adev->pdev->device, adev->pdev->revision)) { +if (data->voltage_control ==SMU7_VOLTAGE_CONTROL_BY_SVID2 ) { +atomctrl_get_svi2_info (hwmgr,VOLTAGE_TYPE_VDDC , &tmp1, &tmp2, + &tmp3); + tmp3 = (tmp3 >>5 ) &0x3 ; + data->vddc_phase_shed_control = ((tmp3 <<1 ) | (tmp3 >>1 )) &0x3 ; + } + }else if (hwmgr->chip_family ==AMDGPU_FAMILY_CI ) { + data->vddc_phase_shed_control =1 ; + } +if ((hwmgr->pp_table_version !=PP_TABLE_V0 ) && (hwmgr->feature_mask &PP_CLOCK_STRETCH_MASK ) && (table_info->cac_dtp_table->usClockStretchAmount !=0 )) phm_cap_set(hwmgr->platform_descriptor.platformCaps,
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +6 -1
@@ -779,6 +779,7 @@ static int polaris10_populate_ulv_level(struct pp_hwmgr *hwmgr,struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);struct phm_ppt_v1_information *table_info = (struct phm_ppt_v1_information *)(hwmgr->pptable); +struct amdgpu_device *adev = hwmgr->adev; state->CcPwrDynRm =0 ; state->CcPwrDynRm1 =0 ;
@@ -787,7 +788,11 @@ static int polaris10_populate_ulv_level(struct pp_hwmgr *hwmgr, state->VddcOffsetVid = (uint8_t )(table_info->us_ulv_voltage_offset *VOLTAGE_VID_OFFSET_SCALE2 /VOLTAGE_VID_OFFSET_SCALE1 ); -if (hwmgr->chip_id ==CHIP_POLARIS12 || hwmgr->is_kicker) +if ((hwmgr->chip_id ==CHIP_POLARIS12 ) || +ASICID_IS_P20 (adev->pdev->device, adev->pdev->revision) || +ASICID_IS_P21 (adev->pdev->device, adev->pdev->revision) || +ASICID_IS_P30 (adev->pdev->device, adev->pdev->revision) || +ASICID_IS_P31 (adev->pdev->device, adev->pdev->revision)) state->VddcPhase = data->vddc_phase_shed_control ^0x3 ;else state->VddcPhase = (data->vddc_phase_shed_control) ?0 :1 ;
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 27/40 drm/amd/pm: correct VRconfig setting
In reply to Evan QuanCorrect Polaris VRconfig setting.
--- .../amd/pm/powerplay/smumgr/polaris10_smumgr.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +14 -1
@@ -1712,6 +1712,9 @@ static int polaris10_populate_vr_config(struct pp_hwmgr *hwmgr,if (SMU7_VOLTAGE_CONTROL_BY_SVID2 == data->voltage_control) { config =VR_SVI2_PLANE_1 ; table->VRConfig |= config; + }else if (SMU7_VOLTAGE_CONTROL_BY_GPIO == data->voltage_control) { + config =VR_SMIO_PATTERN_1 ; + table->VRConfig |= config; }else { PP_ASSERT_WITH_CODE(false, "VDDC should be on SVI2 control in merged mode!",
@@ -1730,7 +1733,17 @@ static int polaris10_populate_vr_config(struct pp_hwmgr *hwmgr, }/* Set Mvdd Voltage Controller */ if (SMU7_VOLTAGE_CONTROL_BY_SVID2 == data->mvdd_control) { - config =VR_SVI2_PLANE_2 ; +if (config !=VR_SVI2_PLANE_2 ) { + config =VR_SVI2_PLANE_2 ; + table->VRConfig |= (config <<VRCONF_MVDD_SHIFT ); +cgs_write_ind_register (hwmgr->device,CGS_IND_REG__SMC , smu_data->smu7_data.soft_regs_start + + offsetof(SMU74_SoftRegisters , AllowMvddSwitch),0x1 ); + }else { + config =VR_STATIC_VOLTAGE ; + table->VRConfig |= (config <<VRCONF_MVDD_SHIFT ); + } + }else if (SMU7_VOLTAGE_CONTROL_BY_GPIO == data->mvdd_control) { + config =VR_SMIO_PATTERN_2 ; table->VRConfig |= (config <<VRCONF_MVDD_SHIFT );cgs_write_ind_register (hwmgr->device,CGS_IND_REG__SMC , smu_data->smu7_data.soft_regs_start + offsetof(SMU74_SoftRegisters , AllowMvddSwitch),0x1 );
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 28/40 drm/amd/pm: correct platformcaps setup
In reply to Evan QuanCorrect Polaris10 platformcaps setup.
--- drivers/gpu/drm/amd/pm/powerplay/hwmgr/hwmgr.c | 5 +++-- drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 11 +++++++++++ .../drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c | 7 +++++-- 3 files changed, 19 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/hwmgr.c +3 -2
@@ -486,9 +486,10 @@ int polaris_set_asic_special_caps(struct pp_hwmgr *hwmgr)phm_cap_set (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_AutomaticDCTransition); -if (hwmgr->chip_id !=CHIP_POLARIS10 ) +if (((hwmgr->chip_id ==CHIP_POLARIS11 ) && !hwmgr->is_kicker) || + (hwmgr->chip_id ==CHIP_POLARIS12 ))phm_cap_set (hwmgr->platform_descriptor.platformCaps, - PHM_PlatformCaps_SPLLShutdownSupport); + PHM_PlatformCaps_SPLLShutdownSupport);if (hwmgr->chip_id !=CHIP_POLARIS11 ) { phm_cap_set(hwmgr->platform_descriptor.platformCaps,
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +11 -0
@@ -1823,6 +1823,17 @@ static void smu7_init_dpm_defaults(struct pp_hwmgr *hwmgr)phm_cap_unset (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_EngineSpreadSpectrumSupport); } + +if ((adev->pdev->device ==0x699F ) && + (adev->pdev->revision ==0xCF )) { +phm_cap_unset (hwmgr->platform_descriptor.platformCaps, + PHM_PlatformCaps_PowerContainment); + data->enable_tdc_limit_feature = false; + data->enable_pkg_pwr_tracking_feature = false; + data->disable_edc_leakage_controller = true; +phm_cap_unset (hwmgr->platform_descriptor.platformCaps, + PHM_PlatformCaps_ClockStretcher); + } }static int smu7_calculate_ro_range (struct pp_hwmgr *hwmgr)
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +5 -2
@@ -2041,8 +2041,11 @@ static int polaris10_init_smc_table(struct pp_hwmgr *hwmgr)if (atomctrl_get_pp_assign_pin (hwmgr,PP_AC_DC_SWITCH_GPIO_PINID , &gpio_pin)) { table->AcDcGpio = gpio_pin.uc_gpio_pin_bit_shift; -phm_cap_set (hwmgr->platform_descriptor.platformCaps, - PHM_PlatformCaps_AutomaticDCTransition); +if (phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, + PHM_PlatformCaps_AutomaticDCTransition) && + !smum_send_msg_to_smc (hwmgr, PPSMC_MSG_UseNewGPIOScheme,NULL )) +phm_cap_set (hwmgr->platform_descriptor.platformCaps, + PHM_PlatformCaps_SMCtoPPLIBAcdcGpioScheme); }else { table->AcDcGpio =SMU7_UNUSED_GPIO_PIN ; phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 29/40 drm/amd/pm: correct smc voltage controller setup
In reply to Evan QuanCorrect Polaris10 smc voltage controller setup.
--- drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +2 -1
@@ -237,7 +237,8 @@ static int smu7_get_current_pcie_lane_number(struct pp_hwmgr *hwmgr)*/ static int smu7_enable_smc_voltage_controller (struct pp_hwmgr *hwmgr) { -if (hwmgr->chip_id ==CHIP_VEGAM ) { +if (hwmgr->chip_id >=CHIP_POLARIS10 && + hwmgr->chip_id <=CHIP_VEGAM ) {PHM_WRITE_VFPF_INDIRECT_FIELD (hwmgr->device,CGS_IND_REG__SMC ,PWR_SVI2_PLANE1_LOAD ,PSI1 ,0 ); PHM_WRITE_VFPF_INDIRECT_FIELD(hwmgr->device,
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 30/40 drm/amd/pm: correct sclk/mclk dpm enablement
In reply to Evan QuanCorrect Polaris10 sclk/mclk dpm enablement.
--- drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 9 +++++++-- .../gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +7 -2
@@ -1148,7 +1148,8 @@ static int smu7_enable_sclk_mclk_dpm(struct pp_hwmgr *hwmgr)/* enable SCLK dpm */ if (!data->sclk_dpm_key_disabled) { -if (hwmgr->chip_id ==CHIP_VEGAM ) +if (hwmgr->chip_id >=CHIP_POLARIS10 && + hwmgr->chip_id <=CHIP_VEGAM )smu7_disable_sclk_vce_handshake (hwmgr); PP_ASSERT_WITH_CODE(
@@ -1169,7 +1170,11 @@ static int smu7_enable_sclk_mclk_dpm(struct pp_hwmgr *hwmgr)"Failed to enable MCLK DPM during DPM Start Function!" , return -EINVAL); -if (hwmgr->chip_family !=CHIP_VEGAM ) +if ((hwmgr->chip_family ==AMDGPU_FAMILY_CI ) || + (hwmgr->chip_id ==CHIP_POLARIS10 ) || + (hwmgr->chip_id ==CHIP_POLARIS11 ) || + (hwmgr->chip_id ==CHIP_POLARIS12 ) || + (hwmgr->chip_id ==CHIP_TONGA ))PHM_WRITE_FIELD (hwmgr->device,MC_SEQ_CNTL_3 ,CAC_EN ,0x1 );
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +2 -1
@@ -2470,7 +2470,8 @@ static uint32_t polaris10_get_mac_definition(uint32_t value)case SMU_MAX_LEVELS_MVDD :return SMU74_MAX_LEVELS_MVDD ;case SMU_UVD_MCLK_HANDSHAKE_DISABLE : -return SMU7_UVD_MCLK_HANDSHAKE_DISABLE ; +return SMU7_UVD_MCLK_HANDSHAKE_DISABLE | +SMU7_VCE_MCLK_HANDSHAKE_DISABLE ; }pr_warn ("can't get the mac of %x\n" , value);
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 31/40 drm/amd/pm: correct the way to get the highest vddc
In reply to Evan QuanPopulate the correct highest vddc setting on Polaris.
--- .../drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +28 -2
@@ -2282,6 +2282,28 @@ static int smu7_complete_dependency_tables(struct pp_hwmgr *hwmgr)return result; } +static int smu7_find_highest_vddc (struct pp_hwmgr *hwmgr) +{ +struct phm_ppt_v1_information *table_info = + (struct phm_ppt_v1_information *)(hwmgr->pptable); +struct phm_ppt_v1_clock_voltage_dependency_table *allowed_sclk_vdd_table = + table_info->vdd_dep_on_sclk; +struct phm_ppt_v1_voltage_lookup_table *lookup_table = + table_info->vddc_lookup_table; +uint16_t highest_voltage; +uint32_t i; + + highest_voltage = allowed_sclk_vdd_table->entries[allowed_sclk_vdd_table->count -1 ].vddc; + +for (i =0 ; i < lookup_table->count; i++) { +if (lookup_table->entries[i].us_vdd <ATOM_VIRTUAL_VOLTAGE_ID0 && + lookup_table->entries[i].us_vdd > highest_voltage) + highest_voltage = lookup_table->entries[i].us_vdd; + } + +return highest_voltage; +} +static int smu7_set_private_data_based_on_pptable_v1 (struct pp_hwmgr *hwmgr) { struct phm_ppt_v1_information *table_info =
@@ -2310,8 +2332,12 @@ static int smu7_set_private_data_based_on_pptable_v1(struct pp_hwmgr *hwmgr) allowed_sclk_vdd_table->entries[allowed_sclk_vdd_table->count -1 ].clk; table_info->max_clock_voltage_on_ac.mclk = allowed_mclk_vdd_table->entries[allowed_mclk_vdd_table->count -1 ].clk; - table_info->max_clock_voltage_on_ac.vddc = - allowed_sclk_vdd_table->entries[allowed_sclk_vdd_table->count -1 ].vddc; +if (hwmgr->chip_id >=CHIP_POLARIS10 && hwmgr->chip_id <=CHIP_VEGAM ) + table_info->max_clock_voltage_on_ac.vddc = +smu7_find_highest_vddc (hwmgr); +else + table_info->max_clock_voltage_on_ac.vddc = + allowed_sclk_vdd_table->entries[allowed_sclk_vdd_table->count -1 ].vddc; table_info->max_clock_voltage_on_ac.vddci = allowed_mclk_vdd_table->entries[allowed_mclk_vdd_table->count -1 ].vddci;
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 32/40 drm/amd/pm: correct clk/voltage dependence setup
In reply to Evan QuanCorrect Polaris10 clk/voltage dependence setup.
--- drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +2 -0
@@ -401,6 +401,8 @@ static int polaris10_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr, *voltage |= (data->vbios_boot_state.vddci_bootup_value *VOLTAGE_SCALE ) <<VDDCI_SHIFT ; else if (dep_table->entries[i-1].vddci) { + *voltage |= (dep_table->entries[i -1 ].vddci *VOLTAGE_SCALE ) <<VDDC_SHIFT ; + } else { vddci =phm_find_closest_vddci (&(data->vddci_voltage_table), (dep_table->entries[i].vddc - (uint16_t )VDDC_VDDCI_DELTA ));
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 33/40 drm/amd/pm: correct pcie spc cap setup
In reply to Evan QuanCorrect Polaris10 pcie spc cap setting.
--- drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +2 -0
@@ -2865,6 +2865,8 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr) data->pcie_gen_cap = adev->pm.pcie_gen_mask;if (data->pcie_gen_cap &CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3 ) data->pcie_spc_cap =20 ; +else + data->pcie_spc_cap =16 ; data->pcie_lane_cap = adev->pm.pcie_mlw_mask; hwmgr->platform_descriptor.vbiosInterruptId =0x20000400 ;/* IRQ_SOURCE1_SW_INT */
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 34/40 drm/amd/pm: correct SMC sclk/mclk boot level setup
In reply to Evan QuanCorrect Polaris smc boot level setup.
--- .../gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c +8 -0
@@ -1587,10 +1587,18 @@ static int polaris10_populate_smc_boot_level(struct pp_hwmgr *hwmgr, result =phm_find_boot_level (&(data->dpm_table.sclk_table), data->vbios_boot_state.sclk_bootup_value, (uint32_t *)&(table->GraphicsBootLevel)); +if (result) { + table->GraphicsBootLevel =0 ; + result =0 ; + } result =phm_find_boot_level (&(data->dpm_table.mclk_table), data->vbios_boot_state.mclk_bootup_value, (uint32_t *)&(table->MemoryBootLevel)); +if (result) { + table->MemoryBootLevel =0 ; + result =0 ; + } table->BootVddc = data->vbios_boot_state.vddc_bootup_value *VOLTAGE_SCALE ;
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 35/40 drm/amd/pm: correct vddc_dep_on_dal_pwrl setup
In reply to Evan QuanCorrect Polaris10 setup.
--- .../drm/amd/pm/powerplay/hwmgr/smu_helper.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c +15 -3
@@ -505,11 +505,23 @@ int phm_initializa_dynamic_state_adjustment_rule_settings(struct pp_hwmgr *hwmgr }else { table_clk_vlt->count =4 ; table_clk_vlt->entries[0 ].clk =PP_DAL_POWERLEVEL_ULTRALOW ; - table_clk_vlt->entries[0 ].v =0 ; +if (hwmgr->chip_id >=CHIP_POLARIS10 && + hwmgr->chip_id <=CHIP_VEGAM ) + table_clk_vlt->entries[0 ].v =700 ; +else + table_clk_vlt->entries[0 ].v =0 ; table_clk_vlt->entries[1 ].clk =PP_DAL_POWERLEVEL_LOW ; - table_clk_vlt->entries[1 ].v =720 ; +if (hwmgr->chip_id >=CHIP_POLARIS10 && + hwmgr->chip_id <=CHIP_VEGAM ) + table_clk_vlt->entries[1 ].v =740 ; +else + table_clk_vlt->entries[1 ].v =720 ; table_clk_vlt->entries[2 ].clk =PP_DAL_POWERLEVEL_NOMINAL ; - table_clk_vlt->entries[2 ].v =810 ; +if (hwmgr->chip_id >=CHIP_POLARIS10 && + hwmgr->chip_id <=CHIP_VEGAM ) + table_clk_vlt->entries[2 ].v =800 ; +else + table_clk_vlt->entries[2 ].v =810 ; table_clk_vlt->entries[3 ].clk =PP_DAL_POWERLEVEL_PERFORMANCE ; table_clk_vlt->entries[3 ].v =900 ;if (pptable_info !=NULL )
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 36/40 drm/amd/pm: fulfill the Polaris implementation for get_clock_by_type_with_latency()
In reply to Evan QuanFulfill Polaris get_clock_by_type_with_latency().
--- .../drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +67 -0
@@ -5041,6 +5041,72 @@ static int smu7_get_clock_by_type(struct pp_hwmgr *hwmgr, enum amd_pp_clock_typereturn 0 ; } +static int smu7_get_sclks_with_latency (struct pp_hwmgr *hwmgr, +struct pp_clock_levels_with_latency *clocks) +{ +struct phm_ppt_v1_information *table_info = + (struct phm_ppt_v1_information *)hwmgr->pptable; +struct phm_ppt_v1_clock_voltage_dependency_table *dep_sclk_table = + table_info->vdd_dep_on_sclk; +int i; + + clocks->num_levels =0 ; +for (i =0 ; i < dep_sclk_table->count; i++) { +if (dep_sclk_table->entries[i].clk) { + clocks->data[clocks->num_levels].clocks_in_khz = + dep_sclk_table->entries[i].clk *10 ; + clocks->num_levels++; + } + } + +return 0 ; +} + +static int smu7_get_mclks_with_latency (struct pp_hwmgr *hwmgr, +struct pp_clock_levels_with_latency *clocks) +{ +struct phm_ppt_v1_information *table_info = + (struct phm_ppt_v1_information *)hwmgr->pptable; +struct phm_ppt_v1_clock_voltage_dependency_table *dep_mclk_table = + table_info->vdd_dep_on_mclk; +int i; + + clocks->num_levels =0 ; +for (i =0 ; i < dep_mclk_table->count; i++) { +if (dep_mclk_table->entries[i].clk) { + clocks->data[clocks->num_levels].clocks_in_khz = + dep_mclk_table->entries[i].clk *10 ; + clocks->data[clocks->num_levels].latency_in_us = +smu7_get_mem_latency (hwmgr, dep_mclk_table->entries[i].clk); + clocks->num_levels++; + } + } + +return 0 ; +} + +static int smu7_get_clock_by_type_with_latency (struct pp_hwmgr *hwmgr, +enum amd_pp_clock_type type, +struct pp_clock_levels_with_latency *clocks) +{ +if (!(hwmgr->chip_id >=CHIP_POLARIS10 && + hwmgr->chip_id <=CHIP_VEGAM )) +return -EINVAL ; + +switch (type) { +case amd_pp_sys_clock: +smu7_get_sclks_with_latency (hwmgr, clocks); +break ; +case amd_pp_mem_clock: +smu7_get_mclks_with_latency (hwmgr, clocks); +break ; +default : +return -EINVAL ; + } + +return 0 ; +} + static int smu7_notify_cac_buffer_info(struct pp_hwmgr *hwmgr, uint32_t virtual_addr_low, uint32_t virtual_addr_hi,
@@ -5458,6 +5524,7 @@ static const struct pp_hwmgr_func smu7_hwmgr_funcs = { .get_mclk_od = smu7_get_mclk_od, .set_mclk_od = smu7_set_mclk_od, .get_clock_by_type = smu7_get_clock_by_type, + .get_clock_by_type_with_latency = smu7_get_clock_by_type_with_latency, .read_sensor = smu7_read_sensor, .dynamic_state_management_disable = smu7_disable_dpm_tasks, .avfs_control = smu7_avfs_control,
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 37/40 drm/amd/pm: enable Polaris watermark table setting
In reply to Evan QuanEnable watermark table setting for Polaris.
--- .../amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c | 11 +++- .../drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 50 +++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c +10 -1
@@ -458,7 +458,16 @@ bool dm_pp_notify_wm_clock_changes(const struct dc_context *ctx, struct dm_pp_wm_sets_with_clock_ranges *wm_with_clock_ranges) { -/* TODO: to be implemented */ + struct amdgpu_device *adev = ctx->driver_context; +void *pp_handle = adev->powerplay.pp_handle; +const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; + +if (pp_funcs && pp_funcs->set_watermarks_for_clocks_ranges) { +if (!pp_funcs->set_watermarks_for_clocks_ranges (pp_handle, + (void *)wm_with_clock_ranges)) +return true; + } +return false; }
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +50 -0
68 lines not on this page · raw message
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 37/40] drm/amd/pm: enable Polaris watermark table setting
Hi guys,
this commit here completely breaks Vega20.
Any idea why a change for Polaris should have that effect? Can we please fix this ASAP?
Thanks,
Christian.
Am 16.10.20 um 05:26 schrieb Evan Quan:
Quoted 100 lines
Enable watermark table setting for Polaris.
Change-Id I395b74f2ce5b74e6d1c7659816ee386ba556e14cSigned-off-by Evan Quan <[email protected]>Acked-by Alex Deucher <[email protected]>--- .../amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c | 11 +++- .../drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 50 +++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c +10
-1@@ -458,7 +458,16 @@ bool dm_pp_notify_wm_clock_changes(const struct dc_context *ctx, struct dm_pp_wm_sets_with_clock_ranges *wm_with_clock_ranges) { -/* TODO: to be implemented */ + struct amdgpu_device *adev = ctx->driver_context; +void *pp_handle = adev->powerplay.pp_handle; +const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; + +if (pp_funcs && pp_funcs->set_watermarks_for_clocks_ranges) { +if (!pp_funcs->set_watermarks_for_clocks_ranges (pp_handle, + (void *)wm_with_clock_ranges)) +return true; + } +return false; }drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +49
-0@@ -49,6 +49,8 @@#include "processpptables.h" #include "pp_thermal.h" #include "smu7_baco.h" +#include "smu7_smumgr.h" +#include "polaris10_smumgr.h" #include "ivsrcid/ivsrcid_vislands30.h" @@ -5107,6 +5109,53 @@ static int smu7_get_clock_by_type_with_latency(struct pp_hwmgr *hwmgr,return 0 ; } +static int smu7_set_watermarks_for_clocks_ranges (struct pp_hwmgr *hwmgr, +void *clock_range) +{ +struct phm_ppt_v1_information *table_info = + (struct phm_ppt_v1_information *)hwmgr->pptable; +struct phm_ppt_v1_clock_voltage_dependency_table *dep_mclk_table = + table_info->vdd_dep_on_mclk; +struct phm_ppt_v1_clock_voltage_dependency_table *dep_sclk_table = + table_info->vdd_dep_on_sclk; +struct polaris10_smumgr *smu_data = + (struct polaris10_smumgr *)(hwmgr->smu_backend); +SMU74_Discrete_DpmTable *table = &(smu_data->smc_state_table); +struct dm_pp_wm_sets_with_clock_ranges *watermarks = + (struct dm_pp_wm_sets_with_clock_ranges *)clock_range; +uint32_t i, j, k; +bool valid_entry; + +if (!(hwmgr->chip_id >=CHIP_POLARIS10 && + hwmgr->chip_id <=CHIP_VEGAM )) +return -EINVAL ; + +for (i =0 ; i < dep_mclk_table->count; i++) { +for (j =0 ; j < dep_sclk_table->count; j++) { + valid_entry = false; +for (k =0 ; k < watermarks->num_wm_sets; k++) { +if (dep_sclk_table->entries[i].clk /10 >= watermarks->wm_clk_ranges[k].wm_min_eng_clk_in_khz && + dep_sclk_table->entries[i].clk /10 < watermarks->wm_clk_ranges[k].wm_max_eng_clk_in_khz && + dep_mclk_table->entries[i].clk /10 >= watermarks->wm_clk_ranges[k].wm_min_mem_clk_in_khz && + dep_mclk_table->entries[i].clk /10 < watermarks->wm_clk_ranges[k].wm_max_mem_clk_in_khz) { + valid_entry = true; + table->DisplayWatermark[i][j] = watermarks->wm_clk_ranges[k].wm_set_id; +break ; + } + } +PP_ASSERT_WITH_CODE (valid_entry, +"Clock is not in range of specified clock range for watermark from DAL! Using highest water mark set." , + table->DisplayWatermark[i][j] = watermarks->wm_clk_ranges[k -1 ].wm_set_id); + } + } + +return smu7_copy_bytes_to_smc (hwmgr, + smu_data->smu7_data.dpm_table_start + offsetof(SMU74_Discrete_DpmTable , DisplayWatermark), + (uint8_t *)table->DisplayWatermark, +sizeof (uint8_t ) *SMU74_MAX_LEVELS_MEMORY *SMU74_MAX_LEVELS_GRAPHICS , +SMC_RAM_END ); +} + static int smu7_notify_cac_buffer_info(struct pp_hwmgr *hwmgr, uint32_t virtual_addr_low, uint32_t virtual_addr_hi,
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c static const struct pp_hwmgr_func smu7_hwmgr_funcs = { · line 5580
Quoted 7 lines
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +1
-0@@ -5525,6 +5574,7 @@ static const struct pp_hwmgr_func smu7_hwmgr_funcs = { .set_mclk_od = smu7_set_mclk_od, .get_clock_by_type = smu7_get_clock_by_type, .get_clock_by_type_with_latency = smu7_get_clock_by_type_with_latency, + .set_watermarks_for_clocks_ranges = smu7_set_watermarks_for_clocks_ranges, .read_sensor = smu7_read_sensor, .dynamic_state_management_disable = smu7_disable_dpm_tasks, .avfs_control = smu7_avfs_control,
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 37/40] drm/amd/pm: enable Polaris watermark table setting
Quoted 33 lines · Christian König
Hi guys,
this commit here completely breaks Vega20.
Any idea why a change for Polaris should have that effect? Can we please fix this ASAP?
Thanks,
Christian.Am 16.10.20 um 05:26 schrieb Evan Quan:
Quoted 21 lines
Enable watermark table setting for Polaris.
Change-Id I395b74f2ce5b74e6d1c7659816ee386ba556e14cSigned-off-by Evan Quan <[email protected]>Acked-by Alex Deucher <[email protected]>--- .../amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c | 11 +++- .../drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 50 +++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c +2
-1@@ -458,7 +458,16 @@ bool dm_pp_notify_wm_clock_changes(const struct dc_context *ctx, struct dm_pp_wm_sets_with_clock_ranges *wm_with_clock_ranges) { -/* TODO: to be implemented */ + struct amdgpu_device *adev = ctx->driver_context; +void *pp_handle = adev->powerplay.pp_handle;
Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c bool dm_pp_notify_wm_clock_changes( · line 470
Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c +8
-0+const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; + +if (pp_funcs && pp_funcs->set_watermarks_for_clocks_ranges) { +if (!pp_funcs->set_watermarks_for_clocks_ranges (pp_handle, + (void *)wm_with_clock_ranges)) +return true; + } +
I suspect it's this hunk since it's common. I'd guess there is some problem with that functionality on vega20.
Alex
Quoted 75 lines
Quoted 75 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c +0
-0return false; }drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +50
-0@@ -49,6 +49,8 @@#include "processpptables.h" #include "pp_thermal.h" #include "smu7_baco.h" +#include "smu7_smumgr.h" +#include "polaris10_smumgr.h" #include "ivsrcid/ivsrcid_vislands30.h" @@ -5107,6 +5109,53 @@ static int smu7_get_clock_by_type_with_latency(struct pp_hwmgr *hwmgr,return 0 ; } +static int smu7_set_watermarks_for_clocks_ranges (struct pp_hwmgr *hwmgr, +void *clock_range) +{ +struct phm_ppt_v1_information *table_info = + (struct phm_ppt_v1_information *)hwmgr->pptable; +struct phm_ppt_v1_clock_voltage_dependency_table *dep_mclk_table = + table_info->vdd_dep_on_mclk; +struct phm_ppt_v1_clock_voltage_dependency_table *dep_sclk_table = + table_info->vdd_dep_on_sclk; +struct polaris10_smumgr *smu_data = + (struct polaris10_smumgr *)(hwmgr->smu_backend); +SMU74_Discrete_DpmTable *table = &(smu_data->smc_state_table); +struct dm_pp_wm_sets_with_clock_ranges *watermarks = + (struct dm_pp_wm_sets_with_clock_ranges *)clock_range; +uint32_t i, j, k; +bool valid_entry; + +if (!(hwmgr->chip_id >=CHIP_POLARIS10 && + hwmgr->chip_id <=CHIP_VEGAM )) +return -EINVAL ; + +for (i =0 ; i < dep_mclk_table->count; i++) { +for (j =0 ; j < dep_sclk_table->count; j++) { + valid_entry = false; +for (k =0 ; k < watermarks->num_wm_sets; k++) { +if (dep_sclk_table->entries[i].clk /10 >= watermarks->wm_clk_ranges[k].wm_min_eng_clk_in_khz && + dep_sclk_table->entries[i].clk /10 < watermarks->wm_clk_ranges[k].wm_max_eng_clk_in_khz && + dep_mclk_table->entries[i].clk /10 >= watermarks->wm_clk_ranges[k].wm_min_mem_clk_in_khz && + dep_mclk_table->entries[i].clk /10 < watermarks->wm_clk_ranges[k].wm_max_mem_clk_in_khz) { + valid_entry = true; + table->DisplayWatermark[i][j] = watermarks->wm_clk_ranges[k].wm_set_id; +break ; + } + } +PP_ASSERT_WITH_CODE (valid_entry, +"Clock is not in range of specified clock range for watermark from DAL! Using highest water mark set." , + table->DisplayWatermark[i][j] = watermarks->wm_clk_ranges[k -1 ].wm_set_id); + } + } + +return smu7_copy_bytes_to_smc (hwmgr, + smu_data->smu7_data.dpm_table_start + offsetof(SMU74_Discrete_DpmTable , DisplayWatermark), + (uint8_t *)table->DisplayWatermark, +sizeof (uint8_t ) *SMU74_MAX_LEVELS_MEMORY *SMU74_MAX_LEVELS_GRAPHICS , +SMC_RAM_END ); +} + static int smu7_notify_cac_buffer_info(struct pp_hwmgr *hwmgr, uint32_t virtual_addr_low, uint32_t virtual_addr_hi,@@ -5525,6 +5574,7 @@ static const struct pp_hwmgr_func smu7_hwmgr_funcs = { .set_mclk_od = smu7_set_mclk_od, .get_clock_by_type = smu7_get_clock_by_type, .get_clock_by_type_with_latency = smu7_get_clock_by_type_with_latency, + .set_watermarks_for_clocks_ranges = smu7_set_watermarks_for_clocks_ranges,
Quoted 8 lines
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c static const struct pp_hwmgr_func smu7_hwmgr_funcs = { · line 5580
Quoted 3 lines
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +0
-0.read_sensor = smu7_read_sensor, .dynamic_state_management_disable = smu7_disable_dpm_tasks, .avfs_control = smu7_avfs_control,_______________________________________________
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
RE: [PATCH 37/40] drm/amd/pm: enable Polaris watermark table setting
In reply to Christian König[AMD Official Use Only - Internal Distribution Only]
Hi Christian,
Just sent out a patch which should be able to address this issue you saw.
https://lists.freedesktop.org/archives/amd-gfx/2020-October/055431.html
BR
Evan
-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, October 29, 2020 5:46 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 37/40] drm/amd/pm: enable Polaris watermark table setting
Hi guys,
this commit here completely breaks Vega20.
Any idea why a change for Polaris should have that effect? Can we please fix this ASAP?
Thanks,
Christian.
Am 16.10.20 um 05:26 schrieb Evan Quan:
Quoted 102 lines
Enable watermark table setting for Polaris.
Change-Id I395b74f2ce5b74e6d1c7659816ee386ba556e14cSigned-off-by Evan Quan <[email protected]>Acked-by Alex Deucher <[email protected]>--- .../amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c | 11 +++- .../drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 50 +++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c +10
-1@@ -458,7 +458,16 @@ bool dm_pp_notify_wm_clock_changes(const struct dc_context *ctx, struct dm_pp_wm_sets_with_clock_ranges *wm_with_clock_ranges) { -/* TODO: to be implemented */ +struct amdgpu_device *adev = ctx->driver_context; +void *pp_handle = adev->powerplay.pp_handle; +const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; + +if (pp_funcs && pp_funcs->set_watermarks_for_clocks_ranges) { +if (!pp_funcs->set_watermarks_for_clocks_ranges (pp_handle, +(void *)wm_with_clock_ranges)) +return true; +} +return false; }drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +49
-0@@ -49,6 +49,8 @@#include "processpptables.h" #include "pp_thermal.h" #include "smu7_baco.h" +#include "smu7_smumgr.h" +#include "polaris10_smumgr.h" #include "ivsrcid/ivsrcid_vislands30.h" @@ -5107,6 +5109,53 @@ static int smu7_get_clock_by_type_with_latency(struct pp_hwmgr *hwmgr,return 0 ; } +static int smu7_set_watermarks_for_clocks_ranges (struct pp_hwmgr *hwmgr, +void *clock_range) +{ +struct phm_ppt_v1_information *table_info = +(struct phm_ppt_v1_information *)hwmgr->pptable; +struct phm_ppt_v1_clock_voltage_dependency_table *dep_mclk_table = +table_info->vdd_dep_on_mclk; +struct phm_ppt_v1_clock_voltage_dependency_table *dep_sclk_table = +table_info->vdd_dep_on_sclk; +struct polaris10_smumgr *smu_data = +(struct polaris10_smumgr *)(hwmgr->smu_backend); +SMU74_Discrete_DpmTable *table = &(smu_data->smc_state_table); +struct dm_pp_wm_sets_with_clock_ranges *watermarks = +(struct dm_pp_wm_sets_with_clock_ranges *)clock_range; +uint32_t i, j, k; +bool valid_entry; + +if (!(hwmgr->chip_id >=CHIP_POLARIS10 && + hwmgr->chip_id <=CHIP_VEGAM )) +return -EINVAL ; + +for (i =0 ; i < dep_mclk_table->count; i++) { +for (j =0 ; j < dep_sclk_table->count; j++) { +valid_entry = false; +for (k =0 ; k < watermarks->num_wm_sets; k++) { +if (dep_sclk_table->entries[i].clk /10 >= watermarks->wm_clk_ranges[k].wm_min_eng_clk_in_khz && + dep_sclk_table->entries[i].clk /10 < watermarks->wm_clk_ranges[k].wm_max_eng_clk_in_khz && + dep_mclk_table->entries[i].clk /10 >= watermarks->wm_clk_ranges[k].wm_min_mem_clk_in_khz && + dep_mclk_table->entries[i].clk /10 < watermarks->wm_clk_ranges[k].wm_max_mem_clk_in_khz) { +valid_entry = true; +table->DisplayWatermark[i][j] = watermarks->wm_clk_ranges[k].wm_set_id; +break ; +} +} +PP_ASSERT_WITH_CODE (valid_entry, +"Clock is not in range of specified clock range for watermark from DAL! Using highest water mark set." , +table->DisplayWatermark[i][j] = watermarks->wm_clk_ranges[k -1 ].wm_set_id); +} +} + +return smu7_copy_bytes_to_smc (hwmgr, + smu_data->smu7_data.dpm_table_start + offsetof(SMU74_Discrete_DpmTable , DisplayWatermark), + (uint8_t *)table->DisplayWatermark, +sizeof (uint8_t ) *SMU74_MAX_LEVELS_MEMORY *SMU74_MAX_LEVELS_GRAPHICS , +SMC_RAM_END ); +} + static int smu7_notify_cac_buffer_info(struct pp_hwmgr *hwmgr, uint32_t virtual_addr_low, uint32_t virtual_addr_hi,
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c static const struct pp_hwmgr_func smu7_hwmgr_funcs = { · line 5580
Quoted 9 lines
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +2
-0@@ -5525,6 +5574,7 @@ static const struct pp_hwmgr_func smu7_hwmgr_funcs = { .set_mclk_od = smu7_set_mclk_od, .get_clock_by_type = smu7_get_clock_by_type, .get_clock_by_type_with_latency = smu7_get_clock_by_type_with_latency, +.set_watermarks_for_clocks_ranges = +smu7_set_watermarks_for_clocks_ranges, .read_sensor = smu7_read_sensor, .dynamic_state_management_disable = smu7_disable_dpm_tasks, .avfs_control = smu7_avfs_control,
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 38/40 drm/amd/pm: correct the mclk switching setting
In reply to Evan QuanCorrect the mclk switching setting for multiple displays.
--- .../drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 113 +++++++++++++++--- .../drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.h | 12 ++ 2 files changed, 108 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +96 -17
@@ -170,6 +170,7 @@ uint32_t DIDTEDCConfig_P12[] = {static const unsigned long PhwVIslands_Magic = (unsigned long )(PHM_VIslands_Magic);static int smu7_force_clock_level (struct pp_hwmgr *hwmgr,enum pp_clock_type type,uint32_t mask); +static int smu7_notify_has_display (struct pp_hwmgr *hwmgr);static struct smu7_power_state *cast_phw_smu7_power_state (struct pp_hw_power_state *hw_ps)
@@ -1506,7 +1507,14 @@ static int smu7_enable_dpm_tasks(struct pp_hwmgr *hwmgr)PP_ASSERT_WITH_CODE ((0 == tmp_result),"Failed to enable VR hot GPIO interrupt!" , result = tmp_result); -smum_send_msg_to_smc (hwmgr, (PPSMC_Msg )PPSMC_NoDisplay,NULL ); +if (hwmgr->chip_id >=CHIP_POLARIS10 && + hwmgr->chip_id <=CHIP_VEGAM ) { + tmp_result =smu7_notify_has_display (hwmgr); +PP_ASSERT_WITH_CODE ((0 == tmp_result), +"Failed to enable display setting!" , result = tmp_result); + }else { +smum_send_msg_to_smc (hwmgr, (PPSMC_Msg )PPSMC_NoDisplay,NULL ); + }if (hwmgr->chip_id >=CHIP_POLARIS10 && hwmgr->chip_id <=CHIP_VEGAM ) {
@@ -3162,7 +3170,7 @@ static int smu7_vblank_too_short(struct pp_hwmgr *hwmgr,case CHIP_POLARIS10 :case CHIP_POLARIS11 :case CHIP_POLARIS12 : -if (hwmgr->is_kicker) +if (hwmgr->is_kicker || (hwmgr->chip_id ==CHIP_POLARIS12 )) switch_limit_us = data->is_memory_gddr5 ?450 :150 ;else switch_limit_us = data->is_memory_gddr5 ?200 :150 ;
@@ -3193,6 +3201,7 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,struct PP_Clocks minimum_clocks = {0 };bool disable_mclk_switching;bool disable_mclk_switching_for_frame_lock; +bool disable_mclk_switching_for_display;const struct phm_clock_and_voltage_limits *max_limits;uint32_t i;struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
@@ -3200,9 +3209,12 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr, (struct phm_ppt_v1_information *)(hwmgr->pptable);int32_t count;int32_t stable_pstate_sclk =0 , stable_pstate_mclk =0 ; +uint32_t latency; +bool latency_allowed = false; data->battery_state = (PP_StateUILabel_Battery == request_ps->classification.ui_label); + data->mclk_ignore_signal = false; PP_ASSERT_WITH_CODE(smu7_ps->performance_level_count == 2, "VI should always have 2 performance levels",
@@ -3253,19 +3265,26 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr, hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_DisableMclkSwitchingForFrameLock); + disable_mclk_switching_for_display = ((1 < hwmgr->display_config->num_display) && + !hwmgr->display_config->multi_monitor_in_sync) || +smu7_vblank_too_short (hwmgr, hwmgr->display_config->min_vblank_time); -if (hwmgr->display_config->num_display ==0 ) - disable_mclk_switching = false; -else - disable_mclk_switching = ((1 < hwmgr->display_config->num_display) && - !hwmgr->display_config->multi_monitor_in_sync) || - disable_mclk_switching_for_frame_lock || -smu7_vblank_too_short (hwmgr, hwmgr->display_config->min_vblank_time); + disable_mclk_switching = disable_mclk_switching_for_frame_lock || + disable_mclk_switching_for_display; + +if (hwmgr->display_config->num_display ==0 ) { +if (hwmgr->chip_id >=CHIP_POLARIS10 && hwmgr->chip_id <=CHIP_VEGAM ) + data->mclk_ignore_signal = true; +else + disable_mclk_switching = false; + } sclk = smu7_ps->performance_levels[0 ].engine_clock; mclk = smu7_ps->performance_levels[0 ].memory_clock; -if (disable_mclk_switching) +if (disable_mclk_switching && + (!(hwmgr->chip_id >=CHIP_POLARIS10 && + hwmgr->chip_id <=CHIP_VEGAM ))) mclk = smu7_ps->performance_levels [smu7_ps->performance_level_count -1 ].memory_clock;
@@ -3290,8 +3309,41 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,if (mclk < smu7_ps->performance_levels[1 ].memory_clock) mclk = smu7_ps->performance_levels[1 ].memory_clock; +if (hwmgr->chip_id >=CHIP_POLARIS10 && hwmgr->chip_id <=CHIP_VEGAM ) { +if (disable_mclk_switching_for_display) { +/* Find the lowest MCLK frequency that is within +* the tolerable latency defined in DAL +*/ + latency = hwmgr->display_config->dce_tolerable_mclk_in_active_latency; +for (i =0 ; i < data->mclk_latency_table.count; i++) { +if (data->mclk_latency_table.entries[i].latency <= latency) { + latency_allowed = true; + +if ((data->mclk_latency_table.entries[i].frequency >= + smu7_ps->performance_levels[0 ].memory_clock) && + (data->mclk_latency_table.entries[i].frequency <= + smu7_ps->performance_levels[1 ].memory_clock)) { + mclk = data->mclk_latency_table.entries[i].frequency; +break ; + } + } + } +if ((i >= data->mclk_latency_table.count -1 ) && !latency_allowed) { + data->mclk_ignore_signal = true; + }else { + data->mclk_ignore_signal = false; + } + } + +if (disable_mclk_switching_for_frame_lock) + mclk = smu7_ps->performance_levels[1 ].memory_clock; + } + smu7_ps->performance_levels[0 ].memory_clock = mclk; - smu7_ps->performance_levels[1 ].memory_clock = mclk; + +if (!(hwmgr->chip_id >=CHIP_POLARIS10 && + hwmgr->chip_id <=CHIP_VEGAM )) + smu7_ps->performance_levels[1 ].memory_clock = mclk; }else {if (smu7_ps->performance_levels[1 ].memory_clock < smu7_ps->performance_levels[0 ].memory_clock)
@@ -4037,6 +4089,7 @@ static int smu7_freeze_sclk_mclk_dpm(struct pp_hwmgr *hwmgr) }if ((0 == data->mclk_dpm_key_disabled) && + !data->mclk_ignore_signal && (data->need_update_smu7_dpm_table &DPMTABLE_OD_UPDATE_MCLK )) { PP_ASSERT_WITH_CODE(true == smum_is_dpm_running(hwmgr),
@@ -4193,6 +4246,7 @@ static int smu7_unfreeze_sclk_mclk_dpm(struct pp_hwmgr *hwmgr) }if ((0 == data->mclk_dpm_key_disabled) && + !data->mclk_ignore_signal && (data->need_update_smu7_dpm_table &DPMTABLE_OD_UPDATE_MCLK )) { PP_ASSERT_WITH_CODE(true == smum_is_dpm_running(hwmgr),
@@ -4246,7 +4300,12 @@ static int smu7_notify_link_speed_change_after_state_change(return 0 ; } -static int smu7_notify_smc_display (struct pp_hwmgr *hwmgr) +static int smu7_notify_no_display (struct pp_hwmgr *hwmgr) +{ +return (smum_send_msg_to_smc (hwmgr, (PPSMC_Msg )PPSMC_NoDisplay,NULL ) ==0 ) ?0 : -EINVAL ; +} + +static int smu7_notify_has_display (struct pp_hwmgr *hwmgr) {struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
@@ -4260,9 +4319,23 @@ static int smu7_notify_smc_display(struct pp_hwmgr *hwmgr) (PPSMC_Msg )PPSMC_MSG_SetVBITimeout, data->frame_time_x2, NULL); } +return (smum_send_msg_to_smc (hwmgr, (PPSMC_Msg )PPSMC_HasDisplay,NULL ) ==0 ) ?0 : -EINVAL ; } +static int smu7_notify_smc_display (struct pp_hwmgr *hwmgr) +{ +struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); +int result =0 ; + +if (data->mclk_ignore_signal) + result =smu7_notify_no_display (hwmgr); +else + result =smu7_notify_has_display (hwmgr); + +return result; +} +static int smu7_set_power_state_tasks (struct pp_hwmgr *hwmgr,const void *input) {int tmp_result, result =0 ;
@@ -4313,11 +4386,6 @@ static int smu7_set_power_state_tasks(struct pp_hwmgr *hwmgr, const void *input)"Failed to update SCLK threshold!" , result = tmp_result); - tmp_result =smu7_notify_smc_display (hwmgr); -PP_ASSERT_WITH_CODE ((0 == tmp_result), -"Failed to notify smc display settings!" , - result = tmp_result); - tmp_result =smu7_unfreeze_sclk_mclk_dpm (hwmgr); PP_ASSERT_WITH_CODE((0 == tmp_result), "Failed to unfreeze SCLK MCLK DPM!",
@@ -4328,6 +4396,11 @@ static int smu7_set_power_state_tasks(struct pp_hwmgr *hwmgr, const void *input)"Failed to upload DPM level enabled mask!" , result = tmp_result); + tmp_result =smu7_notify_smc_display (hwmgr); +PP_ASSERT_WITH_CODE ((0 == tmp_result), +"Failed to notify smc display settings!" , + result = tmp_result); +if (phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_PCIEPerformanceRequest)) { tmp_result =
@@ -5071,16 +5144,22 @@ static int smu7_get_mclks_with_latency(struct pp_hwmgr *hwmgr, (struct phm_ppt_v1_information *)hwmgr->pptable;struct phm_ppt_v1_clock_voltage_dependency_table *dep_mclk_table = table_info->vdd_dep_on_mclk; +struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);int i; clocks->num_levels =0 ; + data->mclk_latency_table.count =0 ;for (i =0 ; i < dep_mclk_table->count; i++) {if (dep_mclk_table->entries[i].clk) { clocks->data[clocks->num_levels].clocks_in_khz = dep_mclk_table->entries[i].clk *10 ; + data->mclk_latency_table.entries[data->mclk_latency_table.count].frequency = + dep_mclk_table->entries[i].clk; clocks->data[clocks->num_levels].latency_in_us = + data->mclk_latency_table.entries[data->mclk_latency_table.count].latency =smu7_get_mem_latency (hwmgr, dep_mclk_table->entries[i].clk); clocks->num_levels++; + data->mclk_latency_table.count++; } }
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.h +12 -0
@@ -200,10 +200,21 @@ struct profile_mode_setting {uint16_t mclk_activity; }; +struct smu7_mclk_latency_entries { +uint32_t frequency; +uint32_t latency; +}; + +struct smu7_mclk_latency_table { +uint32_t count; +struct smu7_mclk_latency_entries entries[MAX_REGULAR_DPM_NUMBER ]; +}; +struct smu7_hwmgr {struct smu7_dpm_table dpm_table;struct smu7_dpm_table golden_dpm_table;struct smu7_odn_dpm_table odn_dpm_table; +struct smu7_mclk_latency_table mclk_latency_table;uint32_t voting_rights_clients[8 ];uint32_t static_screen_threshold_unit;
@@ -239,6 +250,7 @@ struct smu7_hwmgr {bool pcie_performance_request;bool battery_state; +bool mclk_ignore_signal;bool is_tlu_enabled;bool disable_handshake;bool smc_voltage_control_enabled;
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 39/40 drm/amd/pm: reconfigure smc on display vbitimeout setting change
In reply to Evan QuanReconfigure smc display settings on vbitimeout change.
--- drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 6 ++++++ drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.h | 1 + 2 files changed, 7 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +6 -0
@@ -4318,6 +4318,7 @@ static int smu7_notify_has_display(struct pp_hwmgr *hwmgr)smum_send_msg_to_smc_with_parameter (hwmgr, (PPSMC_Msg )PPSMC_MSG_SetVBITimeout, data->frame_time_x2,NULL ); + data->last_sent_vbi_timeout = data->frame_time_x2; }return (smum_send_msg_to_smc (hwmgr, (PPSMC_Msg )PPSMC_HasDisplay,NULL ) ==0 ) ?0 : -EINVAL ;
@@ -4560,6 +4561,11 @@ smu7_check_smc_update_required_for_display_configuration(struct pp_hwmgr *hwmgr)if (data->display_timing.vrefresh != hwmgr->display_config->vrefresh) is_update_required = true; +if (hwmgr->chip_id >=CHIP_POLARIS10 && + hwmgr->chip_id <=CHIP_VEGAM && + data->last_sent_vbi_timeout != data->frame_time_x2) + is_update_required = true; +if (phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_SclkDeepSleep)) { if (data->display_timing.min_clock_in_sr != hwmgr->display_config->min_core_set_clock_in_sr && (data->display_timing.min_clock_in_sr >= SMU7_MINIMUM_ENGINE_CLOCK ||
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.h +1 -0
@@ -336,6 +336,7 @@ struct smu7_hwmgr {uint32_t avfs_vdroop_override_setting;bool apply_avfs_cks_off_voltage;uint32_t frame_time_x2; +uint32_t last_sent_vbi_timeout;uint16_t mem_latency_high;uint16_t mem_latency_low;uint32_t vr_config;
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 40/40 drm/amd/pm: drop redundant display setting
In reply to Evan QuanAs this is already performed in smu7_set_power_state_tasks().
--- drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 12 ------------ 1 file changed, 12 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +0 -12
@@ -4424,21 +4424,9 @@ static int smu7_set_max_fan_pwm_output(struct pp_hwmgr *hwmgr, uint16_t us_max_f NULL); } -static int -smu7_notify_smc_display_change (struct pp_hwmgr *hwmgr,bool has_display) -{ -PPSMC_Msg msg = has_display ? (PPSMC_Msg )PPSMC_HasDisplay : (PPSMC_Msg )PPSMC_NoDisplay; - -return (smum_send_msg_to_smc (hwmgr, msg,NULL ) ==0 ) ?0 :-1 ; -} -static int smu7_notify_smc_display_config_after_ps_adjustment (struct pp_hwmgr *hwmgr) { -if (hwmgr->display_config->num_display >1 && - !hwmgr->display_config->multi_monitor_in_sync) -smu7_notify_smc_display_change (hwmgr, false); -return 0 ; }
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx