[PATCH 1/1] drm/amd/pm: fix the print_clk_levels issue for SMU v13.0.6
Lazar, Lijo
lijo.lazar at amd.com
Tue Sep 26 11:11:51 UTC 2023
On 9/26/2023 4:32 PM, Le Ma wrote:
> Pass the correct size to smu_v13_0_6_print_clks, otherwise
> the same place in buf will be re-written.
>
Where is this getting affected? As far as I see, there are no multiple
emits to the same buffer in this code path.
Thanks,
Lijo
> Change-Id: Ia0e12430d01146a11490204c1bab4b4f06cd17ea
> Signed-off-by: Le Ma <le.ma at amd.com>
> ---
> .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 24 +++++++++----------
> 1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
> index 11a6cd96c601..19c117eb5ebe 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
> @@ -821,12 +821,12 @@ static int smu_v13_0_6_get_current_clk_freq_by_table(struct smu_context *smu,
> return smu_v13_0_6_get_smu_metrics_data(smu, member_type, value);
> }
>
> -static int smu_v13_0_6_print_clks(struct smu_context *smu, char *buf,
> +static int smu_v13_0_6_print_clks(struct smu_context *smu, char *buf, int size,
> struct smu_13_0_dpm_table *single_dpm_table,
> uint32_t curr_clk, const char *clk_name)
> {
> struct pp_clock_levels_with_latency clocks;
> - int i, ret, size = 0, level = -1;
> + int i, ret, level = -1;
> uint32_t clk1, clk2;
>
> ret = smu_v13_0_6_get_clk_table(smu, &clocks, single_dpm_table);
> @@ -947,8 +947,8 @@ static int smu_v13_0_6_print_clk_levels(struct smu_context *smu,
>
> single_dpm_table = &(dpm_context->dpm_tables.uclk_table);
>
> - return smu_v13_0_6_print_clks(smu, buf, single_dpm_table, now,
> - "mclk");
> + return smu_v13_0_6_print_clks(smu, buf, size, single_dpm_table,
> + now, "mclk");
>
> case SMU_SOCCLK:
> ret = smu_v13_0_6_get_current_clk_freq_by_table(smu, SMU_SOCCLK,
> @@ -961,8 +961,8 @@ static int smu_v13_0_6_print_clk_levels(struct smu_context *smu,
>
> single_dpm_table = &(dpm_context->dpm_tables.soc_table);
>
> - return smu_v13_0_6_print_clks(smu, buf, single_dpm_table, now,
> - "socclk");
> + return smu_v13_0_6_print_clks(smu, buf, size, single_dpm_table,
> + now, "socclk");
>
> case SMU_FCLK:
> ret = smu_v13_0_6_get_current_clk_freq_by_table(smu, SMU_FCLK,
> @@ -975,8 +975,8 @@ static int smu_v13_0_6_print_clk_levels(struct smu_context *smu,
>
> single_dpm_table = &(dpm_context->dpm_tables.fclk_table);
>
> - return smu_v13_0_6_print_clks(smu, buf, single_dpm_table, now,
> - "fclk");
> + return smu_v13_0_6_print_clks(smu, buf, size, single_dpm_table,
> + now, "fclk");
>
> case SMU_VCLK:
> ret = smu_v13_0_6_get_current_clk_freq_by_table(smu, SMU_VCLK,
> @@ -989,8 +989,8 @@ static int smu_v13_0_6_print_clk_levels(struct smu_context *smu,
>
> single_dpm_table = &(dpm_context->dpm_tables.vclk_table);
>
> - return smu_v13_0_6_print_clks(smu, buf, single_dpm_table, now,
> - "vclk");
> + return smu_v13_0_6_print_clks(smu, buf, size, single_dpm_table,
> + now, "vclk");
>
> case SMU_DCLK:
> ret = smu_v13_0_6_get_current_clk_freq_by_table(smu, SMU_DCLK,
> @@ -1003,8 +1003,8 @@ static int smu_v13_0_6_print_clk_levels(struct smu_context *smu,
>
> single_dpm_table = &(dpm_context->dpm_tables.dclk_table);
>
> - return smu_v13_0_6_print_clks(smu, buf, single_dpm_table, now,
> - "dclk");
> + return smu_v13_0_6_print_clks(smu, buf, size, single_dpm_table,
> + now, "dclk");
>
> default:
> break;
More information about the amd-gfx
mailing list