* [PATCH 1/1] drm/amd/pm: fix the print_clk_levels issue for SMU v13.0.6
@ 2023-09-26 11:02 Le Ma
2023-09-26 11:11 ` Lazar, Lijo
0 siblings, 1 reply; 3+ messages in thread
From: Le Ma @ 2023-09-26 11:02 UTC (permalink / raw)
To: amd-gfx; +Cc: Alexander.Deucher, Lijo.Lazar, Hawking.Zhang
Pass the correct size to smu_v13_0_6_print_clks, otherwise
the same place in buf will be re-written.
Change-Id: Ia0e12430d01146a11490204c1bab4b4f06cd17ea
Signed-off-by: Le Ma <le.ma@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;
--
2.38.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 1/1] drm/amd/pm: fix the print_clk_levels issue for SMU v13.0.6
2023-09-26 11:02 [PATCH 1/1] drm/amd/pm: fix the print_clk_levels issue for SMU v13.0.6 Le Ma
@ 2023-09-26 11:11 ` Lazar, Lijo
2023-09-26 11:16 ` Lazar, Lijo
0 siblings, 1 reply; 3+ messages in thread
From: Lazar, Lijo @ 2023-09-26 11:11 UTC (permalink / raw)
To: Le Ma, amd-gfx; +Cc: Alexander.Deucher, Hawking.Zhang
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@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;
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 1/1] drm/amd/pm: fix the print_clk_levels issue for SMU v13.0.6
2023-09-26 11:11 ` Lazar, Lijo
@ 2023-09-26 11:16 ` Lazar, Lijo
0 siblings, 0 replies; 3+ messages in thread
From: Lazar, Lijo @ 2023-09-26 11:16 UTC (permalink / raw)
To: Le Ma, amd-gfx; +Cc: Alexander.Deucher, Hawking.Zhang
On 9/26/2023 4:41 PM, Lazar, Lijo wrote:
>
>
> 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.
>
Never mind, found one for OD_MCLK.
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Thanks,
Lijo
> Thanks,
> Lijo
>
>> Change-Id: Ia0e12430d01146a11490204c1bab4b4f06cd17ea
>> Signed-off-by: Le Ma <le.ma@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;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-09-26 11:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-26 11:02 [PATCH 1/1] drm/amd/pm: fix the print_clk_levels issue for SMU v13.0.6 Le Ma
2023-09-26 11:11 ` Lazar, Lijo
2023-09-26 11:16 ` Lazar, Lijo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox