drm/amdgpu: Initialize and update SDMA power gating
Subsystems (2)
PATCH 1/4 drm/amdgpu: Initialize and update SDMA power gating
From: Prike Liang <[email protected]>
Init SDMA HW base configuration and enable idle INT for rn.
--- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +1 -0
@@ -1203,6 +1203,7 @@ static void sdma_v4_0_init_pg(struct amdgpu_device *adev)switch (adev->asic_type) {case CHIP_RAVEN : +case CHIP_RENOIR :sdma_v4_1_init_power_gating (adev);sdma_v4_1_update_power_gating (adev, true);break ;
Signature · 6 lines
2.20.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): 20190828151943.3619-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org
PATCH 2/4 drm/amd/powerplay: regards the APU always enable the dpm feature mask
From: Prike Liang <[email protected]>
There is no driver message to enable/disable feature mask for APU. For the sake of APU reusing swSMU interface and assume APU supports all the feature.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -1
@@ -636,7 +636,7 @@ int smu_feature_is_enabled(struct smu_context *smu, enum smu_feature_mask mask)int ret =0 ;if (adev->flags &AMD_IS_APU ) -return 0 ; +return 1 ; feature_id =smu_feature_get_index (smu, mask);if (feature_id <0 )
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/4 drm/amd/powerplay: enable populate DPM clocks table for swSMU APU
In reply to a message not in the archiveFrom: Prike Liang <[email protected]>
Should populate DPM clocks tables during hw init,otherwise will suffer from invalidate table.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -3
@@ -1042,9 +1042,6 @@ static int smu_smc_table_hw_init(struct smu_context *smu,struct amdgpu_device *adev = smu->adev;int ret; -if (adev->flags &AMD_IS_APU ) -return 0 ; -if (smu_is_dpm_running (smu) && adev->in_suspend) {pr_info ("dpm has been enabled\n" );return 0 ;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/4 drm/amd/powerplay: add the interface for getting ultimate frequency v3
In reply to a message not in the archiveFrom: Prike Liang <[email protected]>
add the get_dpm_ultimate_freq for supporting different swSMU.
-v2:
Handle the unsupported clock type and read smc message failed case and return error code. Move the smu12 uclk frequency retrieved logic to renoir ppt.
-v3:
Use goto clause to handle invalidate clk index.
Add the limited tag for smu_get_dpm_uclk to avoid other likewise interface introduced.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 38 ++---------- .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 10 ++- drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 22 +++++++ drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 38 ++++++++++++ drivers/gpu/drm/amd/powerplay/smu_v12_0.c | 62 +++++++++++++++++++ 5 files changed, 137 insertions(+), 33 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +6 -32
@@ -231,9 +231,8 @@ int smu_set_hard_freq_range(struct smu_context *smu, enum smu_clk_type clk_type,int smu_get_dpm_freq_range (struct smu_context *smu,enum smu_clk_type clk_type,uint32_t *min,uint32_t *max) { -int ret =0 , clk_id =0 ; -uint32_t param =0 ;uint32_t clock_limit; +int ret =0 ;if (!min && !max)return -EINVAL ;
@@ -264,36 +263,11 @@ int smu_get_dpm_freq_range(struct smu_context *smu, enum smu_clk_type clk_type,return 0 ; } - -mutex_lock (&smu->mutex); - clk_id =smu_clk_get_index (smu, clk_type); -if (clk_id <0 ) { - ret = -EINVAL ; - goto failed; - } - - param = (clk_id &0xffff ) <<16 ; - -if (max) { - ret =smu_send_smc_msg_with_param (smu, SMU_MSG_GetMaxDpmFreq, param); -if (ret) - goto failed; - ret =smu_read_smc_arg (smu, max); -if (ret) - goto failed; - } - -if (min) { - ret =smu_send_smc_msg_with_param (smu, SMU_MSG_GetMinDpmFreq, param); -if (ret) - goto failed; - ret =smu_read_smc_arg (smu, min); -if (ret) - goto failed; - } - -failed: -mutex_unlock (&smu->mutex); +/* +* Todo: Use each asic(ASIC_ppt funcs) control the callbacks exposed to the +* core driver and then have helpers for stuff that is common(SMU_v11_x | SMU_v12_x funcs). +*/ + ret =smu_get_dpm_ultimate_freq (smu, clk_type, min, max);return ret; }
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +9 -1
@@ -458,6 +458,7 @@ struct pptable_funcs {int (*display_disable_memory_clock_switch)(struct smu_context *smu,bool disable_memory_clock_switch);void (*dump_pptable)(struct smu_context *smu);int (*get_power_limit)(struct smu_context *smu,uint32_t *limit,bool asic_default); +int (*get_dpm_uclk_limited)(struct smu_context *smu,uint32_t *clock,bool max); };struct smu_funcs
@@ -536,7 +537,7 @@ struct smu_funcsenum smu_baco_state (*baco_get_state)(struct smu_context *smu);int (*baco_set_state)(struct smu_context *smu,enum smu_baco_state state);int (*baco_reset)(struct smu_context *smu); - +int (*get_dpm_ultimate_freq)(struct smu_context *smu,enum smu_clk_type clk_type,uint32_t *min,uint32_t *max); };#define smu_init_microcode (smu) \
@@ -745,6 +746,10 @@ struct smu_funcs ((smu)->funcs->register_irq_handler ? (smu)->funcs->register_irq_handler(smu) : 0)#define smu_set_azalia_d3_pme (smu) \ ((smu)->funcs->set_azalia_d3_pme ? (smu)->funcs->set_azalia_d3_pme((smu)) : 0) +#define smu_get_dpm_ultimate_freq (smu, param, min, max) \ + ((smu)->funcs->get_dpm_ultimate_freq ? (smu)->funcs->get_dpm_ultimate_freq((smu), (param), (min), (max)) : 0) +#define smu_get_uclk_dpm_states (smu, clocks_in_khz, num_states) \ + ((smu)->ppt_funcs->get_uclk_dpm_states ? (smu)->ppt_funcs->get_uclk_dpm_states((smu), (clocks_in_khz), (num_states)) : 0)#define smu_get_max_sustainable_clocks_by_dc (smu, max_clocks) \ ((smu)->funcs->get_max_sustainable_clocks_by_dc ? (smu)->funcs->get_max_sustainable_clocks_by_dc((smu), (max_clocks)) : 0)#define smu_get_uclk_dpm_states (smu, clocks_in_khz, num_states) \
@@ -759,6 +764,9 @@ struct smu_funcs ((smu)->ppt_funcs->set_performance_level? (smu)->ppt_funcs->set_performance_level ((smu), (level)) : -EINVAL );#define smu_dump_pptable (smu) \ ((smu)->ppt_funcs->dump_pptable ? (smu)->ppt_funcs->dump_pptable((smu)) : 0) +#define smu_get_dpm_uclk_limited (smu, clock, max) \ + ((smu)->ppt_funcs->get_dpm_uclk_limited ? (smu)->ppt_funcs->get_dpm_uclk_limited((smu), (clock), (max)) : -EINVAL) + extern int smu_get_atom_data_table(struct smu_context *smu, uint32_t table, uint16_t *size, uint8_t *frev, uint8_t *crev,
drivers/gpu/drm/amd/powerplay/renoir_ppt.c +22 -0
@@ -156,11 +156,33 @@ static int renoir_tables_init(struct smu_context *smu, struct smu_table *tables)return 0 ; } +/** +* This interface just for getting uclk ultimate freq and should't introduce +* other likewise function result in overmuch callback. +*/ +static int renoir_get_dpm_uclk_limited (struct smu_context *smu,uint32_t *clock,bool max) +{ + +DpmClocks_t *table = smu->smu_table.clocks_table; + +if (!clock || !table) +return -EINVAL ; + +if (max) + *clock = table->FClocks[NUM_FCLK_DPM_LEVELS -1 ].Freq; +else + *clock = table->FClocks[0 ].Freq; + +return 0 ; + +} +static const struct pptable_funcs renoir_ppt_funcs = { .get_smu_msg_index = renoir_get_smu_msg_index, .get_smu_table_index = renoir_get_smu_table_index, .tables_init = renoir_tables_init, .set_power_state =NULL , + .get_dpm_uclk_limited = renoir_get_dpm_uclk_limited, };void renoir_set_ppt_funcs (struct smu_context *smu)
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +38 -0
@@ -1714,6 +1714,43 @@ static int smu_v11_0_baco_reset(struct smu_context *smu)return ret; } +static int smu_v11_0_get_dpm_ultimate_freq (struct smu_context *smu,enum smu_clk_type clk_type, +uint32_t *min,uint32_t *max) +{ +int ret =0 , clk_id =0 ; +uint32_t param =0 ; + +mutex_lock (&smu->mutex); + clk_id =smu_clk_get_index (smu, clk_type); +if (clk_id <0 ) { + ret = -EINVAL ; + goto failed; + } + param = (clk_id &0xffff ) <<16 ; + +if (max) { + ret =smu_send_smc_msg_with_param (smu, SMU_MSG_GetMaxDpmFreq, param); +if (ret) + goto failed; + ret =smu_read_smc_arg (smu, max); +if (ret) + goto failed; + } + +if (min) { + ret =smu_send_smc_msg_with_param (smu, SMU_MSG_GetMinDpmFreq, param); +if (ret) + goto failed; + ret =smu_read_smc_arg (smu, min); +if (ret) + goto failed; + } + +failed: +mutex_unlock (&smu->mutex); +return ret; +} +static const struct smu_funcs smu_v11_0_funcs = { .init_microcode = smu_v11_0_init_microcode, .load_microcode = smu_v11_0_load_microcode,
@@ -1763,6 +1800,7 @@ static const struct smu_funcs smu_v11_0_funcs = { .baco_get_state = smu_v11_0_baco_get_state, .baco_set_state = smu_v11_0_baco_set_state, .baco_reset = smu_v11_0_baco_reset, + .get_dpm_ultimate_freq = smu_v11_0_get_dpm_ultimate_freq, };void smu_v11_0_set_smu_funcs (struct smu_context *smu)
drivers/gpu/drm/amd/powerplay/smu_v12_0.c +62 -0
74 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx