Skip to contentSkip to conversation

drm/amdgpu/smu10: fix SoC/fclk units in auto mode

PATCH In review Alex Deucher 3 participants 3 messages Apr 1, 2022 – Apr 6, 2022

Subsystems (3)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/1 drm/amdgpu/smu10: fix SoC/fclk units in auto mode

SMU takes clock limits in Mhz units. socclk and fclk were using 10 khz units in some cases. Switch to Mhz units. Fixes higher than required SoC clocks.

Fixes 97cf32996c46d9 ("drm/amd/pm: Removed fixed clock in auto mode DPM")
---
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +4 -4
index 9ddd8491ff00..545dd68a8c18 100644
@@ -773,13 +773,13 @@ static int smu10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
 		smum_send_msg_to_smc_with_parameter(hwmgr,
 						PPSMC_MSG_SetHardMinFclkByFreq,
 						hwmgr->display_config->num_display > 3 ?
-						data->clock_vol_info.vdd_dep_on_fclk->entries[0].clk :
+						    (data->clock_vol_info.vdd_dep_on_fclk->entries[0].clk / 100) :
 						min_mclk,
 						NULL);
 
 		smum_send_msg_to_smc_with_parameter(hwmgr,
 						PPSMC_MSG_SetHardMinSocclkByFreq,
-						data->clock_vol_info.vdd_dep_on_socclk->entries[0].clk,
+						data->clock_vol_info.vdd_dep_on_socclk->entries[0].clk / 100,
 						NULL);
 		smum_send_msg_to_smc_with_parameter(hwmgr,
 						PPSMC_MSG_SetHardMinVcn,
@@ -792,11 +792,11 @@ static int smu10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
 						NULL);
 		smum_send_msg_to_smc_with_parameter(hwmgr,
 						PPSMC_MSG_SetSoftMaxFclkByFreq,
-						data->clock_vol_info.vdd_dep_on_fclk->entries[index_fclk].clk,
+						data->clock_vol_info.vdd_dep_on_fclk->entries[index_fclk].clk / 100,
 						NULL);
 		smum_send_msg_to_smc_with_parameter(hwmgr,
 						PPSMC_MSG_SetSoftMaxSocclkByFreq,
-						data->clock_vol_info.vdd_dep_on_socclk->entries[index_socclk].clk,
+						data->clock_vol_info.vdd_dep_on_socclk->entries[index_socclk].clk / 100,
 						NULL);
 		smum_send_msg_to_smc_with_parameter(hwmgr,
 						PPSMC_MSG_SetSoftMaxVcn,
Signature · 1 line
2.35.1
#1 lore raw

Ping?

Quoted 48 lines · Alex Deucher

SMU takes clock limits in Mhz units. socclk and fclk were using 10 khz units in some cases. Switch to Mhz units. Fixes higher than required SoC clocks.

Fixes 97cf32996c46d9 ("drm/amd/pm: Removed fixed clock in auto mode DPM")
---
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +4 -5
index 9ddd8491ff00..545dd68a8c18 100644
@@ -773,13 +773,13 @@ static int smu10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                                PPSMC_MSG_SetHardMinFclkByFreq,
                                                hwmgr->display_config->num_display > 3 ?
-                                               data->clock_vol_info.vdd_dep_on_fclk->entries[0].clk :
+                                                   (data->clock_vol_info.vdd_dep_on_fclk->entries[0].clk / 100) :
                                                min_mclk,
                                                NULL);
 
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                                PPSMC_MSG_SetHardMinSocclkByFreq,
-                                               data->clock_vol_info.vdd_dep_on_socclk->entries[0].clk,
+                                               data->clock_vol_info.vdd_dep_on_socclk->entries[0].clk / 100,
                                                NULL);
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                                PPSMC_MSG_SetHardMinVcn,
@@ -792,11 +792,11 @@ static int smu10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
                                                NULL);
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                                PPSMC_MSG_SetSoftMaxFclkByFreq,
-                                               data->clock_vol_info.vdd_dep_on_fclk->entries[index_fclk].clk,
+                                               data->clock_vol_info.vdd_dep_on_fclk->entries[index_fclk].clk / 100,
                                                NULL);
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                                PPSMC_MSG_SetSoftMaxSocclkByFreq,
-                                               data->clock_vol_info.vdd_dep_on_socclk->entries[index_socclk].clk,
+                                               data->clock_vol_info.vdd_dep_on_socclk->entries[index_socclk].clk / 100,
                                                NULL);
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                                PPSMC_MSG_SetSoftMaxVcn,
--

2.35.1

Reviewed-by on v1 1/1
#2 lore raw
In reply to Alex Deucher

Dear Alex,

Thank you for your patch.

Am 01.04.22 um 17:16 schrieb Alex Deucher:

Quoted 3 lines

SMU takes clock limits in Mhz units. socclk and fclk were using 10 khz units in some cases. Switch to Mhz units. Fixes higher than required SoC clocks.

It’d be great if you used 75 characters per line in commit messages.

Quoted 11 lines
Fixes 97cf32996c46d9 ("drm/amd/pm: Removed fixed clock in auto mode DPM")
---
  drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +0 -0
index 9ddd8491ff00..545dd68a8c18 100644

drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c static int smu10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr, · line 777

Quoted 6 lines
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +1 -1
@@ -773,13 +773,13 @@ static int smu10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
  		smum_send_msg_to_smc_with_parameter(hwmgr,
  						PPSMC_MSG_SetHardMinFclkByFreq,
  						hwmgr->display_config->num_display > 3 ?
-						data->clock_vol_info.vdd_dep_on_fclk->entries[0].clk :
+						    (data->clock_vol_info.vdd_dep_on_fclk->entries[0].clk / 100) :
  						min_mclk,

Should that also be indented now?

Quoted 13 lines
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +1 -1
  						NULL);
 
  		smum_send_msg_to_smc_with_parameter(hwmgr,
  						PPSMC_MSG_SetHardMinSocclkByFreq,
-						data->clock_vol_info.vdd_dep_on_socclk->entries[0].clk,
+						data->clock_vol_info.vdd_dep_on_socclk->entries[0].clk / 100,
  						NULL);
  		smum_send_msg_to_smc_with_parameter(hwmgr,
  						PPSMC_MSG_SetHardMinVcn,
@@ -792,11 +792,11 @@ static int smu10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
  						NULL);
  		smum_send_msg_to_smc_with_parameter(hwmgr,
  						PPSMC_MSG_SetSoftMaxFclkByFreq,

drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c static int smu10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr, · line 802

Quoted 10 lines
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +2 -2
-						data->clock_vol_info.vdd_dep_on_fclk->entries[index_fclk].clk,
+						data->clock_vol_info.vdd_dep_on_fclk->entries[index_fclk].clk / 100,
  						NULL);
  		smum_send_msg_to_smc_with_parameter(hwmgr,
  						PPSMC_MSG_SetSoftMaxSocclkByFreq,
-						data->clock_vol_info.vdd_dep_on_socclk->entries[index_socclk].clk,
+						data->clock_vol_info.vdd_dep_on_socclk->entries[index_socclk].clk / 100,
  						NULL);
  		smum_send_msg_to_smc_with_parameter(hwmgr,
  						PPSMC_MSG_SetSoftMaxVcn,

Kind regards,

Paul