Commit e178f107 authored by Kent Russell's avatar Kent Russell Committed by Alex Deucher

drm/amdgpu: Allow switching to CUSTOM profile on Vega20

Vega20 stores a CUSTOM profile on the GPU, but it may not be valid. Add
a bool to vega20_hwmgr to determine whether or not a valid CUSTOM
profile has been set, and use that to check when a user requests
switching to the CUSTOM profile without passing in any arguments. Then
if the CUSTOM profile has been set already, we can switch to it without
providing the parameters again
Signed-off-by: default avatarKent Russell <kent.russell@amd.com>
Reviewed-by: default avatarEvan Quan <evan.quan@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent bbdf38cc
...@@ -427,6 +427,7 @@ static int vega20_hwmgr_backend_init(struct pp_hwmgr *hwmgr) ...@@ -427,6 +427,7 @@ static int vega20_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
hwmgr->platform_descriptor.clockStep.memoryClock = 500; hwmgr->platform_descriptor.clockStep.memoryClock = 500;
data->total_active_cus = adev->gfx.cu_info.number; data->total_active_cus = adev->gfx.cu_info.number;
data->is_custom_profile_set = false;
return 0; return 0;
} }
...@@ -3827,7 +3828,11 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui ...@@ -3827,7 +3828,11 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui
} }
if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) { if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
if (size < 10) struct vega20_hwmgr *data =
(struct vega20_hwmgr *)(hwmgr->backend);
if (size == 0 && !data->is_custom_profile_set)
return -EINVAL;
if (size < 10 && size != 0)
return -EINVAL; return -EINVAL;
result = vega20_get_activity_monitor_coeff(hwmgr, result = vega20_get_activity_monitor_coeff(hwmgr,
...@@ -3837,6 +3842,13 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui ...@@ -3837,6 +3842,13 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui
"[SetPowerProfile] Failed to get activity monitor!", "[SetPowerProfile] Failed to get activity monitor!",
return result); return result);
/* If size==0, then we want to apply the already-configured
* CUSTOM profile again. Just apply it, since we checked its
* validity above
*/
if (size == 0)
goto out;
switch (input[0]) { switch (input[0]) {
case 0: /* Gfxclk */ case 0: /* Gfxclk */
activity_monitor.Gfx_FPS = input[1]; activity_monitor.Gfx_FPS = input[1];
...@@ -3887,11 +3899,13 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui ...@@ -3887,11 +3899,13 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui
result = vega20_set_activity_monitor_coeff(hwmgr, result = vega20_set_activity_monitor_coeff(hwmgr,
(uint8_t *)(&activity_monitor), (uint8_t *)(&activity_monitor),
WORKLOAD_PPLIB_CUSTOM_BIT); WORKLOAD_PPLIB_CUSTOM_BIT);
data->is_custom_profile_set = true;
PP_ASSERT_WITH_CODE(!result, PP_ASSERT_WITH_CODE(!result,
"[SetPowerProfile] Failed to set activity monitor!", "[SetPowerProfile] Failed to set activity monitor!",
return result); return result);
} }
out:
/* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */ /* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
workload_type = workload_type =
conv_power_profile_to_pplib_workload(power_profile_mode); conv_power_profile_to_pplib_workload(power_profile_mode);
......
...@@ -530,6 +530,8 @@ struct vega20_hwmgr { ...@@ -530,6 +530,8 @@ struct vega20_hwmgr {
bool pcie_parameters_override; bool pcie_parameters_override;
uint32_t pcie_gen_level1; uint32_t pcie_gen_level1;
uint32_t pcie_width_level1; uint32_t pcie_width_level1;
bool is_custom_profile_set;
}; };
#define VEGA20_DPM2_NEAR_TDP_DEC 10 #define VEGA20_DPM2_NEAR_TDP_DEC 10
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment