diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2018-03-02 00:50:59 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-03-05 15:39:20 -0500 |
commit | 15826fbfef16a20799fa7c990df758b455bf7b62 (patch) | |
tree | 37893ac6add6e86bf19bb32387bc9d8bad39cc80 | |
parent | cc1bb66fbc26c29d360fab4b8d66fb7f278a2564 (diff) |
drm/amd/pp: Add PCC feature support on Vega
This features controls vega peak current protection to allow
for a wider compatibility with power supplies.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 34 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/inc/vega10_ppsmc.h | 1 |
3 files changed, 36 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c index 26a5bc070989..1596fd84627a 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | |||
@@ -299,6 +299,8 @@ static void vega10_init_dpm_defaults(struct pp_hwmgr *hwmgr) | |||
299 | { | 299 | { |
300 | struct vega10_hwmgr *data = (struct vega10_hwmgr *)(hwmgr->backend); | 300 | struct vega10_hwmgr *data = (struct vega10_hwmgr *)(hwmgr->backend); |
301 | int i; | 301 | int i; |
302 | uint32_t sub_vendor_id, hw_revision; | ||
303 | struct amdgpu_device *adev = hwmgr->adev; | ||
302 | 304 | ||
303 | vega10_initialize_power_tune_defaults(hwmgr); | 305 | vega10_initialize_power_tune_defaults(hwmgr); |
304 | 306 | ||
@@ -363,6 +365,7 @@ static void vega10_init_dpm_defaults(struct pp_hwmgr *hwmgr) | |||
363 | FEATURE_FAN_CONTROL_BIT; | 365 | FEATURE_FAN_CONTROL_BIT; |
364 | data->smu_features[GNLD_ACG].smu_feature_id = FEATURE_ACG_BIT; | 366 | data->smu_features[GNLD_ACG].smu_feature_id = FEATURE_ACG_BIT; |
365 | data->smu_features[GNLD_DIDT].smu_feature_id = FEATURE_GFX_EDC_BIT; | 367 | data->smu_features[GNLD_DIDT].smu_feature_id = FEATURE_GFX_EDC_BIT; |
368 | data->smu_features[GNLD_PCC_LIMIT].smu_feature_id = FEATURE_PCC_LIMIT_CONTROL_BIT; | ||
366 | 369 | ||
367 | if (!data->registry_data.prefetcher_dpm_key_disabled) | 370 | if (!data->registry_data.prefetcher_dpm_key_disabled) |
368 | data->smu_features[GNLD_DPM_PREFETCHER].supported = true; | 371 | data->smu_features[GNLD_DPM_PREFETCHER].supported = true; |
@@ -432,6 +435,15 @@ static void vega10_init_dpm_defaults(struct pp_hwmgr *hwmgr) | |||
432 | if (data->registry_data.didt_support) | 435 | if (data->registry_data.didt_support) |
433 | data->smu_features[GNLD_DIDT].supported = true; | 436 | data->smu_features[GNLD_DIDT].supported = true; |
434 | 437 | ||
438 | hw_revision = adev->pdev->revision; | ||
439 | sub_vendor_id = adev->pdev->subsystem_vendor; | ||
440 | |||
441 | if ((hwmgr->chip_id == 0x6862 || | ||
442 | hwmgr->chip_id == 0x6861 || | ||
443 | hwmgr->chip_id == 0x6868) && | ||
444 | (hw_revision == 0) && | ||
445 | (sub_vendor_id != 0x1002)) | ||
446 | data->smu_features[GNLD_PCC_LIMIT].supported = true; | ||
435 | } | 447 | } |
436 | 448 | ||
437 | #ifdef PPLIB_VEGA10_EVV_SUPPORT | 449 | #ifdef PPLIB_VEGA10_EVV_SUPPORT |
@@ -2844,12 +2856,32 @@ static int vega10_start_dpm(struct pp_hwmgr *hwmgr, uint32_t bitmap) | |||
2844 | return 0; | 2856 | return 0; |
2845 | } | 2857 | } |
2846 | 2858 | ||
2859 | static int vega10_enable_disable_PCC_limit_feature(struct pp_hwmgr *hwmgr, bool enable) | ||
2860 | { | ||
2861 | struct vega10_hwmgr *data = | ||
2862 | (struct vega10_hwmgr *)(hwmgr->backend); | ||
2863 | |||
2864 | if (data->smu_features[GNLD_PCC_LIMIT].supported) { | ||
2865 | if (enable == data->smu_features[GNLD_PCC_LIMIT].enabled) | ||
2866 | pr_info("GNLD_PCC_LIMIT has been %s \n", enable ? "enabled" : "disabled"); | ||
2867 | PP_ASSERT_WITH_CODE(!vega10_enable_smc_features(hwmgr, | ||
2868 | enable, data->smu_features[GNLD_PCC_LIMIT].smu_feature_bitmap), | ||
2869 | "Attempt to Enable PCC Limit feature Failed!", | ||
2870 | return -EINVAL); | ||
2871 | data->smu_features[GNLD_PCC_LIMIT].enabled = enable; | ||
2872 | } | ||
2873 | |||
2874 | return 0; | ||
2875 | } | ||
2876 | |||
2847 | static int vega10_enable_dpm_tasks(struct pp_hwmgr *hwmgr) | 2877 | static int vega10_enable_dpm_tasks(struct pp_hwmgr *hwmgr) |
2848 | { | 2878 | { |
2849 | struct vega10_hwmgr *data = | 2879 | struct vega10_hwmgr *data = |
2850 | (struct vega10_hwmgr *)(hwmgr->backend); | 2880 | (struct vega10_hwmgr *)(hwmgr->backend); |
2851 | int tmp_result, result = 0; | 2881 | int tmp_result, result = 0; |
2852 | 2882 | ||
2883 | vega10_enable_disable_PCC_limit_feature(hwmgr, true); | ||
2884 | |||
2853 | if ((hwmgr->smu_version == 0x001c2c00) || | 2885 | if ((hwmgr->smu_version == 0x001c2c00) || |
2854 | (hwmgr->smu_version == 0x001c2d00)) | 2886 | (hwmgr->smu_version == 0x001c2d00)) |
2855 | smum_send_msg_to_smc_with_parameter(hwmgr, | 2887 | smum_send_msg_to_smc_with_parameter(hwmgr, |
@@ -4703,6 +4735,8 @@ static int vega10_disable_dpm_tasks(struct pp_hwmgr *hwmgr) | |||
4703 | tmp_result = vega10_acg_disable(hwmgr); | 4735 | tmp_result = vega10_acg_disable(hwmgr); |
4704 | PP_ASSERT_WITH_CODE((tmp_result == 0), | 4736 | PP_ASSERT_WITH_CODE((tmp_result == 0), |
4705 | "Failed to disable acg!", result = tmp_result); | 4737 | "Failed to disable acg!", result = tmp_result); |
4738 | |||
4739 | vega10_enable_disable_PCC_limit_feature(hwmgr, false); | ||
4706 | return result; | 4740 | return result; |
4707 | } | 4741 | } |
4708 | 4742 | ||
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.h b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.h index ab3e8798bee8..de3219fff2db 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.h +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.h | |||
@@ -66,6 +66,7 @@ enum { | |||
66 | GNLD_FEATURE_FAST_PPT_BIT, | 66 | GNLD_FEATURE_FAST_PPT_BIT, |
67 | GNLD_DIDT, | 67 | GNLD_DIDT, |
68 | GNLD_ACG, | 68 | GNLD_ACG, |
69 | GNLD_PCC_LIMIT, | ||
69 | GNLD_FEATURES_MAX | 70 | GNLD_FEATURES_MAX |
70 | }; | 71 | }; |
71 | 72 | ||
diff --git a/drivers/gpu/drm/amd/powerplay/inc/vega10_ppsmc.h b/drivers/gpu/drm/amd/powerplay/inc/vega10_ppsmc.h index 247c97397a27..c3ed737ab951 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/vega10_ppsmc.h +++ b/drivers/gpu/drm/amd/powerplay/inc/vega10_ppsmc.h | |||
@@ -131,6 +131,7 @@ typedef uint16_t PPSMC_Result; | |||
131 | #define PPSMC_MSG_RunAcgInOpenLoop 0x5E | 131 | #define PPSMC_MSG_RunAcgInOpenLoop 0x5E |
132 | #define PPSMC_MSG_InitializeAcg 0x5F | 132 | #define PPSMC_MSG_InitializeAcg 0x5F |
133 | #define PPSMC_MSG_GetCurrPkgPwr 0x61 | 133 | #define PPSMC_MSG_GetCurrPkgPwr 0x61 |
134 | #define PPSMC_MSG_SetPccThrottleLevel 0x67 | ||
134 | #define PPSMC_MSG_UpdatePkgPwrPidAlpha 0x68 | 135 | #define PPSMC_MSG_UpdatePkgPwrPidAlpha 0x68 |
135 | #define PPSMC_Message_Count 0x69 | 136 | #define PPSMC_Message_Count 0x69 |
136 | 137 | ||