Skip to content

Commit 3c7eda0

Browse files
Evan Quanalexdeucher
authored andcommitted
drm/amd/powerplay: set a default fclk/gfxclk ratio
Otherwise big gap between these two clocks may causes some hangs. Signed-off-by: Evan Quan <evan.quan@amd.com> Reviewed-by: Feifei Xu <Feifei.Xu@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 5822e95 commit 3c7eda0

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ static void vega20_set_default_registry_data(struct pp_hwmgr *hwmgr)
120120
data->registry_data.disable_auto_wattman = 1;
121121
data->registry_data.auto_wattman_debug = 0;
122122
data->registry_data.auto_wattman_sample_period = 100;
123+
data->registry_data.fclk_gfxclk_ratio = 0x3F6CCCCD;
123124
data->registry_data.auto_wattman_threshold = 50;
124125
data->registry_data.gfxoff_controlled_by_driver = 1;
125126
data->gfxoff_allowed = false;
@@ -829,6 +830,16 @@ static int vega20_enable_all_smu_features(struct pp_hwmgr *hwmgr)
829830
return 0;
830831
}
831832

833+
static int vega20_send_clock_ratio(struct pp_hwmgr *hwmgr)
834+
{
835+
struct vega20_hwmgr *data =
836+
(struct vega20_hwmgr *)(hwmgr->backend);
837+
838+
return smum_send_msg_to_smc_with_parameter(hwmgr,
839+
PPSMC_MSG_SetFclkGfxClkRatio,
840+
data->registry_data.fclk_gfxclk_ratio);
841+
}
842+
832843
static int vega20_disable_all_smu_features(struct pp_hwmgr *hwmgr)
833844
{
834845
struct vega20_hwmgr *data =
@@ -1532,6 +1543,11 @@ static int vega20_enable_dpm_tasks(struct pp_hwmgr *hwmgr)
15321543
"[EnableDPMTasks] Failed to enable all smu features!",
15331544
return result);
15341545

1546+
result = vega20_send_clock_ratio(hwmgr);
1547+
PP_ASSERT_WITH_CODE(!result,
1548+
"[EnableDPMTasks] Failed to send clock ratio!",
1549+
return result);
1550+
15351551
/* Initialize UVD/VCE powergating state */
15361552
vega20_init_powergate_state(hwmgr);
15371553

drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ struct vega20_registry_data {
328328
uint8_t disable_auto_wattman;
329329
uint32_t auto_wattman_debug;
330330
uint32_t auto_wattman_sample_period;
331+
uint32_t fclk_gfxclk_ratio;
331332
uint8_t auto_wattman_threshold;
332333
uint8_t log_avfs_param;
333334
uint8_t enable_enginess;

drivers/gpu/drm/amd/powerplay/inc/vega20_ppsmc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@
105105
#define PPSMC_MSG_SetSystemVirtualDramAddrHigh 0x4B
106106
#define PPSMC_MSG_SetSystemVirtualDramAddrLow 0x4C
107107
#define PPSMC_MSG_WaflTest 0x4D
108-
// Unused ID 0x4E to 0x50
108+
#define PPSMC_MSG_SetFclkGfxClkRatio 0x4E
109+
// Unused ID 0x4F to 0x50
109110
#define PPSMC_MSG_AllowGfxOff 0x51
110111
#define PPSMC_MSG_DisallowGfxOff 0x52
111112
#define PPSMC_MSG_GetPptLimit 0x53

0 commit comments

Comments
 (0)