Commit b874c667 authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher

drm/amd/pm: correct the default DriverSmuConfig table settings

For Some ASICs, with the PMFW default settings, we may see the
power consumption reported via metrics table is "Very Erratic".
With the socket power alpha filter set as 10/100ms, we can correct
that issue.
Signed-off-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 92ede25e
......@@ -293,6 +293,18 @@ struct amdgpu_smu_i2c_bus {
struct mutex mutex;
};
struct config_table_setting
{
uint16_t gfxclk_average_tau;
uint16_t socclk_average_tau;
uint16_t uclk_average_tau;
uint16_t gfx_activity_average_tau;
uint16_t mem_activity_average_tau;
uint16_t socket_power_average_tau;
uint16_t apu_socket_power_average_tau;
uint16_t fclk_average_tau;
};
struct amdgpu_pm {
struct mutex mutex;
u32 current_sclk;
......@@ -341,6 +353,8 @@ struct amdgpu_pm {
struct mutex stable_pstate_ctx_lock;
struct amdgpu_ctx *stable_pstate_ctx;
struct config_table_setting config_table;
};
int amdgpu_dpm_read_sensor(struct amdgpu_device *adev, enum amd_pp_sensors sensor,
......
......@@ -609,6 +609,18 @@ static int smu_set_default_dpm_table(struct smu_context *smu)
return ret;
}
static int smu_apply_default_config_table_settings(struct smu_context *smu)
{
struct amdgpu_device *adev = smu->adev;
int ret = 0;
ret = smu_get_default_config_table_settings(smu,
&adev->pm.config_table);
if (ret)
return ret;
return smu_set_config_table(smu, &adev->pm.config_table);
}
static int smu_late_init(void *handle)
{
......@@ -663,6 +675,12 @@ static int smu_late_init(void *handle)
smu->smu_dpm.dpm_level,
AMD_PP_TASK_COMPLETE_INIT);
ret = smu_apply_default_config_table_settings(smu);
if (ret && (ret != -EOPNOTSUPP)) {
dev_err(adev->dev, "Failed to apply default DriverSmuConfig settings!\n");
return ret;
}
smu_restore_dpm_user_profile(smu);
return 0;
......
......@@ -1282,6 +1282,16 @@ struct pptable_funcs {
* @stb_collect_info: Collects Smart Trace Buffers data.
*/
int (*stb_collect_info)(struct smu_context *smu, void *buf, uint32_t size);
/**
* @get_default_config_table_settings: Get the ASIC default DriverSmuConfig table settings.
*/
int (*get_default_config_table_settings)(struct smu_context *smu, struct config_table_setting *table);
/**
* @set_config_table: Apply the input DriverSmuConfig table settings.
*/
int (*set_config_table)(struct smu_context *smu, struct config_table_setting *table);
};
typedef enum {
......
......@@ -91,6 +91,8 @@
#define smu_post_init(smu) smu_ppt_funcs(post_init, 0, smu)
#define smu_gpo_control(smu, enablement) smu_ppt_funcs(gpo_control, 0, smu, enablement)
#define smu_set_fine_grain_gfx_freq_parameters(smu) smu_ppt_funcs(set_fine_grain_gfx_freq_parameters, 0, smu)
#define smu_get_default_config_table_settings(smu, config_table) smu_ppt_funcs(get_default_config_table_settings, -EOPNOTSUPP, smu, config_table)
#define smu_set_config_table(smu, config_table) smu_ppt_funcs(set_config_table, -EOPNOTSUPP, smu, config_table)
#endif
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment