Skip to content

Commit 7a18e08

Browse files
Evan Quanalexdeucher
authored andcommitted
drm/amd/pm: update SMU13.0.0 reported maximum shader clock
Update the reported maximum shader clock to the value which can be guarded to be achieved on all cards. This is to align with Window setting. Signed-off-by: Evan Quan <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected] # 6.0.x
1 parent 32a7819 commit 7a18e08

File tree

1 file changed

+69
-1
lines changed

1 file changed

+69
-1
lines changed

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,23 @@ static int smu_v13_0_0_set_default_dpm_table(struct smu_context *smu)
543543
dpm_table);
544544
if (ret)
545545
return ret;
546+
547+
/*
548+
* Update the reported maximum shader clock to the value
549+
* which can be guarded to be achieved on all cards. This
550+
* is aligned with Window setting. And considering that value
551+
* might be not the peak frequency the card can achieve, it
552+
* is normal some real-time clock frequency can overtake this
553+
* labelled maximum clock frequency(for example in pp_dpm_sclk
554+
* sysfs output).
555+
*/
556+
if (skutable->DriverReportedClocks.GameClockAc &&
557+
(dpm_table->dpm_levels[dpm_table->count - 1].value >
558+
skutable->DriverReportedClocks.GameClockAc)) {
559+
dpm_table->dpm_levels[dpm_table->count - 1].value =
560+
skutable->DriverReportedClocks.GameClockAc;
561+
dpm_table->max = skutable->DriverReportedClocks.GameClockAc;
562+
}
546563
} else {
547564
dpm_table->count = 1;
548565
dpm_table->dpm_levels[0].value = smu->smu_table.boot_values.gfxclk / 100;
@@ -805,6 +822,57 @@ static int smu_v13_0_0_get_smu_metrics_data(struct smu_context *smu,
805822
return ret;
806823
}
807824

825+
static int smu_v13_0_0_get_dpm_ultimate_freq(struct smu_context *smu,
826+
enum smu_clk_type clk_type,
827+
uint32_t *min,
828+
uint32_t *max)
829+
{
830+
struct smu_13_0_dpm_context *dpm_context =
831+
smu->smu_dpm.dpm_context;
832+
struct smu_13_0_dpm_table *dpm_table;
833+
834+
switch (clk_type) {
835+
case SMU_MCLK:
836+
case SMU_UCLK:
837+
/* uclk dpm table */
838+
dpm_table = &dpm_context->dpm_tables.uclk_table;
839+
break;
840+
case SMU_GFXCLK:
841+
case SMU_SCLK:
842+
/* gfxclk dpm table */
843+
dpm_table = &dpm_context->dpm_tables.gfx_table;
844+
break;
845+
case SMU_SOCCLK:
846+
/* socclk dpm table */
847+
dpm_table = &dpm_context->dpm_tables.soc_table;
848+
break;
849+
case SMU_FCLK:
850+
/* fclk dpm table */
851+
dpm_table = &dpm_context->dpm_tables.fclk_table;
852+
break;
853+
case SMU_VCLK:
854+
case SMU_VCLK1:
855+
/* vclk dpm table */
856+
dpm_table = &dpm_context->dpm_tables.vclk_table;
857+
break;
858+
case SMU_DCLK:
859+
case SMU_DCLK1:
860+
/* dclk dpm table */
861+
dpm_table = &dpm_context->dpm_tables.dclk_table;
862+
break;
863+
default:
864+
dev_err(smu->adev->dev, "Unsupported clock type!\n");
865+
return -EINVAL;
866+
}
867+
868+
if (min)
869+
*min = dpm_table->min;
870+
if (max)
871+
*max = dpm_table->max;
872+
873+
return 0;
874+
}
875+
808876
static int smu_v13_0_0_read_sensor(struct smu_context *smu,
809877
enum amd_pp_sensors sensor,
810878
void *data,
@@ -1910,7 +1978,7 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
19101978
.get_enabled_mask = smu_cmn_get_enabled_mask,
19111979
.dpm_set_vcn_enable = smu_v13_0_set_vcn_enable,
19121980
.dpm_set_jpeg_enable = smu_v13_0_set_jpeg_enable,
1913-
.get_dpm_ultimate_freq = smu_v13_0_get_dpm_ultimate_freq,
1981+
.get_dpm_ultimate_freq = smu_v13_0_0_get_dpm_ultimate_freq,
19141982
.get_vbios_bootup_values = smu_v13_0_get_vbios_bootup_values,
19151983
.read_sensor = smu_v13_0_0_read_sensor,
19161984
.feature_is_enabled = smu_cmn_feature_is_enabled,

0 commit comments

Comments
 (0)