drm/amd/pm: correct SMU13.0.7 pstate profiling clock settings
Subsystems (3)
PATCH 1/2 drm/amd/pm: correct SMU13.0.7 pstate profiling clock settings
Correct the pstate standard/peak profiling mode clock settings for SMU13.0.7.
--- .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +15 -7
@@ -1329,9 +1329,17 @@ static int smu_v13_0_7_populate_umd_state_clk(struct smu_context *smu) &dpm_context->dpm_tables.fclk_table;struct smu_umd_pstate_table *pstate_table = &smu->pstate_table; +struct smu_table_context *table_context = &smu->smu_table; +PPTable_t *pptable = table_context->driver_pptable; +DriverReportedClocks_t driver_clocks = + pptable->SkuTable.DriverReportedClocks; pstate_table->gfxclk_pstate.min = gfx_table->min; - pstate_table->gfxclk_pstate.peak = gfx_table->max; +if (driver_clocks.GameClockAc && + (driver_clocks.GameClockAc < gfx_table->max)) + pstate_table->gfxclk_pstate.peak = driver_clocks.GameClockAc; +else + pstate_table->gfxclk_pstate.peak = gfx_table->max; pstate_table->uclk_pstate.min = mem_table->min; pstate_table->uclk_pstate.peak = mem_table->max;
@@ -1348,12 +1356,12 @@ static int smu_v13_0_7_populate_umd_state_clk(struct smu_context *smu) pstate_table->fclk_pstate.min = fclk_table->min; pstate_table->fclk_pstate.peak = fclk_table->max; -/* -* For now, just use the mininum clock frequency. -* TODO: update them when the real pstate settings available -*/ - pstate_table->gfxclk_pstate.standard = gfx_table->min; - pstate_table->uclk_pstate.standard = mem_table->min; +if (driver_clocks.BaseClockAc && + driver_clocks.BaseClockAc < gfx_table->max) + pstate_table->gfxclk_pstate.standard = driver_clocks.BaseClockAc; +else + pstate_table->gfxclk_pstate.standard = gfx_table->max; + pstate_table->uclk_pstate.standard = mem_table->max; pstate_table->socclk_pstate.standard = soc_table->min; pstate_table->vclk_pstate.standard = vclk_table->min; pstate_table->dclk_pstate.standard = dclk_table->min;
Signature · 1 line
2.34.1
PATCH 2/2 drm/amd/pm: correct SMU13.0.7 max shader clock reporting
Correct the max shader clock reporting on SMU
13.0.7.
--- .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 61 ++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +60 -1
@@ -575,6 +575,14 @@ static int smu_v13_0_7_set_default_dpm_table(struct smu_context *smu) dpm_table);if (ret)return ret; + +if (skutable->DriverReportedClocks.GameClockAc && + (dpm_table->dpm_levels[dpm_table->count -1 ].value > + skutable->DriverReportedClocks.GameClockAc)) { + dpm_table->dpm_levels[dpm_table->count -1 ].value = + skutable->DriverReportedClocks.GameClockAc; + dpm_table->max = skutable->DriverReportedClocks.GameClockAc; + } }else { dpm_table->count =1 ; dpm_table->dpm_levels[0 ].value = smu->smu_table.boot_values.gfxclk /100 ;
@@ -828,6 +836,57 @@ static int smu_v13_0_7_get_smu_metrics_data(struct smu_context *smu,return ret; } +static int smu_v13_0_7_get_dpm_ultimate_freq (struct smu_context *smu, +enum smu_clk_type clk_type, +uint32_t *min, +uint32_t *max) +{ +struct smu_13_0_dpm_context *dpm_context = + smu->smu_dpm.dpm_context; +struct smu_13_0_dpm_table *dpm_table; + +switch (clk_type) { +case SMU_MCLK : +case SMU_UCLK : +/* uclk dpm table */ + dpm_table = &dpm_context->dpm_tables.uclk_table; +break ; +case SMU_GFXCLK : +case SMU_SCLK : +/* gfxclk dpm table */ + dpm_table = &dpm_context->dpm_tables.gfx_table; +break ; +case SMU_SOCCLK : +/* socclk dpm table */ + dpm_table = &dpm_context->dpm_tables.soc_table; +break ; +case SMU_FCLK : +/* fclk dpm table */ + dpm_table = &dpm_context->dpm_tables.fclk_table; +break ; +case SMU_VCLK : +case SMU_VCLK1 : +/* vclk dpm table */ + dpm_table = &dpm_context->dpm_tables.vclk_table; +break ; +case SMU_DCLK : +case SMU_DCLK1 : +/* dclk dpm table */ + dpm_table = &dpm_context->dpm_tables.dclk_table; +break ; +default : +dev_err (smu->adev->dev,"Unsupported clock type!\n" ); +return -EINVAL ; + } + +if (min) + *min = dpm_table->min; +if (max) + *max = dpm_table->max; + +return 0 ; +} + static int smu_v13_0_7_read_sensor(struct smu_context *smu, enum amd_pp_sensors sensor, void *data,
@@ -1686,7 +1745,7 @@ static const struct pptable_funcs smu_v13_0_7_ppt_funcs = { .dpm_set_jpeg_enable = smu_v13_0_set_jpeg_enable, .init_pptable_microcode = smu_v13_0_init_pptable_microcode, .populate_umd_state_clk = smu_v13_0_7_populate_umd_state_clk, - .get_dpm_ultimate_freq = smu_v13_0_get_dpm_ultimate_freq, + .get_dpm_ultimate_freq = smu_v13_0_7_get_dpm_ultimate_freq, .get_vbios_bootup_values = smu_v13_0_get_vbios_bootup_values, .read_sensor = smu_v13_0_7_read_sensor, .feature_is_enabled = smu_cmn_feature_is_enabled,
Signature · 1 line
2.34.1
Feng, Kenneth
maintainer[AMD Official Use Only - General]
Series is Reviewed-by: Kenneth Feng <[email protected]>
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Horatio Zhang
Sent: Monday, April 10, 2023 10:03 AM
To: [email protected]
Cc: Xu, Feifei <[email protected]>; Zhang, Horatio <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH 1/2] drm/amd/pm: correct SMU13.0.7 pstate profiling clock settings
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Correct the pstate standard/peak profiling mode clock settings for SMU13.0.7.
--- .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +9 -1
@@ -1329,9 +1329,17 @@ static int smu_v13_0_7_populate_umd_state_clk(struct smu_context *smu) &dpm_context->dpm_tables.fclk_table;struct smu_umd_pstate_table *pstate_table = &smu->pstate_table; +struct smu_table_context *table_context = &smu->smu_table; +PPTable_t *pptable = table_context->driver_pptable; +DriverReportedClocks_t driver_clocks = + pptable->SkuTable.DriverReportedClocks; pstate_table->gfxclk_pstate.min = gfx_table->min; - pstate_table->gfxclk_pstate.peak = gfx_table->max; +if (driver_clocks.GameClockAc && + (driver_clocks.GameClockAc < gfx_table->max)) + pstate_table->gfxclk_pstate.peak = driver_clocks.GameClockAc; +else + pstate_table->gfxclk_pstate.peak = gfx_table->max; pstate_table->uclk_pstate.min = mem_table->min; pstate_table->uclk_pstate.peak = mem_table->max; @@ -1348,12 +1356,12 @@ static int smu_v13_0_7_populate_umd_state_clk(struct smu_context *smu)
pstate_table->fclk_pstate.min = fclk_table->min;
pstate_table->fclk_pstate.peak = fclk_table->max;- /*
- * For now, just use the mininum clock frequency. - * TODO: update them when the real pstate settings available - */ - pstate_table->gfxclk_pstate.standard = gfx_table->min; - pstate_table->uclk_pstate.standard = mem_table->min; + if (driver_clocks.BaseClockAc &&
+ driver_clocks.BaseClockAc < gfx_table->max)
+ pstate_table->gfxclk_pstate.standard = driver_clocks.BaseClockAc;
+ else
+ pstate_table->gfxclk_pstate.standard = gfx_table->max;
+ pstate_table->uclk_pstate.standard = mem_table->max;
pstate_table->socclk_pstate.standard = soc_table->min;
pstate_table->vclk_pstate.standard = vclk_table->min;
pstate_table->dclk_pstate.standard = dclk_table->min;--
2.34.1