aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Quan <evan.quan@amd.com>2018-10-24 00:11:35 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-11-07 17:05:56 -0500
commit72deff05bd4662b9aca75812b44a9bea646da1b0 (patch)
tree5b4dfeac098c5ed9f2e41048a8483b9e5dc9c5ef
parent30f33126feca0fe16df9e9302ffc28a953e2eb37 (diff)
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>
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c16
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h1
-rw-r--r--drivers/gpu/drm/amd/powerplay/inc/vega20_ppsmc.h3
3 files changed, 19 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
index 07a36af0f237..10c80aae030f 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
@@ -120,6 +120,7 @@ static void vega20_set_default_registry_data(struct pp_hwmgr *hwmgr)
120 data->registry_data.disable_auto_wattman = 1; 120 data->registry_data.disable_auto_wattman = 1;
121 data->registry_data.auto_wattman_debug = 0; 121 data->registry_data.auto_wattman_debug = 0;
122 data->registry_data.auto_wattman_sample_period = 100; 122 data->registry_data.auto_wattman_sample_period = 100;
123 data->registry_data.fclk_gfxclk_ratio = 0x3F6CCCCD;
123 data->registry_data.auto_wattman_threshold = 50; 124 data->registry_data.auto_wattman_threshold = 50;
124 data->registry_data.gfxoff_controlled_by_driver = 1; 125 data->registry_data.gfxoff_controlled_by_driver = 1;
125 data->gfxoff_allowed = false; 126 data->gfxoff_allowed = false;
@@ -829,6 +830,16 @@ static int vega20_enable_all_smu_features(struct pp_hwmgr *hwmgr)
829 return 0; 830 return 0;
830} 831}
831 832
833static 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
832static int vega20_disable_all_smu_features(struct pp_hwmgr *hwmgr) 843static int vega20_disable_all_smu_features(struct pp_hwmgr *hwmgr)
833{ 844{
834 struct vega20_hwmgr *data = 845 struct vega20_hwmgr *data =
@@ -1532,6 +1543,11 @@ static int vega20_enable_dpm_tasks(struct pp_hwmgr *hwmgr)
1532 "[EnableDPMTasks] Failed to enable all smu features!", 1543 "[EnableDPMTasks] Failed to enable all smu features!",
1533 return result); 1544 return result);
1534 1545
1546 result = vega20_send_clock_ratio(hwmgr);
1547 PP_ASSERT_WITH_CODE(!result,
1548 "[EnableDPMTasks] Failed to send clock ratio!",
1549 return result);
1550
1535 /* Initialize UVD/VCE powergating state */ 1551 /* Initialize UVD/VCE powergating state */
1536 vega20_init_powergate_state(hwmgr); 1552 vega20_init_powergate_state(hwmgr);
1537 1553
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h
index 56fe6a0d42e8..25faaa5c5b10 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h
@@ -328,6 +328,7 @@ struct vega20_registry_data {
328 uint8_t disable_auto_wattman; 328 uint8_t disable_auto_wattman;
329 uint32_t auto_wattman_debug; 329 uint32_t auto_wattman_debug;
330 uint32_t auto_wattman_sample_period; 330 uint32_t auto_wattman_sample_period;
331 uint32_t fclk_gfxclk_ratio;
331 uint8_t auto_wattman_threshold; 332 uint8_t auto_wattman_threshold;
332 uint8_t log_avfs_param; 333 uint8_t log_avfs_param;
333 uint8_t enable_enginess; 334 uint8_t enable_enginess;
diff --git a/drivers/gpu/drm/amd/powerplay/inc/vega20_ppsmc.h b/drivers/gpu/drm/amd/powerplay/inc/vega20_ppsmc.h
index 45d64a81e945..4f63a736ea0e 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/vega20_ppsmc.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/vega20_ppsmc.h
@@ -105,7 +105,8 @@
105#define PPSMC_MSG_SetSystemVirtualDramAddrHigh 0x4B 105#define PPSMC_MSG_SetSystemVirtualDramAddrHigh 0x4B
106#define PPSMC_MSG_SetSystemVirtualDramAddrLow 0x4C 106#define PPSMC_MSG_SetSystemVirtualDramAddrLow 0x4C
107#define PPSMC_MSG_WaflTest 0x4D 107#define PPSMC_MSG_WaflTest 0x4D
108// Unused ID 0x4E to 0x50 108#define PPSMC_MSG_SetFclkGfxClkRatio 0x4E
109// Unused ID 0x4F to 0x50
109#define PPSMC_MSG_AllowGfxOff 0x51 110#define PPSMC_MSG_AllowGfxOff 0x51
110#define PPSMC_MSG_DisallowGfxOff 0x52 111#define PPSMC_MSG_DisallowGfxOff 0x52
111#define PPSMC_MSG_GetPptLimit 0x53 112#define PPSMC_MSG_GetPptLimit 0x53