drm/amd/pp: Store stable Pstate clocks
Subsystems (2)
PATCH 1/2 drm/amd/pp: Store stable Pstate clocks
User can use to calculate profiling ratios when
set UMD Pstate.
Change-Id: I3c6b82ebface57eb969d474c57149e8658ab7014
--- drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c | 2 ++ drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c | 3 +++ drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 14 ++++++++++++-- drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 5 +++++ drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 2 ++ 5 files changed, 24 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +2 -0
@@ -1189,6 +1189,8 @@ static int cz_phm_unforce_dpm_levels(struct pp_hwmgr *hwmgr) cz_hwmgr->sclk_dpm.soft_min_clk = table->entries[0 ].clk; cz_hwmgr->sclk_dpm.hard_min_clk = table->entries[0 ].clk; + hwmgr->pstate_sclk = table->entries[0 ].clk; + hwmgr->pstate_mclk =0 ; level =cz_get_max_sclk_level (hwmgr) -1 ;
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +3 -0
@@ -451,6 +451,9 @@ static int rv_hwmgr_backend_init(struct pp_hwmgr *hwmgr) hwmgr->platform_descriptor.minimumClocksReductionPercentage =50 ; + hwmgr->pstate_sclk =RAVEN_UMD_PSTATE_GFXCLK ; + hwmgr->pstate_mclk =RAVEN_UMD_PSTATE_FCLK ; +return result; }
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +12 -2
@@ -2652,8 +2652,10 @@ static int smu7_get_profiling_clk(struct pp_hwmgr *hwmgr, enum amd_dpm_forced_lebreak ; } } -if (count <0 || level ==AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK ) +if (count <0 || level ==AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK ) { *sclk_mask =0 ; + tmp_sclk = hwmgr->dyn_state.vddc_dependency_on_sclk->entries[0 ].clk; + }if (level ==AMD_DPM_FORCED_LEVEL_PROFILE_PEAK ) *sclk_mask = hwmgr->dyn_state.vddc_dependency_on_sclk->count-1 ;
@@ -2668,8 +2670,10 @@ static int smu7_get_profiling_clk(struct pp_hwmgr *hwmgr, enum amd_dpm_forced_lebreak ; } } -if (count <0 || level ==AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK ) +if (count <0 || level ==AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK ) { *sclk_mask =0 ; + tmp_sclk = table_info->vdd_dep_on_sclk->entries[0 ].clk; + }if (level ==AMD_DPM_FORCED_LEVEL_PROFILE_PEAK ) *sclk_mask = table_info->vdd_dep_on_sclk->count -1 ;
@@ -2681,6 +2685,9 @@ static int smu7_get_profiling_clk(struct pp_hwmgr *hwmgr, enum amd_dpm_forced_le *mclk_mask = golden_dpm_table->mclk_table.count -1 ; *pcie_mask = data->dpm_table.pcie_speed_table.count -1 ; + hwmgr->pstate_sclk = tmp_sclk; + hwmgr->pstate_mclk = tmp_mclk; +return 0 ; }
@@ -2692,6 +2699,9 @@ static int smu7_force_dpm_level(struct pp_hwmgr *hwmgr,uint32_t mclk_mask =0 ;uint32_t pcie_mask =0 ; +if (hwmgr->pstate_sclk ==0 ) +smu7_get_profiling_clk (hwmgr, level, &sclk_mask, &mclk_mask, &pcie_mask); +switch (level) {case AMD_DPM_FORCED_LEVEL_HIGH : ret =smu7_force_dpm_highest (hwmgr);
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +5 -0
@@ -4172,6 +4172,8 @@ static int vega10_get_profiling_clk_mask(struct pp_hwmgr *hwmgr, enum amd_dpm_fo *sclk_mask =VEGA10_UMD_PSTATE_GFXCLK_LEVEL ; *soc_mask =VEGA10_UMD_PSTATE_SOCCLK_LEVEL ; *mclk_mask =VEGA10_UMD_PSTATE_MCLK_LEVEL ; + hwmgr->pstate_sclk = table_info->vdd_dep_on_sclk->entries[VEGA10_UMD_PSTATE_GFXCLK_LEVEL ].clk; + hwmgr->pstate_mclk = table_info->vdd_dep_on_mclk->entries[VEGA10_UMD_PSTATE_MCLK_LEVEL ].clk; }if (level ==AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK ) {
@@ -4213,6 +4215,9 @@ static int vega10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,uint32_t mclk_mask =0 ;uint32_t soc_mask =0 ; +if (hwmgr->pstate_sclk ==0 ) +vega10_get_profiling_clk_mask (hwmgr, level, &sclk_mask, &mclk_mask, &soc_mask); +switch (level) {case AMD_DPM_FORCED_LEVEL_HIGH : ret =vega10_force_dpm_highest (hwmgr);
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +2 -0
@@ -752,6 +752,8 @@ struct pp_hwmgr {enum amd_pp_profile_type current_power_profile;bool en_umd_pstate;bool od_enabled; +uint32_t pstate_sclk; +uint32_t pstate_mclk; };struct cgs_irq_src_funcs {
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): 1515152305-17549-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org
PATCH 2/2 drm/amd/pp: Add stable Pstate clk display support in debugfs
The additional output are: PSTATE_SCLK and PSTATE_MCLK value in MHz as:
300 MHz (PSTATE_SCLK)
300 MHz (PSTATE_MCLK)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 2 ++ drivers/gpu/drm/amd/include/kgd_pp_interface.h | 1 + drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 8 ++++++++ 3 files changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2 -0
@@ -1512,6 +1512,8 @@ static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *aseq_printf (m,"\t%u MHz (MCLK)\n" , value/100 );if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_GFX_SCLK , (void *)&value, &size))seq_printf (m,"\t%u MHz (SCLK)\n" , value/100 ); +if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_STABLE_PSTATE_CLK , (void *)&value, &size)) +seq_printf (m,"\t%u MHz (PSTATE_SCLK)\n\t%u MHz (PSTATE_MCLK)\n" , value &0xffff , (value>>16 ) &0xffff );if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_VDDGFX , (void *)&value, &size))seq_printf (m,"\t%u mV (VDDGFX)\n" , value);if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_VDDNB , (void *)&value, &size))
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -0
@@ -122,6 +122,7 @@ enum amd_pp_sensors {AMDGPU_PP_SENSOR_VCE_POWER ,AMDGPU_PP_SENSOR_UVD_POWER ,AMDGPU_PP_SENSOR_GPU_POWER , + AMDGPU_PP_SENSOR_STABLE_PSTATE_CLK, }; enum amd_pp_task {
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +8 -0
@@ -998,6 +998,14 @@ static int pp_dpm_read_sensor(void *handle, int idx, hwmgr = pp_handle->hwmgr; +if ((idx ==AMDGPU_PP_SENSOR_STABLE_PSTATE_CLK ) && (value !=NULL )) { +mutex_lock (&pp_handle->pp_lock); + *((uint32_t *)value) = (hwmgr->pstate_sclk /100 &0xffff ) | + ((hwmgr->pstate_mclk /100 &0xffff ) <<16 ); +mutex_unlock (&pp_handle->pp_lock); +return 0 ; + } +if (hwmgr->hwmgr_func->read_sensor ==NULL ) {pr_info ("%s was not implemented.\n" , __func__);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): 1515152305-17549-2-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 2/2] drm/amd/pp: Add stable Pstate clk display support in debugfs
________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Rex Zhu <[email protected]>
Sent: Friday, January 5, 2018 6:38 AM
To: [email protected]
Cc: Zhu, Rex
Subject: [PATCH 2/2] drm/amd/pp: Add stable Pstate clk display support in debugfs
The additional output are: PSTATE_SCLK and PSTATE_MCLK value in MHz as:
300 MHz (PSTATE_SCLK)
300 MHz (PSTATE_MCLK)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 2 ++ drivers/gpu/drm/amd/include/kgd_pp_interface.h | 1 + drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 8 ++++++++ 3 files changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2 -0
@@ -1512,6 +1512,8 @@ static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *aseq_printf (m,"\t%u MHz (MCLK)\n" , value/100 );if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_GFX_SCLK , (void *)&value, &size))seq_printf (m,"\t%u MHz (SCLK)\n" , value/100 ); +if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_STABLE_PSTATE_CLK , (void *)&value, &size)) +seq_printf (m,"\t%u MHz (PSTATE_SCLK)\n\t%u MHz (PSTATE_MCLK)\n" , value &0xffff , (value>>16 ) &0xffff );if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_VDDGFX , (void *)&value, &size))seq_printf (m,"\t%u mV (VDDGFX)\n" , value);if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_VDDNB , (void *)&value, &size))
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -0
@@ -122,6 +122,7 @@ enum amd_pp_sensors {AMDGPU_PP_SENSOR_VCE_POWER ,AMDGPU_PP_SENSOR_UVD_POWER ,AMDGPU_PP_SENSOR_GPU_POWER , + AMDGPU_PP_SENSOR_STABLE_PSTATE_CLK, }; enum amd_pp_task {
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +4 -0
@@ -998,6 +998,14 @@ static int pp_dpm_read_sensor(void *handle, int idx, hwmgr = pp_handle->hwmgr; +if ((idx ==AMDGPU_PP_SENSOR_STABLE_PSTATE_CLK ) && (value !=NULL )) { +mutex_lock (&pp_handle->pp_lock); + *((uint32_t *)value) = (hwmgr->pstate_sclk /100 &0xffff ) | + ((hwmgr->pstate_mclk /100 &0xffff ) <<16 );
This seems kinda hacky. Either add two queries or make the query take two values.
Alex
+ mutex_unlock(&pp_handle->pp_lock);
+ return 0;
+ }
+
if (hwmgr->hwmgr_func->read_sensor == NULL) {
pr_info("%s was not implemented.\n", __func__);
return 0;--
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
A message that is not in the archive (sent off-list or not yet received): BN6PR12MB16521B0C1D9FE6C399F09F52F71C0-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Re: [PATCH 2/2] drm/amd/pp: Add stable Pstate clk display support in debugfs
Ok. Thanks. I will query twice.one for pstate sclk and one for mclk.
Best Regards
Rex
________________________________
From: Deucher, Alexander
Sent: Friday, January 5, 2018 11:44:00 PM
To: Zhu, Rex; [email protected]
Subject: Re: [PATCH 2/2] drm/amd/pp: Add stable Pstate clk display support in debugfs
________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Rex Zhu <[email protected]>
Sent: Friday, January 5, 2018 6:38 AM
To: [email protected]
Cc: Zhu, Rex
Subject: [PATCH 2/2] drm/amd/pp: Add stable Pstate clk display support in debugfs
The additional output are: PSTATE_SCLK and PSTATE_MCLK value in MHz as:
300 MHz (PSTATE_SCLK)
300 MHz (PSTATE_MCLK)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 2 ++ drivers/gpu/drm/amd/include/kgd_pp_interface.h | 1 + drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 8 ++++++++ 3 files changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2 -0
@@ -1512,6 +1512,8 @@ static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *aseq_printf (m,"\t%u MHz (MCLK)\n" , value/100 );if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_GFX_SCLK , (void *)&value, &size))seq_printf (m,"\t%u MHz (SCLK)\n" , value/100 ); +if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_STABLE_PSTATE_CLK , (void *)&value, &size)) +seq_printf (m,"\t%u MHz (PSTATE_SCLK)\n\t%u MHz (PSTATE_MCLK)\n" , value &0xffff , (value>>16 ) &0xffff );if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_VDDGFX , (void *)&value, &size))seq_printf (m,"\t%u mV (VDDGFX)\n" , value);if (!amdgpu_dpm_read_sensor (adev,AMDGPU_PP_SENSOR_VDDNB , (void *)&value, &size))
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -0
@@ -122,6 +122,7 @@ enum amd_pp_sensors {AMDGPU_PP_SENSOR_VCE_POWER ,AMDGPU_PP_SENSOR_UVD_POWER ,AMDGPU_PP_SENSOR_GPU_POWER , + AMDGPU_PP_SENSOR_STABLE_PSTATE_CLK, }; enum amd_pp_task {
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +4 -0
@@ -998,6 +998,14 @@ static int pp_dpm_read_sensor(void *handle, int idx, hwmgr = pp_handle->hwmgr; +if ((idx ==AMDGPU_PP_SENSOR_STABLE_PSTATE_CLK ) && (value !=NULL )) { +mutex_lock (&pp_handle->pp_lock); + *((uint32_t *)value) = (hwmgr->pstate_sclk /100 &0xffff ) | + ((hwmgr->pstate_mclk /100 &0xffff ) <<16 );
This seems kinda hacky. Either add two queries or make the query take two values.
Alex
+ mutex_unlock(&pp_handle->pp_lock);
+ return 0;
+ }
+
if (hwmgr->hwmgr_func->read_sensor == NULL) {
pr_info("%s was not implemented.\n", __func__);
return 0;--
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
Deucher, Alexander
Reviewed-by________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Rex Zhu <[email protected]>
Sent: Friday, January 5, 2018 6:38 AM
To: [email protected]
Cc: Zhu, Rex
Subject: [PATCH 1/2] drm/amd/pp: Store stable Pstate clocks
User can use to calculate profiling ratios when
set UMD Pstate.
Change-Id: I3c6b82ebface57eb969d474c57149e8658ab7014
--- drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c | 2 ++ drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c | 3 +++ drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 14 ++++++++++++-- drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 5 +++++ drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 2 ++ 5 files changed, 24 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +2 -0
@@ -1189,6 +1189,8 @@ static int cz_phm_unforce_dpm_levels(struct pp_hwmgr *hwmgr) cz_hwmgr->sclk_dpm.soft_min_clk = table->entries[0 ].clk; cz_hwmgr->sclk_dpm.hard_min_clk = table->entries[0 ].clk; + hwmgr->pstate_sclk = table->entries[0 ].clk; + hwmgr->pstate_mclk =0 ; level =cz_get_max_sclk_level (hwmgr) -1 ;
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +3 -0
@@ -451,6 +451,9 @@ static int rv_hwmgr_backend_init(struct pp_hwmgr *hwmgr) hwmgr->platform_descriptor.minimumClocksReductionPercentage =50 ; + hwmgr->pstate_sclk =RAVEN_UMD_PSTATE_GFXCLK ; + hwmgr->pstate_mclk =RAVEN_UMD_PSTATE_FCLK ; +return result; }
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +12 -2
@@ -2652,8 +2652,10 @@ static int smu7_get_profiling_clk(struct pp_hwmgr *hwmgr, enum amd_dpm_forced_lebreak ; } } -if (count <0 || level ==AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK ) +if (count <0 || level ==AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK ) { *sclk_mask =0 ; + tmp_sclk = hwmgr->dyn_state.vddc_dependency_on_sclk->entries[0 ].clk; + }if (level ==AMD_DPM_FORCED_LEVEL_PROFILE_PEAK ) *sclk_mask = hwmgr->dyn_state.vddc_dependency_on_sclk->count-1 ;
@@ -2668,8 +2670,10 @@ static int smu7_get_profiling_clk(struct pp_hwmgr *hwmgr, enum amd_dpm_forced_lebreak ; } } -if (count <0 || level ==AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK ) +if (count <0 || level ==AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK ) { *sclk_mask =0 ; + tmp_sclk = table_info->vdd_dep_on_sclk->entries[0 ].clk; + }if (level ==AMD_DPM_FORCED_LEVEL_PROFILE_PEAK ) *sclk_mask = table_info->vdd_dep_on_sclk->count -1 ;
@@ -2681,6 +2685,9 @@ static int smu7_get_profiling_clk(struct pp_hwmgr *hwmgr, enum amd_dpm_forced_le *mclk_mask = golden_dpm_table->mclk_table.count -1 ; *pcie_mask = data->dpm_table.pcie_speed_table.count -1 ; + hwmgr->pstate_sclk = tmp_sclk; + hwmgr->pstate_mclk = tmp_mclk; +return 0 ; }
@@ -2692,6 +2699,9 @@ static int smu7_force_dpm_level(struct pp_hwmgr *hwmgr,uint32_t mclk_mask =0 ;uint32_t pcie_mask =0 ; +if (hwmgr->pstate_sclk ==0 ) +smu7_get_profiling_clk (hwmgr, level, &sclk_mask, &mclk_mask, &pcie_mask); +switch (level) {case AMD_DPM_FORCED_LEVEL_HIGH : ret =smu7_force_dpm_highest (hwmgr);
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +5 -0
@@ -4172,6 +4172,8 @@ static int vega10_get_profiling_clk_mask(struct pp_hwmgr *hwmgr, enum amd_dpm_fo *sclk_mask =VEGA10_UMD_PSTATE_GFXCLK_LEVEL ; *soc_mask =VEGA10_UMD_PSTATE_SOCCLK_LEVEL ; *mclk_mask =VEGA10_UMD_PSTATE_MCLK_LEVEL ; + hwmgr->pstate_sclk = table_info->vdd_dep_on_sclk->entries[VEGA10_UMD_PSTATE_GFXCLK_LEVEL ].clk; + hwmgr->pstate_mclk = table_info->vdd_dep_on_mclk->entries[VEGA10_UMD_PSTATE_MCLK_LEVEL ].clk; }if (level ==AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK ) {
@@ -4213,6 +4215,9 @@ static int vega10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,uint32_t mclk_mask =0 ;uint32_t soc_mask =0 ; +if (hwmgr->pstate_sclk ==0 ) +vega10_get_profiling_clk_mask (hwmgr, level, &sclk_mask, &mclk_mask, &soc_mask); +switch (level) {case AMD_DPM_FORCED_LEVEL_HIGH : ret =vega10_force_dpm_highest (hwmgr);
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +2 -0
@@ -752,6 +752,8 @@ struct pp_hwmgr {enum amd_pp_profile_type current_power_profile;bool en_umd_pstate;bool od_enabled; +uint32_t pstate_sclk; +uint32_t pstate_mclk; };struct cgs_irq_src_funcs {
--
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