drm/amd/powerplay: fix pre-check condition for setting clock range
Subsystems (2)
PATCH 1/2 drm/amd/powerplay: fix pre-check condition for setting clock range
This fix will handle some MP1 FW issue like as mclk dpm table in renoir has a reverse dpm clock layout and a zero frequency dpm level as following case.
cat pp_dpm_mclk
0: 1200Mhz
1: 1200Mhz
2: 800Mhz
3: 0Mhz
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 +- drivers/gpu/drm/amd/powerplay/smu_v12_0.c | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -1
@@ -214,7 +214,7 @@ int smu_set_soft_freq_range(struct smu_context *smu, enum smu_clk_type clk_type, {int ret =0 ; -if (min <=0 && max <=0 ) +if (min <0 && max <0 )return -EINVAL ;if (!smu_clk_dpm_is_enabled (smu, clk_type))
drivers/gpu/drm/amd/powerplay/smu_v12_0.c +0 -3
@@ -461,9 +461,6 @@ int smu_v12_0_set_soft_freq_limited_range(struct smu_context *smu, enum smu_clk_ {int ret =0 ; -if (max < min) -return -EINVAL ; -switch (clk_type) {case SMU_GFXCLK :case SMU_SCLK :
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/2 drm/amd/powerplay: map mclk to fclk for COMBINATIONAL_BYPASS case
When hit COMBINATIONAL_BYPASS the mclk will be bypass and can export fclk frequency to user usage.
--- drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/renoir_ppt.c +3 -3
@@ -111,8 +111,8 @@ static struct smu_12_0_cmn2aisc_mapping renoir_clk_map[SMU_CLK_COUNT] = {CLK_MAP (GFXCLK ,CLOCK_GFXCLK ),CLK_MAP (SCLK ,CLOCK_GFXCLK ),CLK_MAP (SOCCLK ,CLOCK_SOCCLK ), -CLK_MAP (UCLK ,CLOCK_UMCCLK ), - CLK_MAP(MCLK, CLOCK_UMCCLK), +CLK_MAP (UCLK ,CLOCK_FCLK ), + CLK_MAP(MCLK, CLOCK_FCLK), }; static struct smu_12_0_cmn2aisc_mapping renoir_table_map[SMU_TABLE_COUNT] = {
@@ -280,7 +280,7 @@ static int renoir_print_clk_levels(struct smu_context *smu,break ;case SMU_MCLK : count =NUM_MEMCLK_DPM_LEVELS ; - cur_value = metrics.ClockFrequency[CLOCK_UMCCLK ]; + cur_value = metrics.ClockFrequency[CLOCK_FCLK ];break ;case SMU_DCEFCLK : count =NUM_DCFCLK_DPM_LEVELS ;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 2/2] drm/amd/powerplay: map mclk to fclk for COMBINATIONAL_BYPASS case
Series is reviewed-by: Evan Quan <[email protected]>
-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Wednesday, March 4, 2020 10:56 AM
To: [email protected]
Cc: Quan, Evan <[email protected]>; Huang, Ray <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH 2/2] drm/amd/powerplay: map mclk to fclk for COMBINATIONAL_BYPASS case
When hit COMBINATIONAL_BYPASS the mclk will be bypass and can export fclk frequency to user usage.
--- drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/renoir_ppt.c +3 -3
@@ -111,8 +111,8 @@ static struct smu_12_0_cmn2aisc_mapping renoir_clk_map[SMU_CLK_COUNT] = {CLK_MAP (GFXCLK ,CLOCK_GFXCLK ),CLK_MAP (SCLK ,CLOCK_GFXCLK ),CLK_MAP (SOCCLK ,CLOCK_SOCCLK ), -CLK_MAP (UCLK ,CLOCK_UMCCLK ), - CLK_MAP(MCLK, CLOCK_UMCCLK), +CLK_MAP (UCLK ,CLOCK_FCLK ), + CLK_MAP(MCLK, CLOCK_FCLK), }; static struct smu_12_0_cmn2aisc_mapping renoir_table_map[SMU_TABLE_COUNT] = {
@@ -280,7 +280,7 @@ static int renoir_print_clk_levels(struct smu_context *smu,break ;case SMU_MCLK : count =NUM_MEMCLK_DPM_LEVELS ; - cur_value = metrics.ClockFrequency[CLOCK_UMCCLK ]; + cur_value = metrics.ClockFrequency[CLOCK_FCLK ];break ;case SMU_DCEFCLK : count =NUM_DCFCLK_DPM_LEVELS ;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 21 lines · Prike Liang
This fix will handle some MP1 FW issue like as mclk dpm table in renoir has a reverse dpm clock layout and a zero frequency dpm level as following case.
cat
pp_dpm_mclk
0: 1200Mhz
1: 1200Mhz
2: 800Mhz
3: 0MhzSigned-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 +- drivers/gpu/drm/amd/powerplay/smu_v12_0.c | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0
-0
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c int smu_set_soft_freq_range(struct smu_context *smu, enum smu_clk_type clk_type, · line 217
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1
-1@@ -214,7 +214,7 @@ int smu_set_soft_freq_range(struct smu_context *smu, enum smu_clk_type clk_type, {int ret =0 ; -if (min <=0 && max <=0 ) +if (min <0 && max <0 )
This change causes the following Coverity warning because min and max are both unsigned:
int smu_set_soft_freq_range(struct smu_context *smu, enum smu_clk_type clk_type,
uint32_t min, uint32_t max)
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0
-0>> CID 1460516: Integer handling issues (NO_EFFECT)Quoted 1 line
Quoted 1 line
This less-than-zero comparison of an unsigned value is never true. "min < 0U".
225 if (min < 0 && max < 0)
226 return -EINVAL;
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c int smu_set_soft_freq_range(struct smu_context *smu, enum smu_clk_type clk_type, · line 220
Quoted 3 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0
-0return -EINVAL ;if (!smu_clk_dpm_is_enabled (smu, clk_type))
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 44 lines
-----Original Message-----
From: Bjorn Helgaas <[email protected]>
Sent: Monday, March 9, 2020 9:11 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Quan, Evan <[email protected]>; Huang, Ray <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 1/2] drm/amd/powerplay: fix pre-check condition for setting clock rangeQuoted 22 lines · Prike Liang
This fix will handle some MP1 FW issue like as mclk dpm table in renoir has a reverse dpm clock layout and a zero frequency dpm level as following case.
cat
pp_dpm_mclk
0: 1200Mhz
1: 1200Mhz
2: 800Mhz
3: 0MhzSigned-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 +- drivers/gpu/drm/amd/powerplay/smu_v12_0.c | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0
-0drivers/gpu/drm/amd/powerplay/amdgpu_smu.c int smu_set_soft_freq_range(struct smu_context · line 217
Quoted 5 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1
-1@@ -214,7 +214,7 @@ int smu_set_soft_freq_range(struct smu_context *smu, enum smu_clk_type clk_type, {int ret =0 ; -if (min <=0 && max <=0 ) +if (min <0 && max <0 )This change causes the following Coverity warning because min and max are both unsigned:
Quoted 7 lines
int smu_set_soft_freq_range(struct
smu_context*smu, enumsmu_clk_typeclk_type,uint32_t min, uint32_t max)Quoted 2 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0
-0>> CID 1460516: Integer handling issues (NO_EFFECT)Quoted 1 line
Quoted 1 line
This less-than-zero comparison of an unsigned value is never true.
"min < 0U".
[Prike] Thanks and will fix the Coverity warning.
Quoted 6 lines
225 if (min < 0 && max < 0)
226 return-EINVAL;Quoted 3 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0
-0return -EINVAL ;if (!smu_clk_dpm_is_enabled (smu, clk_type))
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx