drm/amd/powerplay: refine struct name for code style reason.
Subsystems (2)
PATCH 1/4 drm/amd/powerplay: refine struct name for code style reason.
--- drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c | 2 +- drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 4 ++-- drivers/gpu/drm/amd/powerplay/inc/power_state.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c +1 -1
@@ -1523,7 +1523,7 @@ int get_number_of_vce_state_table_entries(int get_vce_state_table_entry (struct pp_hwmgr *hwmgr,unsigned long i, -struct PP_VCEState *vce_state, +struct pp_vce_state *vce_state,void **clock_info,unsigned long *flag) {
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +2 -2
@@ -36,7 +36,7 @@ struct pp_instance;struct pp_hwmgr ;struct pp_hw_power_state ;struct pp_power_state ; -struct PP_VCEState ; +struct pp_vce_state ;struct phm_fan_speed_info ;struct pp_atomctrl_voltage_table ;
@@ -354,7 +354,7 @@ struct pp_table_func {int (*pptable_get_vce_state_table_entry)(struct pp_hwmgr *hwmgr,unsigned long i, -struct PP_VCEState *vce_state, +struct pp_vce_state *vce_state,void **clock_info,unsigned long *flag); };
drivers/gpu/drm/amd/powerplay/inc/power_state.h +1 -1
@@ -158,7 +158,7 @@ struct pp_power_state {/*Structure to hold a VCE state entry*/ -struct PP_VCEState { +struct pp_vce_state {uint32_t evclk;uint32_t ecclk;uint32_t sclk;
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1472677542-10605-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org
PATCH 2/4 drm/amd/powerplay: add vce state tables initialize for ppt v1.
--- .../amd/powerplay/hwmgr/tonga_processpptables.c | 58 ++++++++++++++++++++++ drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 22 ++++++-- 2 files changed, 75 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c +58 -0
@@ -1164,6 +1164,54 @@ static uint32_t make_classification_flags(struct pp_hwmgr *hwmgr,return result; } +static int ppt_get_num_of_vce_state_table_entries_v1_0 (struct pp_hwmgr *hwmgr) +{ +const ATOM_Tonga_POWERPLAYTABLE *pp_table =get_powerplay_table (hwmgr); +const ATOM_Tonga_VCE_State_Table *vce_state_table = + (ATOM_Tonga_VCE_State_Table *)(((unsigned long )pp_table) +le16_to_cpu (pp_table->usVCEStateTableOffset)); + +if (vce_state_table ==NULL ) +return 0 ; + +return vce_state_table->ucNumEntries; +} + + +static int ppt_get_vce_state_table_entry_v1_0 (struct pp_hwmgr *hwmgr,uint32_t i, +struct pp_vce_state *vce_state,void **clock_info,uint32_t *flag) +{ +const ATOM_Tonga_VCE_State_Record *vce_state_record; +const ATOM_Tonga_POWERPLAYTABLE *pptable =get_powerplay_table (hwmgr); +const ATOM_Tonga_VCE_State_Table *vce_state_table = (ATOM_Tonga_VCE_State_Table *)(((unsigned long )pptable) + +le16_to_cpu (pptable->usVCEStateTableOffset)); +const ATOM_Tonga_SCLK_Dependency_Table *sclk_dep_table = (ATOM_Tonga_SCLK_Dependency_Table *)(((unsigned long )pptable) + +le16_to_cpu (pptable->usSclkDependencyTableOffset)); +const ATOM_Tonga_MCLK_Dependency_Table *mclk_dep_table = (ATOM_Tonga_MCLK_Dependency_Table *)(((unsigned long )pptable) + +le16_to_cpu (pptable->usMclkDependencyTableOffset)); +const ATOM_Tonga_MM_Dependency_Table *mm_dep_table = (ATOM_Tonga_MM_Dependency_Table *)(((unsigned long )pptable) + +le16_to_cpu (pptable->usMMDependencyTableOffset)); + +PP_ASSERT_WITH_CODE ((i <= vce_state_table->ucNumEntries), +"Requested state entry ID is out of range!" , + return -EINVAL ); + + vce_state_record = (ATOM_Tonga_VCE_State_Record *)((char *)&vce_state_table->entries[1 ] + + (sizeof (ATOM_Tonga_VCE_State_Record) * i)); + + *flag = vce_state_record->ucFlag; + + vce_state->evclk = mm_dep_table->entries[vce_state_record->ucVCEClockIndex].ulEClk; + vce_state->ecclk = mm_dep_table->entries[vce_state_record->ucVCEClockIndex].ulEClk; + vce_state->sclk = sclk_dep_table->entries[vce_state_record->ucSCLKIndex].ulSclk; + +if (vce_state_record->ucMCLKIndex >= mclk_dep_table->ucNumEntries) + vce_state->mclk = mclk_dep_table->entries[mclk_dep_table->ucNumEntries -1 ].ulMclk; +else + vce_state->mclk = mclk_dep_table->entries[vce_state_record->ucMCLKIndex].ulMclk; + +return 0 ; +} +/** * Create a Power State out of an entry in the PowerPlay table. * This function is called by the hardware back-end.
@@ -1181,6 +1229,8 @@ int tonga_get_powerplay_table_entry(struct pp_hwmgr *hwmgr,const ATOM_Tonga_State_Array * state_arrays;const ATOM_Tonga_State *state_entry;const ATOM_Tonga_POWERPLAYTABLE *pp_table =get_powerplay_table (hwmgr); +int i, j; +uint32_t flags =0 ; PP_ASSERT_WITH_CODE((NULL != pp_table), "Missing PowerPlay Table!", return -1;); power_state->classification.bios_index = entry_index;
@@ -1210,5 +1260,13 @@ int tonga_get_powerplay_table_entry(struct pp_hwmgr *hwmgr, PP_StateClassificationFlag_Boot)) result = hwmgr->hwmgr_func->patch_boot_state (hwmgr, &(power_state->hardware)); + hwmgr->num_vce_state_tables = i =ppt_get_num_of_vce_state_table_entries_v1_0 (hwmgr); + +if ((i !=0 ) && (i <=PP_MAX_VCE_LEVELS )) { +for (j =0 ; j < i; j++) +ppt_get_vce_state_table_entry_v1_0 (hwmgr, j, &(hwmgr->vce_states[j]),NULL , &flags); + } +return result; } +
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +17 -5
@@ -31,16 +31,13 @@#include "hwmgr_ppt.h" #include "ppatomctrl.h" #include "hwmgr_ppt.h" +#include "power_state.h" struct pp_instance ;struct pp_hwmgr ; -struct pp_hw_power_state ; -struct pp_power_state ; -struct pp_vce_state ;struct phm_fan_speed_info ;struct pp_atomctrl_voltage_table ; -extern int amdgpu_powercontainment;extern int amdgpu_sclk_deep_sleep_en;
@@ -52,7 +49,6 @@ enum DISPLAY_GAP { };typedef enum DISPLAY_GAP DISPLAY_GAP ; -struct vi_dpm_level {bool enabled;uint32_t value;
@@ -573,6 +569,18 @@ struct phm_microcode_version_info {uint32_t NB ; }; +#define PP_MAX_VCE_LEVELS 6 + +enum PP_VCE_LEVEL { +PP_VCE_LEVEL_AC_ALL =0 ,/* AC, All cases */ +PP_VCE_LEVEL_DC_EE =1 ,/* DC, entropy encoding */ +PP_VCE_LEVEL_DC_LL_LOW =2 ,/* DC, low latency queue, res <= 720 */ +PP_VCE_LEVEL_DC_LL_HIGH =3 ,/* DC, low latency queue, 1080 >= res > 720 */ +PP_VCE_LEVEL_DC_GP_LOW =4 ,/* DC, general purpose queue, res <= 720 */ +PP_VCE_LEVEL_DC_GP_HIGH =5 ,/* DC, general purpose queue, 1080 >= res > 720 */ +}; + +/** * The main hardware manager structure. */
@@ -586,6 +594,10 @@ struct pp_hwmgr {uint32_t soft_pp_table_size;void *hardcode_pp_table;bool need_pp_table_upload; + +struct pp_vce_state vce_states[PP_MAX_VCE_LEVELS ]; +uint32_t num_vce_state_tables; +enum amd_dpm_forced_level dpm_level;bool block_hw_access;struct phm_gfx_arbiter gfx_arbiter;
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/4 drm/amd/powerplay: refine struct name for coding style reason.
In reply to a message not in the archivedelete useless member.
--- drivers/gpu/drm/amd/powerplay/inc/power_state.h | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/powerplay/inc/power_state.h +9 -11
@@ -171,30 +171,28 @@ enum PP_MMProfilingState {PP_MMProfilingState_Stopped }; -struct PP_Clock_Engine_Request { -unsigned long clientType; -unsigned long ctxid; +struct pp_clock_engine_request { +unsigned long client_type; +unsigned long ctx_id;uint64_t context_handle;unsigned long sclk; -unsigned long sclkHardMin; +unsigned long sclk_hard_min;unsigned long mclk;unsigned long iclk;unsigned long evclk;unsigned long ecclk; -unsigned long ecclkHardMin; +unsigned long ecclk_hard_min;unsigned long vclk;unsigned long dclk; -unsigned long samclk; -unsigned long acpclk; -unsigned long sclkOverdrive; -unsigned long mclkOverdrive; +unsigned long sclk_over_drive; +unsigned long mclk_over_drive;unsigned long sclk_threshold;unsigned long flag;unsigned long vclk_ceiling;unsigned long dclk_ceiling;unsigned long num_cus; -unsigned long pmflag; -enum PP_MMProfilingState MMProfilingState; +unsigned long pm_flag; +enum PP_MMProfilingState mm_profiling_state; };#endif
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/4 drm/amd/powerplay: read power state table from vbios and can't be changed. so allocate memory for request ps and current ps.
In reply to a message not in the archive--- drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 2 +- drivers/gpu/drm/amd/powerplay/eventmgr/psm.c | 5 +++-- drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 15 +++++++++++++-- 3 files changed, 17 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +1 -1
@@ -538,7 +538,7 @@ int pp_dpm_dispatch_tasks(void *handle, enum amd_pp_event event_id, void *input, ret =pem_handle_event (pp_handle->eventmgr, event_id, &data);break ;case AMD_PP_EVENT_READJUST_POWER_STATE : - pp_handle->hwmgr->current_ps = pp_handle->hwmgr->boot_ps; +memcpy (pp_handle->hwmgr->current_ps, pp_handle->hwmgr->boot_ps, pp_handle->hwmgr->ps_size); ret =pem_handle_event (pp_handle->eventmgr, event_id, &data);break ;default :
drivers/gpu/drm/amd/powerplay/eventmgr/psm.c +3 -2
@@ -70,11 +70,12 @@ int psm_set_states(struct pp_eventmgr *eventmgr, unsigned long *state_id)int i; table_entries = hwmgr->num_ps; + state = hwmgr->ps;for (i =0 ; i < table_entries; i++) {if (state->id == *state_id) { - hwmgr->request_ps = state; +memcpy (hwmgr->request_ps, state, hwmgr->ps_size);return 0 ; } state = (struct pp_power_state *)((unsigned long )state + hwmgr->ps_size);
@@ -106,7 +107,7 @@ int psm_adjust_power_state_dynamic(struct pp_eventmgr *eventmgr, bool skip)if (!equal ||phm_check_smc_update_required_for_display_configuration (hwmgr)) {phm_apply_state_adjust_rules (hwmgr, requested, pcurrent);phm_set_power_state (hwmgr, &pcurrent->hardware, &requested->hardware); - hwmgr->current_ps = requested; +memcpy (hwmgr->current_ps, hwmgr->request_ps, hwmgr->ps_size); }return 0 ; }
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +13 -2
@@ -128,6 +128,8 @@ int hwmgr_fini(struct pp_hwmgr *hwmgr)kfree (hwmgr->set_temperature_range.function_list);kfree (hwmgr->ps); +kfree (hwmgr->current_ps); +kfree (hwmgr->request_ps);kfree (hwmgr);return 0 ; }
@@ -152,10 +154,17 @@ int hw_init_power_state_table(struct pp_hwmgr *hwmgr)sizeof (struct pp_power_state ); hwmgr->ps =kzalloc (size * table_entries,GFP_KERNEL ); -if (hwmgr->ps ==NULL )return -ENOMEM ; + hwmgr->request_ps =kzalloc (size,GFP_KERNEL ); +if (hwmgr->request_ps ==NULL ) +return -ENOMEM ; + + hwmgr->current_ps =kzalloc (size,GFP_KERNEL ); +if (hwmgr->current_ps ==NULL ) +return -ENOMEM ; + state = hwmgr->ps;for (i =0 ; i < table_entries; i++) {
@@ -163,7 +172,8 @@ int hw_init_power_state_table(struct pp_hwmgr *hwmgr)if (state->classification.flags & PP_StateClassificationFlag_Boot) { hwmgr->boot_ps = state; - hwmgr->current_ps = hwmgr->request_ps = state; +memcpy (hwmgr->current_ps, state, size); +memcpy (hwmgr->request_ps, state, size); } state->id = i +1 ;/* assigned unique num for every power state id */
@@ -173,6 +183,7 @@ int hw_init_power_state_table(struct pp_hwmgr *hwmgr) state = (struct pp_power_state *)((unsigned long )state + size); } +return 0 ; }
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1472677542-10605-4-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org
Deucher, Alexander
Reviewed-by Alex DeucherRE: [PATCH 4/4] drm/amd/powerplay: read power state table from vbios and can't be changed. so allocate memory for request ps and current ps.
Quoted 9 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Rex Zhu
Sent: Wednesday, August 31, 2016 5:06 PM
To: [email protected]
Cc: Zhu, Rex
Subject: [PATCH 4/4] drm/amd/powerplay: read power state table from vbios and can't be changed. so allocate memory for request ps and current ps.
The subject line is way too long. Make it shorter and include a description in the commit log. With that fixed, this series is:
Quoted 120 lines
Signed-off-by Rex Zhu <[email protected]>--- drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 2 +- drivers/gpu/drm/amd/powerplay/eventmgr/psm.c | 5 +++-- drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 15 +++++++++++++-- 3 files changed, 17 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/powerplay/amd_powerplay.c +1
-1@@ -538,7 +538,7 @@ int pp_dpm_dispatch_tasks(void *handle, enum amd_pp_event event_id, void *input, ret =pem_handle_event (pp_handle->eventmgr, event_id, &data);break ;case AMD_PP_EVENT_READJUST_POWER_STATE : - pp_handle->hwmgr->current_ps = pp_handle->hwmgr- >boot_ps; + memcpy(pp_handle->hwmgr->current_ps, pp_handle-Quoted 1 line
hwmgr->boot_ps,pp_handle->hwmgr->ps_size);ret = pem_handle_event(pp_handle->eventmgr,
event_id,
&data);drivers/gpu/drm/amd/powerplay/amd_powerplay.c +0
-0break ;default :drivers/gpu/drm/amd/powerplay/eventmgr/psm.c +2
-1@@ -70,11 +70,12 @@ int psm_set_states(struct pp_eventmgr *eventmgr, unsigned long *state_id)int i; table_entries = hwmgr->num_ps; + state = hwmgr->ps;for (i =0 ; i < table_entries; i++) {if (state->id == *state_id) { - hwmgr->request_ps = state; +memcpy (hwmgr->request_ps, state, hwmgr- >ps_size);return 0 ;drivers/gpu/drm/amd/powerplay/eventmgr/psm.c +0
-0} state = (struct pp_power_state *)((unsigned long)state +
hwmgr->ps_size);drivers/gpu/drm/amd/powerplay/eventmgr/psm.c +1
-1@@ -106,7 +107,7 @@ int psm_adjust_power_state_dynamic(struct pp_eventmgr *eventmgr, bool skip)if (!equal ||phm_check_smc_update_required_for_display_configuration (hwmgr)) {phm_apply_state_adjust_rules (hwmgr, requested, pcurrent);phm_set_power_state (hwmgr, &pcurrent->hardware, &requested->hardware); - hwmgr->current_ps = requested; + memcpy(hwmgr->current_ps, hwmgr->request_ps, hwmgr-Quoted 1 line
ps_size);drivers/gpu/drm/amd/powerplay/eventmgr/psm.c +0
-0}return 0 ; }drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +10
-1@@ -128,6 +128,8 @@ int hwmgr_fini(struct pp_hwmgr *hwmgr)kfree (hwmgr->set_temperature_range.function_list);kfree (hwmgr->ps); +kfree (hwmgr->current_ps); +kfree (hwmgr->request_ps);kfree (hwmgr);return 0 ; }@@ -152,10 +154,17 @@ int hw_init_power_state_table(struct pp_hwmgr *hwmgr)sizeof (struct pp_power_state ); hwmgr->ps =kzalloc (size * table_entries,GFP_KERNEL ); -if (hwmgr->ps ==NULL )return -ENOMEM ; + hwmgr->request_ps =kzalloc (size,GFP_KERNEL ); +if (hwmgr->request_ps ==NULL ) +return -ENOMEM ; + + hwmgr->current_ps =kzalloc (size,GFP_KERNEL ); +if (hwmgr->current_ps ==NULL ) +return -ENOMEM ; + state = hwmgr->ps;drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +2
-1for (i =0 ; i < table_entries; i++) {@@ -163,7 +172,8 @@ int hw_init_power_state_table(struct pp_hwmgr *hwmgr)if (state->classification.flags & PP_StateClassificationFlag_Boot) { hwmgr->boot_ps = state; - hwmgr->current_ps = hwmgr->request_ps = state; +memcpy (hwmgr->current_ps, state, size); +memcpy (hwmgr->request_ps, state, size); }
state->id= i + 1; /* assigned unique num for every power
state id */drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +1
-0@@ -173,6 +183,7 @@ int hw_init_power_state_table(struct pp_hwmgr *hwmgr) state = (struct pp_power_state *)((unsigned long )state + size); } +return 0 ;}
Quoted 7 lines
--
1.9.1_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx