<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Rex Zhu <Rex.Zhu@amd.com><br>
<b>Sent:</b> Wednesday, March 21, 2018 5:46:34 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Zhu, Rex<br>
<b>Subject:</b> [PATCH] drm/amd/pp: Clean up powerplay code on Vega12</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Change-Id: I792a0c6170115867b99d7112d8eba9ff2faf39d7<br>
---<br>
drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c | 482 +--------------------<br>
drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.h | 32 --<br>
2 files changed, 1 insertion(+), 513 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c<br>
index da2053e..15ce1e8 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c<br>
@@ -48,7 +48,6 @@<br>
#include "pp_overdriver.h"<br>
#include "pp_thermal.h"<br>
<br>
-static const ULONG PhwVega12_Magic = (ULONG)(PHM_VIslands_Magic);<br>
<br>
static int vega12_force_clock_level(struct pp_hwmgr *hwmgr,<br>
enum pp_clock_type type, uint32_t mask);<br>
@@ -57,26 +56,6 @@ static int vega12_get_clock_ranges(struct pp_hwmgr *hwmgr,<br>
PPCLK_e clock_select,<br>
bool max);<br>
<br>
-struct vega12_power_state *cast_phw_vega12_power_state(<br>
- struct pp_hw_power_state *hw_ps)<br>
-{<br>
- PP_ASSERT_WITH_CODE((PhwVega12_Magic == hw_ps->magic),<br>
- "Invalid Powerstate Type!",<br>
- return NULL;);<br>
-<br>
- return (struct vega12_power_state *)hw_ps;<br>
-}<br>
-<br>
-const struct vega12_power_state *cast_const_phw_vega12_power_state(<br>
- const struct pp_hw_power_state *hw_ps)<br>
-{<br>
- PP_ASSERT_WITH_CODE((PhwVega12_Magic == hw_ps->magic),<br>
- "Invalid Powerstate Type!",<br>
- return NULL;);<br>
-<br>
- return (const struct vega12_power_state *)hw_ps;<br>
-}<br>
-<br>
static void vega12_set_default_registry_data(struct pp_hwmgr *hwmgr)<br>
{<br>
struct vega12_hwmgr *data =<br>
@@ -590,7 +569,7 @@ static int vega12_setup_default_dpm_tables(struct pp_hwmgr *hwmgr)<br>
}<br>
<br>
vega12_init_dpm_state(&(dpm_table->dpm_state));<br>
- /* Initialize Mclk DPM table based on allow Mclk values */<br>
+ /* Initialize Mclk DPM table based on allow Mclk values */<br>
dpm_table = &(data->dpm_table.mem_table);<br>
<br>
PP_ASSERT_WITH_CODE(vega12_get_number_dpm_level(hwmgr, PPCLK_UCLK,<br>
@@ -953,262 +932,12 @@ static int vega12_enable_dpm_tasks(struct pp_hwmgr *hwmgr)<br>
return result;<br>
}<br>
<br>
-static int vega12_get_power_state_size(struct pp_hwmgr *hwmgr)<br>
-{<br>
- return sizeof(struct vega12_power_state);<br>
-}<br>
-<br>
-static int vega12_get_number_of_pp_table_entries(struct pp_hwmgr *hwmgr)<br>
-{<br>
- return 0;<br>
-}<br>
-<br>
static int vega12_patch_boot_state(struct pp_hwmgr *hwmgr,<br>
struct pp_hw_power_state *hw_ps)<br>
{<br>
return 0;<br>
}<br>
<br>
-static int vega12_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,<br>
- struct pp_power_state *request_ps,<br>
- const struct pp_power_state *current_ps)<br>
-{<br>
- struct vega12_power_state *vega12_ps =<br>
- cast_phw_vega12_power_state(&request_ps->hardware);<br>
- uint32_t sclk;<br>
- uint32_t mclk;<br>
- struct PP_Clocks minimum_clocks = {0};<br>
- bool disable_mclk_switching;<br>
- bool disable_mclk_switching_for_frame_lock;<br>
- bool disable_mclk_switching_for_vr;<br>
- bool force_mclk_high;<br>
- struct cgs_display_info info = {0};<br>
- const struct phm_clock_and_voltage_limits *max_limits;<br>
- uint32_t i;<br>
- struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);<br>
- struct phm_ppt_v2_information *table_info =<br>
- (struct phm_ppt_v2_information *)(hwmgr->pptable);<br>
- int32_t count;<br>
- uint32_t stable_pstate_sclk_dpm_percentage;<br>
- uint32_t stable_pstate_sclk = 0, stable_pstate_mclk = 0;<br>
- uint32_t latency;<br>
-<br>
- data->battery_state = (PP_StateUILabel_Battery ==<br>
- request_ps->classification.ui_label);<br>
-<br>
- if (vega12_ps->performance_level_count != 2)<br>
- pr_info("VI should always have 2 performance levels");<br>
-<br>
- max_limits = (PP_PowerSource_AC == hwmgr->power_source) ?<br>
- &(hwmgr->dyn_state.max_clock_voltage_on_ac) :<br>
- &(hwmgr->dyn_state.max_clock_voltage_on_dc);<br>
-<br>
- /* Cap clock DPM tables at DC MAX if it is in DC. */<br>
- if (PP_PowerSource_DC == hwmgr->power_source) {<br>
- for (i = 0; i < vega12_ps->performance_level_count; i++) {<br>
- if (vega12_ps->performance_levels[i].mem_clock ><br>
- max_limits->mclk)<br>
- vega12_ps->performance_levels[i].mem_clock =<br>
- max_limits->mclk;<br>
- if (vega12_ps->performance_levels[i].gfx_clock ><br>
- max_limits->sclk)<br>
- vega12_ps->performance_levels[i].gfx_clock =<br>
- max_limits->sclk;<br>
- }<br>
- }<br>
-<br>
- cgs_get_active_displays_info(hwmgr->device, &info);<br>
-<br>
- /* result = PHM_CheckVBlankTime(hwmgr, &vblankTooShort);*/<br>
- minimum_clocks.engineClock = hwmgr->display_config.min_core_set_clock;<br>
- minimum_clocks.memoryClock = hwmgr->display_config.min_mem_set_clock;<br>
-<br>
- if (PP_CAP(PHM_PlatformCaps_StablePState)) {<br>
- PP_ASSERT_WITH_CODE(<br>
- data->registry_data.stable_pstate_sclk_dpm_percentage >= 1 &&<br>
- data->registry_data.stable_pstate_sclk_dpm_percentage <= 100,<br>
- "percent sclk value must range from 1% to 100%, setting default value",<br>
- stable_pstate_sclk_dpm_percentage = 75);<br>
-<br>
- max_limits = &(hwmgr->dyn_state.max_clock_voltage_on_ac);<br>
- stable_pstate_sclk = (max_limits->sclk *<br>
- stable_pstate_sclk_dpm_percentage) / 100;<br>
-<br>
- for (count = table_info->vdd_dep_on_sclk->count - 1;<br>
- count >= 0; count--) {<br>
- if (stable_pstate_sclk >=<br>
- table_info->vdd_dep_on_sclk->entries[count].clk) {<br>
- stable_pstate_sclk =<br>
- table_info->vdd_dep_on_sclk->entries[count].clk;<br>
- break;<br>
- }<br>
- }<br>
-<br>
- if (count < 0)<br>
- stable_pstate_sclk = table_info->vdd_dep_on_sclk->entries[0].clk;<br>
-<br>
- stable_pstate_mclk = max_limits->mclk;<br>
-<br>
- minimum_clocks.engineClock = stable_pstate_sclk;<br>
- minimum_clocks.memoryClock = stable_pstate_mclk;<br>
- }<br>
-<br>
- disable_mclk_switching_for_frame_lock = phm_cap_enabled(<br>
- hwmgr->platform_descriptor.platformCaps,<br>
- PHM_PlatformCaps_DisableMclkSwitchingForFrameLock);<br>
- disable_mclk_switching_for_vr = PP_CAP(PHM_PlatformCaps_DisableMclkSwitchForVR);<br>
- force_mclk_high = PP_CAP(PHM_PlatformCaps_ForceMclkHigh);<br>
-<br>
- if (info.display_count == 0)<br>
- disable_mclk_switching = false;<br>
- else<br>
- disable_mclk_switching = (info.display_count > 1) ||<br>
- disable_mclk_switching_for_frame_lock ||<br>
- disable_mclk_switching_for_vr ||<br>
- force_mclk_high;<br>
-<br>
- sclk = vega12_ps->performance_levels[0].gfx_clock;<br>
- mclk = vega12_ps->performance_levels[0].mem_clock;<br>
-<br>
- if (sclk < minimum_clocks.engineClock)<br>
- sclk = (minimum_clocks.engineClock > max_limits->sclk) ?<br>
- max_limits->sclk : minimum_clocks.engineClock;<br>
-<br>
- if (mclk < minimum_clocks.memoryClock)<br>
- mclk = (minimum_clocks.memoryClock > max_limits->mclk) ?<br>
- max_limits->mclk : minimum_clocks.memoryClock;<br>
-<br>
- vega12_ps->performance_levels[0].gfx_clock = sclk;<br>
- vega12_ps->performance_levels[0].mem_clock = mclk;<br>
-<br>
- if (vega12_ps->performance_levels[1].gfx_clock <<br>
- vega12_ps->performance_levels[0].gfx_clock)<br>
- vega12_ps->performance_levels[0].gfx_clock =<br>
- vega12_ps->performance_levels[1].gfx_clock;<br>
-<br>
- if (disable_mclk_switching) {<br>
- /* Set Mclk the max of level 0 and level 1 */<br>
- if (mclk < vega12_ps->performance_levels[1].mem_clock)<br>
- mclk = vega12_ps->performance_levels[1].mem_clock;<br>
- /* Find the lowest MCLK frequency that is within<br>
- * the tolerable latency defined in DAL<br>
- */<br>
- latency = 0;<br>
- for (i = 0; i < data->mclk_latency_table.count; i++) {<br>
- if ((data->mclk_latency_table.entries[i].latency <= latency) &&<br>
- (data->mclk_latency_table.entries[i].frequency >=<br>
- vega12_ps->performance_levels[0].mem_clock) &&<br>
- (data->mclk_latency_table.entries[i].frequency <=<br>
- vega12_ps->performance_levels[1].mem_clock))<br>
- mclk = data->mclk_latency_table.entries[i].frequency;<br>
- }<br>
- vega12_ps->performance_levels[0].mem_clock = mclk;<br>
- } else {<br>
- if (vega12_ps->performance_levels[1].mem_clock <<br>
- vega12_ps->performance_levels[0].mem_clock)<br>
- vega12_ps->performance_levels[0].mem_clock =<br>
- vega12_ps->performance_levels[1].mem_clock;<br>
- }<br>
-<br>
- if (PP_CAP(PHM_PlatformCaps_StablePState)) {<br>
- for (i = 0; i < vega12_ps->performance_level_count; i++) {<br>
- vega12_ps->performance_levels[i].gfx_clock = stable_pstate_sclk;<br>
- vega12_ps->performance_levels[i].mem_clock = stable_pstate_mclk;<br>
- }<br>
- }<br>
-<br>
- return 0;<br>
-}<br>
-<br>
-static int vega12_find_dpm_states_clocks_in_dpm_table(struct pp_hwmgr *hwmgr, const void *input)<br>
-{<br>
- struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);<br>
- struct PP_Clocks min_clocks = {0};<br>
- struct cgs_display_info info = {0};<br>
-<br>
- data->need_update_dpm_table = 0;<br>
-<br>
- min_clocks.engineClockInSR = hwmgr->display_config.min_core_set_clock_in_sr;<br>
- if (data->display_timing.min_clock_in_sr != min_clocks.engineClockInSR &&<br>
- (min_clocks.engineClockInSR >= VEGA12_MINIMUM_ENGINE_CLOCK ||<br>
- data->display_timing.min_clock_in_sr >= VEGA12_MINIMUM_ENGINE_CLOCK))<br>
- data->need_update_dpm_table |= DPMTABLE_UPDATE_SCLK;<br>
-<br>
- cgs_get_active_displays_info(hwmgr->device, &info);<br>
- if (data->display_timing.num_existing_displays != info.display_count)<br>
- data->need_update_dpm_table |= DPMTABLE_UPDATE_MCLK;<br>
-<br>
- return 0;<br>
-}<br>
-<br>
-static int vega12_trim_single_dpm_states(struct pp_hwmgr *hwmgr,<br>
- struct vega12_single_dpm_table *dpm_table,<br>
- uint32_t low_limit, uint32_t high_limit)<br>
-{<br>
- uint32_t i;<br>
-<br>
- for (i = 0; i < dpm_table->count; i++) {<br>
- if ((dpm_table->dpm_levels[i].value < low_limit) ||<br>
- (dpm_table->dpm_levels[i].value > high_limit))<br>
- dpm_table->dpm_levels[i].enabled = false;<br>
- else<br>
- dpm_table->dpm_levels[i].enabled = true;<br>
- }<br>
- return 0;<br>
-}<br>
-<br>
-static int vega12_trim_single_dpm_states_with_mask(struct pp_hwmgr *hwmgr,<br>
- struct vega12_single_dpm_table *dpm_table,<br>
- uint32_t low_limit, uint32_t high_limit,<br>
- uint32_t disable_dpm_mask)<br>
-{<br>
- uint32_t i;<br>
-<br>
- for (i = 0; i < dpm_table->count; i++) {<br>
- if ((dpm_table->dpm_levels[i].value < low_limit) ||<br>
- (dpm_table->dpm_levels[i].value > high_limit))<br>
- dpm_table->dpm_levels[i].enabled = false;<br>
- else if ((!((1 << i) & disable_dpm_mask)) &&<br>
- !(low_limit == high_limit))<br>
- dpm_table->dpm_levels[i].enabled = false;<br>
- else<br>
- dpm_table->dpm_levels[i].enabled = true;<br>
- }<br>
- return 0;<br>
-}<br>
-<br>
-static int vega12_trim_dpm_states(struct pp_hwmgr *hwmgr,<br>
- const struct vega12_power_state *vega12_ps)<br>
-{<br>
- struct vega12_hwmgr *data =<br>
- (struct vega12_hwmgr *)(hwmgr->backend);<br>
- uint32_t high_limit_count;<br>
-<br>
- PP_ASSERT_WITH_CODE((vega12_ps->performance_level_count >= 1),<br>
- "power state did not have any performance level",<br>
- return -1);<br>
-<br>
- high_limit_count = (vega12_ps->performance_level_count == 1) ? 0 : 1;<br>
-<br>
- vega12_trim_single_dpm_states(hwmgr,<br>
- &(data->dpm_table.soc_table),<br>
- vega12_ps->performance_levels[0].soc_clock,<br>
- vega12_ps->performance_levels[high_limit_count].soc_clock);<br>
-<br>
- vega12_trim_single_dpm_states_with_mask(hwmgr,<br>
- &(data->dpm_table.gfx_table),<br>
- vega12_ps->performance_levels[0].gfx_clock,<br>
- vega12_ps->performance_levels[high_limit_count].gfx_clock,<br>
- data->disable_dpm_mask);<br>
-<br>
- vega12_trim_single_dpm_states(hwmgr,<br>
- &(data->dpm_table.mem_table),<br>
- vega12_ps->performance_levels[0].mem_clock,<br>
- vega12_ps->performance_levels[high_limit_count].mem_clock);<br>
-<br>
- return 0;<br>
-}<br>
-<br>
static uint32_t vega12_find_lowest_dpm_level(<br>
struct vega12_single_dpm_table *table)<br>
{<br>
@@ -1250,45 +979,6 @@ static int vega12_upload_dpm_max_level(struct pp_hwmgr *hwmgr)<br>
return 0;<br>
}<br>
<br>
-static int vega12_generate_dpm_level_enable_mask(<br>
- struct pp_hwmgr *hwmgr, const void *input)<br>
-{<br>
- struct vega12_hwmgr *data =<br>
- (struct vega12_hwmgr *)(hwmgr->backend);<br>
- const struct phm_set_power_state_input *states =<br>
- (const struct phm_set_power_state_input *)input;<br>
- const struct vega12_power_state *vega12_ps =<br>
- cast_const_phw_vega12_power_state(states->pnew_state);<br>
- int i;<br>
-<br>
- PP_ASSERT_WITH_CODE(!vega12_trim_dpm_states(hwmgr, vega12_ps),<br>
- "Attempt to Trim DPM States Failed!",<br>
- return -1);<br>
-<br>
- data->smc_state_table.gfx_boot_level =<br>
- vega12_find_lowest_dpm_level(&(data->dpm_table.gfx_table));<br>
- data->smc_state_table.gfx_max_level =<br>
- vega12_find_highest_dpm_level(&(data->dpm_table.gfx_table));<br>
- data->smc_state_table.mem_boot_level =<br>
- vega12_find_lowest_dpm_level(&(data->dpm_table.mem_table));<br>
- data->smc_state_table.mem_max_level =<br>
- vega12_find_highest_dpm_level(&(data->dpm_table.mem_table));<br>
-<br>
- PP_ASSERT_WITH_CODE(!vega12_upload_dpm_min_level(hwmgr),<br>
- "Attempt to upload DPM Bootup Levels Failed!",<br>
- return -1);<br>
- PP_ASSERT_WITH_CODE(!vega12_upload_dpm_max_level(hwmgr),<br>
- "Attempt to upload DPM Max Levels Failed!",<br>
- return -1);<br>
- for (i = data->smc_state_table.gfx_boot_level; i < data->smc_state_table.gfx_max_level; i++)<br>
- data->dpm_table.gfx_table.dpm_levels[i].enabled = true;<br>
-<br>
-<br>
- for (i = data->smc_state_table.mem_boot_level; i < data->smc_state_table.mem_max_level; i++)<br>
- data->dpm_table.mem_table.dpm_levels[i].enabled = true;<br>
-<br>
- return 0;<br>
-}<br>
<br>
int vega12_enable_disable_vce_dpm(struct pp_hwmgr *hwmgr, bool enable)<br>
{<br>
@@ -1307,45 +997,6 @@ int vega12_enable_disable_vce_dpm(struct pp_hwmgr *hwmgr, bool enable)<br>
return 0;<br>
}<br>
<br>
-static int vega12_update_sclk_threshold(struct pp_hwmgr *hwmgr)<br>
-{<br>
- return 0;<br>
-}<br>
-<br>
-static int vega12_set_power_state_tasks(struct pp_hwmgr *hwmgr,<br>
- const void *input)<br>
-{<br>
- int tmp_result, result = 0;<br>
- struct vega12_hwmgr *data =<br>
- (struct vega12_hwmgr *)(hwmgr->backend);<br>
- PPTable_t *pp_table = &(data->smc_state_table.pp_table);<br>
-<br>
- tmp_result = vega12_find_dpm_states_clocks_in_dpm_table(hwmgr, input);<br>
- PP_ASSERT_WITH_CODE(!tmp_result,<br>
- "Failed to find DPM states clocks in DPM table!",<br>
- result = tmp_result);<br>
-<br>
- tmp_result = vega12_generate_dpm_level_enable_mask(hwmgr, input);<br>
- PP_ASSERT_WITH_CODE(!tmp_result,<br>
- "Failed to generate DPM level enabled mask!",<br>
- result = tmp_result);<br>
-<br>
- tmp_result = vega12_update_sclk_threshold(hwmgr);<br>
- PP_ASSERT_WITH_CODE(!tmp_result,<br>
- "Failed to update SCLK threshold!",<br>
- result = tmp_result);<br>
-<br>
- result = vega12_copy_table_to_smc(hwmgr,<br>
- (uint8_t *)pp_table, TABLE_PPTABLE);<br>
- PP_ASSERT_WITH_CODE(!result,<br>
- "Failed to upload PPtable!", return result);<br>
-<br>
- data->apply_optimized_settings = false;<br>
- data->apply_overdrive_next_settings_mask = 0;<br>
-<br>
- return 0;<br>
-}<br>
-<br>
static uint32_t vega12_dpm_get_sclk(struct pp_hwmgr *hwmgr, bool low)<br>
{<br>
struct vega12_hwmgr *data =<br>
@@ -2217,50 +1868,6 @@ static void vega12_power_gate_uvd(struct pp_hwmgr *hwmgr, bool bgate)<br>
vega12_enable_disable_uvd_dpm(hwmgr, !bgate);<br>
}<br>
<br>
-static inline bool vega12_are_power_levels_equal(<br>
- const struct vega12_performance_level *pl1,<br>
- const struct vega12_performance_level *pl2)<br>
-{<br>
- return ((pl1->soc_clock == pl2->soc_clock) &&<br>
- (pl1->gfx_clock == pl2->gfx_clock) &&<br>
- (pl1->mem_clock == pl2->mem_clock));<br>
-}<br>
-<br>
-static int vega12_check_states_equal(struct pp_hwmgr *hwmgr,<br>
- const struct pp_hw_power_state *pstate1,<br>
- const struct pp_hw_power_state *pstate2, bool *equal)<br>
-{<br>
- const struct vega12_power_state *psa;<br>
- const struct vega12_power_state *psb;<br>
- int i;<br>
-<br>
- if (pstate1 == NULL || pstate2 == NULL || equal == NULL)<br>
- return -EINVAL;<br>
-<br>
- psa = cast_const_phw_vega12_power_state(pstate1);<br>
- psb = cast_const_phw_vega12_power_state(pstate2);<br>
- /* If the two states don't even have the same number of performance levels they cannot be the same state. */<br>
- if (psa->performance_level_count != psb->performance_level_count) {<br>
- *equal = false;<br>
- return 0;<br>
- }<br>
-<br>
- for (i = 0; i < psa->performance_level_count; i++) {<br>
- if (!vega12_are_power_levels_equal(&(psa->performance_levels[i]), &(psb->performance_levels[i]))) {<br>
- /* If we have found even one performance level pair that is different the states are different. */<br>
- *equal = false;<br>
- return 0;<br>
- }<br>
- }<br>
-<br>
- /* If all performance levels are the same try to use the UVD clocks to break the tie.*/<br>
- *equal = ((psa->uvd_clks.vclk == psb->uvd_clks.vclk) && (psa->uvd_clks.dclk == psb->uvd_clks.dclk));<br>
- *equal &= ((psa->vce_clks.evclk == psb->vce_clks.evclk) && (psa->vce_clks.ecclk == psb->vce_clks.ecclk));<br>
- *equal &= (psa->sclk_threshold == psb->sclk_threshold);<br>
-<br>
- return 0;<br>
-}<br>
-<br>
static bool<br>
vega12_check_smc_update_required_for_display_configuration(struct pp_hwmgr *hwmgr)<br>
{<br>
@@ -2337,37 +1944,6 @@ static void vega12_find_min_clock_index(struct pp_hwmgr *hwmgr,<br>
static int vega12_set_power_profile_state(struct pp_hwmgr *hwmgr,<br>
struct amd_pp_profile *request)<br>
{<br>
- struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);<br>
- uint32_t sclk_idx = ~0, mclk_idx = ~0;<br>
-<br>
- if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_AUTO)<br>
- return -EINVAL;<br>
-<br>
- vega12_find_min_clock_index(hwmgr, &sclk_idx, &mclk_idx,<br>
- request->min_sclk, request->min_mclk);<br>
-<br>
- if (sclk_idx != ~0) {<br>
- if (!data->registry_data.sclk_dpm_key_disabled)<br>
- PP_ASSERT_WITH_CODE(<br>
- !smum_send_msg_to_smc_with_parameter(<br>
- hwmgr,<br>
- PPSMC_MSG_SetSoftMinGfxclkByIndex,<br>
- sclk_idx),<br>
- "Failed to set soft min sclk index!",<br>
- return -EINVAL);<br>
- }<br>
-<br>
- if (mclk_idx != ~0) {<br>
- if (!data->registry_data.mclk_dpm_key_disabled)<br>
- PP_ASSERT_WITH_CODE(<br>
- !smum_send_msg_to_smc_with_parameter(<br>
- hwmgr,<br>
- PPSMC_MSG_SetSoftMinUclkByIndex,<br>
- mclk_idx),<br>
- "Failed to set soft min mclk index!",<br>
- return -EINVAL);<br>
- }<br>
-<br>
return 0;<br>
}<br>
<br>
@@ -2389,28 +1965,6 @@ static int vega12_get_sclk_od(struct pp_hwmgr *hwmgr)<br>
<br>
static int vega12_set_sclk_od(struct pp_hwmgr *hwmgr, uint32_t value)<br>
{<br>
- struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);<br>
- struct vega12_single_dpm_table *golden_sclk_table =<br>
- &(data->golden_dpm_table.gfx_table);<br>
- struct pp_power_state *ps;<br>
- struct vega12_power_state *vega12_ps;<br>
-<br>
- ps = hwmgr->request_ps;<br>
-<br>
- if (ps == NULL)<br>
- return -EINVAL;<br>
-<br>
- vega12_ps = cast_phw_vega12_power_state(&ps->hardware);<br>
-<br>
- vega12_ps->performance_levels[vega12_ps->performance_level_count - 1].gfx_clock =<br>
- golden_sclk_table->dpm_levels[golden_sclk_table->count - 1].value * value / 100 +<br>
- golden_sclk_table->dpm_levels[golden_sclk_table->count - 1].value;<br>
-<br>
- if (vega12_ps->performance_levels[vega12_ps->performance_level_count - 1].gfx_clock ><br>
- hwmgr->platform_descriptor.overdriveLimit.engineClock)<br>
- vega12_ps->performance_levels[vega12_ps->performance_level_count - 1].gfx_clock =<br>
- hwmgr->platform_descriptor.overdriveLimit.engineClock;<br>
-<br>
return 0;<br>
}<br>
<br>
@@ -2435,34 +1989,6 @@ static int vega12_get_mclk_od(struct pp_hwmgr *hwmgr)<br>
<br>
static int vega12_set_mclk_od(struct pp_hwmgr *hwmgr, uint32_t value)<br>
{<br>
- struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);<br>
- struct vega12_single_dpm_table *golden_mclk_table =<br>
- &(data->golden_dpm_table.mem_table);<br>
- struct pp_power_state *ps;<br>
- struct vega12_power_state *vega12_ps;<br>
-<br>
- ps = hwmgr->request_ps;<br>
-<br>
- if (ps == NULL)<br>
- return -EINVAL;<br>
-<br>
- vega12_ps = cast_phw_vega12_power_state(&ps->hardware);<br>
-<br>
- vega12_ps->performance_levels<br>
- [vega12_ps->performance_level_count - 1].mem_clock =<br>
- golden_mclk_table->dpm_levels<br>
- [golden_mclk_table->count - 1].value *<br>
- value / 100 +<br>
- golden_mclk_table->dpm_levels<br>
- [golden_mclk_table->count - 1].value;<br>
-<br>
- if (vega12_ps->performance_levels<br>
- [vega12_ps->performance_level_count - 1].mem_clock ><br>
- hwmgr->platform_descriptor.overdriveLimit.memoryClock)<br>
- vega12_ps->performance_levels<br>
- [vega12_ps->performance_level_count - 1].mem_clock =<br>
- hwmgr->platform_descriptor.overdriveLimit.memoryClock;<br>
-<br>
return 0;<br>
}<br>
#endif<br>
@@ -2514,12 +2040,7 @@ static int vega12_get_thermal_temperature_range(struct pp_hwmgr *hwmgr,<br>
.asic_setup = vega12_setup_asic_task,<br>
.dynamic_state_management_enable = vega12_enable_dpm_tasks,<br>
.dynamic_state_management_disable = vega12_disable_dpm_tasks,<br>
- .get_num_of_pp_table_entries =<br>
- vega12_get_number_of_pp_table_entries,<br>
- .get_power_state_size = vega12_get_power_state_size,<br>
.patch_boot_state = vega12_patch_boot_state,<br>
- .apply_state_adjust_rules = vega12_apply_state_adjust_rules,<br>
- .power_state_set = vega12_set_power_state_tasks,<br>
.get_sclk = vega12_dpm_get_sclk,<br>
.get_mclk = vega12_dpm_get_mclk,<br>
.notify_smc_display_config_after_ps_adjustment =<br>
@@ -2543,7 +2064,6 @@ static int vega12_get_thermal_temperature_range(struct pp_hwmgr *hwmgr,<br>
.display_config_changed = vega12_display_configuration_changed_task,<br>
.powergate_uvd = vega12_power_gate_uvd,<br>
.powergate_vce = vega12_power_gate_vce,<br>
- .check_states_equal = vega12_check_states_equal,<br>
.check_smc_update_required_for_display_configuration =<br>
vega12_check_smc_update_required_for_display_configuration,<br>
.power_off_asic = vega12_power_off_asic,<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.h b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.h<br>
index 644c7f0..bc98b1d 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.h<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.h<br>
@@ -86,37 +86,6 @@ struct smu_features {<br>
uint64_t smu_feature_bitmap;<br>
};<br>
<br>
-struct vega12_performance_level {<br>
- uint32_t soc_clock;<br>
- uint32_t gfx_clock;<br>
- uint32_t mem_clock;<br>
-};<br>
-<br>
-struct vega12_bacos {<br>
- uint32_t baco_flags;<br>
- /* struct vega12_performance_level performance_level; */<br>
-};<br>
-<br>
-struct vega12_uvd_clocks {<br>
- uint32_t vclk;<br>
- uint32_t dclk;<br>
-};<br>
-<br>
-struct vega12_vce_clocks {<br>
- uint32_t evclk;<br>
- uint32_t ecclk;<br>
-};<br>
-<br>
-struct vega12_power_state {<br>
- uint32_t magic;<br>
- struct vega12_uvd_clocks uvd_clks;<br>
- struct vega12_vce_clocks vce_clks;<br>
- uint16_t performance_level_count;<br>
- bool dc_compatible;<br>
- uint32_t sclk_threshold;<br>
- struct vega12_performance_level performance_levels[VEGA12_MAX_HARDWARE_POWERLEVELS];<br>
-};<br>
-<br>
struct vega12_dpm_level {<br>
bool enabled;<br>
uint32_t value;<br>
@@ -350,7 +319,6 @@ struct vega12_hwmgr {<br>
<br>
uint32_t active_auto_throttle_sources;<br>
uint32_t water_marks_bitmap;<br>
- struct vega12_bacos bacos;<br>
<br>
struct vega12_odn_dpm_table odn_dpm_table;<br>
struct vega12_odn_fan_table odn_fan_table;<br>
-- <br>
1.9.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</body>
</html>