Skip to content

Commit 064329c

Browse files
Evan Quanalexdeucher
authored andcommitted
drm/amd/pm: expose swctf threshold setting for legacy powerplay
Preparation for coming optimization which eliminates the influence of GPU temperature momentary fluctuation. Signed-off-by: Evan Quan <[email protected]> Reviewed-by: Lijo Lazar <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent b877934 commit 064329c

File tree

7 files changed

+26
-1
lines changed

7 files changed

+26
-1
lines changed

drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ struct amdgpu_dpm_thermal {
8989
int max_mem_crit_temp;
9090
/* memory max emergency(shutdown) temp */
9191
int max_mem_emergency_temp;
92+
/* SWCTF threshold */
93+
int sw_ctf_threshold;
9294
/* was last interrupt low to high or high to low */
9395
bool high_to_low;
9496
/* interrupt source */

drivers/gpu/drm/amd/pm/powerplay/hwmgr/hardwaremanager.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ int phm_start_thermal_controller(struct pp_hwmgr *hwmgr)
241241
TEMP_RANGE_MAX,
242242
TEMP_RANGE_MIN,
243243
TEMP_RANGE_MAX,
244-
TEMP_RANGE_MAX};
244+
TEMP_RANGE_MAX,
245+
0};
245246
struct amdgpu_device *adev = hwmgr->adev;
246247

247248
if (!hwmgr->not_vf)
@@ -265,6 +266,7 @@ int phm_start_thermal_controller(struct pp_hwmgr *hwmgr)
265266
adev->pm.dpm.thermal.min_mem_temp = range.mem_min;
266267
adev->pm.dpm.thermal.max_mem_crit_temp = range.mem_crit_max;
267268
adev->pm.dpm.thermal.max_mem_emergency_temp = range.mem_emergency_max;
269+
adev->pm.dpm.thermal.sw_ctf_threshold = range.sw_ctf_threshold;
268270

269271
return ret;
270272
}

drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5432,6 +5432,8 @@ static int smu7_get_thermal_temperature_range(struct pp_hwmgr *hwmgr,
54325432
thermal_data->max = data->thermal_temp_setting.temperature_shutdown *
54335433
PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
54345434

5435+
thermal_data->sw_ctf_threshold = thermal_data->max;
5436+
54355437
return 0;
54365438
}
54375439

drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5241,6 +5241,9 @@ static int vega10_get_thermal_temperature_range(struct pp_hwmgr *hwmgr,
52415241
{
52425242
struct vega10_hwmgr *data = hwmgr->backend;
52435243
PPTable_t *pp_table = &(data->smc_state_table.pp_table);
5244+
struct phm_ppt_v2_information *pp_table_info =
5245+
(struct phm_ppt_v2_information *)(hwmgr->pptable);
5246+
struct phm_tdp_table *tdp_table = pp_table_info->tdp_table;
52445247

52455248
memcpy(thermal_data, &SMU7ThermalWithDelayPolicy[0], sizeof(struct PP_TemperatureRange));
52465249

@@ -5257,6 +5260,13 @@ static int vega10_get_thermal_temperature_range(struct pp_hwmgr *hwmgr,
52575260
thermal_data->mem_emergency_max = (pp_table->ThbmLimit + CTF_OFFSET_HBM)*
52585261
PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
52595262

5263+
if (tdp_table->usSoftwareShutdownTemp > pp_table->ThotspotLimit &&
5264+
tdp_table->usSoftwareShutdownTemp < VEGA10_THERMAL_MAXIMUM_ALERT_TEMP)
5265+
thermal_data->sw_ctf_threshold = tdp_table->usSoftwareShutdownTemp;
5266+
else
5267+
thermal_data->sw_ctf_threshold = VEGA10_THERMAL_MAXIMUM_ALERT_TEMP;
5268+
thermal_data->sw_ctf_threshold *= PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
5269+
52605270
return 0;
52615271
}
52625272

drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2763,6 +2763,8 @@ static int vega12_notify_cac_buffer_info(struct pp_hwmgr *hwmgr,
27632763
static int vega12_get_thermal_temperature_range(struct pp_hwmgr *hwmgr,
27642764
struct PP_TemperatureRange *thermal_data)
27652765
{
2766+
struct phm_ppt_v3_information *pptable_information =
2767+
(struct phm_ppt_v3_information *)hwmgr->pptable;
27662768
struct vega12_hwmgr *data =
27672769
(struct vega12_hwmgr *)(hwmgr->backend);
27682770
PPTable_t *pp_table = &(data->smc_state_table.pp_table);
@@ -2781,6 +2783,8 @@ static int vega12_get_thermal_temperature_range(struct pp_hwmgr *hwmgr,
27812783
PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
27822784
thermal_data->mem_emergency_max = (pp_table->ThbmLimit + CTF_OFFSET_HBM)*
27832785
PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
2786+
thermal_data->sw_ctf_threshold = pptable_information->us_software_shutdown_temp *
2787+
PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
27842788

27852789
return 0;
27862790
}

drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4206,6 +4206,8 @@ static int vega20_notify_cac_buffer_info(struct pp_hwmgr *hwmgr,
42064206
static int vega20_get_thermal_temperature_range(struct pp_hwmgr *hwmgr,
42074207
struct PP_TemperatureRange *thermal_data)
42084208
{
4209+
struct phm_ppt_v3_information *pptable_information =
4210+
(struct phm_ppt_v3_information *)hwmgr->pptable;
42094211
struct vega20_hwmgr *data =
42104212
(struct vega20_hwmgr *)(hwmgr->backend);
42114213
PPTable_t *pp_table = &(data->smc_state_table.pp_table);
@@ -4224,6 +4226,8 @@ static int vega20_get_thermal_temperature_range(struct pp_hwmgr *hwmgr,
42244226
PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
42254227
thermal_data->mem_emergency_max = (pp_table->ThbmLimit + CTF_OFFSET_HBM)*
42264228
PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
4229+
thermal_data->sw_ctf_threshold = pptable_information->us_software_shutdown_temp *
4230+
PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
42274231

42284232
return 0;
42294233
}

drivers/gpu/drm/amd/pm/powerplay/inc/power_state.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ struct PP_TemperatureRange {
131131
int mem_min;
132132
int mem_crit_max;
133133
int mem_emergency_max;
134+
int sw_ctf_threshold;
134135
};
135136

136137
struct PP_StateValidationBlock {

0 commit comments

Comments
 (0)