Commit 723d4735 authored by Aaron Liu's avatar Aaron Liu Committed by Alex Deucher

drm/amd/powerplay: add DPMCLOCKS table implementation

This patch adds add DPMCLOCKS table implementation
Rename smu_populate_smc_pptable to smu_populate_smc_tables
Signed-off-by: default avatarAaron Liu <aaron.liu@amd.com>
Reviewed-by: default avatarKenneth Feng <kenneth.feng@amd.com>
Reviewed-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarKevin Wang <kevin1.wang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 049284bd
...@@ -1150,7 +1150,7 @@ static int smu_smc_table_hw_init(struct smu_context *smu, ...@@ -1150,7 +1150,7 @@ static int smu_smc_table_hw_init(struct smu_context *smu,
* type of clks. * type of clks.
*/ */
if (initialize) { if (initialize) {
ret = smu_populate_smc_pptable(smu); ret = smu_populate_smc_tables(smu);
if (ret) if (ret)
return ret; return ret;
......
...@@ -253,6 +253,7 @@ struct smu_table_context ...@@ -253,6 +253,7 @@ struct smu_table_context
void *hardcode_pptable; void *hardcode_pptable;
unsigned long metrics_time; unsigned long metrics_time;
void *metrics_table; void *metrics_table;
void *clocks_table;
void *max_sustainable_clocks; void *max_sustainable_clocks;
struct smu_bios_boot_up_values boot_values; struct smu_bios_boot_up_values boot_values;
...@@ -473,7 +474,7 @@ struct smu_funcs ...@@ -473,7 +474,7 @@ struct smu_funcs
int (*get_clk_info_from_vbios)(struct smu_context *smu); int (*get_clk_info_from_vbios)(struct smu_context *smu);
int (*check_pptable)(struct smu_context *smu); int (*check_pptable)(struct smu_context *smu);
int (*parse_pptable)(struct smu_context *smu); int (*parse_pptable)(struct smu_context *smu);
int (*populate_smc_pptable)(struct smu_context *smu); int (*populate_smc_tables)(struct smu_context *smu);
int (*check_fw_version)(struct smu_context *smu); int (*check_fw_version)(struct smu_context *smu);
int (*powergate_sdma)(struct smu_context *smu, bool gate); int (*powergate_sdma)(struct smu_context *smu, bool gate);
int (*powergate_vcn)(struct smu_context *smu, bool gate); int (*powergate_vcn)(struct smu_context *smu, bool gate);
...@@ -568,8 +569,8 @@ struct smu_funcs ...@@ -568,8 +569,8 @@ struct smu_funcs
((smu)->funcs->check_pptable ? (smu)->funcs->check_pptable((smu)) : 0) ((smu)->funcs->check_pptable ? (smu)->funcs->check_pptable((smu)) : 0)
#define smu_parse_pptable(smu) \ #define smu_parse_pptable(smu) \
((smu)->funcs->parse_pptable ? (smu)->funcs->parse_pptable((smu)) : 0) ((smu)->funcs->parse_pptable ? (smu)->funcs->parse_pptable((smu)) : 0)
#define smu_populate_smc_pptable(smu) \ #define smu_populate_smc_tables(smu) \
((smu)->funcs->populate_smc_pptable ? (smu)->funcs->populate_smc_pptable((smu)) : 0) ((smu)->funcs->populate_smc_tables ? (smu)->funcs->populate_smc_tables((smu)) : 0)
#define smu_check_fw_version(smu) \ #define smu_check_fw_version(smu) \
((smu)->funcs->check_fw_version ? (smu)->funcs->check_fw_version((smu)) : 0) ((smu)->funcs->check_fw_version ? (smu)->funcs->check_fw_version((smu)) : 0)
#define smu_write_pptable(smu) \ #define smu_write_pptable(smu) \
......
...@@ -140,6 +140,8 @@ static int renoir_get_smu_table_index(struct smu_context *smc, uint32_t index) ...@@ -140,6 +140,8 @@ static int renoir_get_smu_table_index(struct smu_context *smc, uint32_t index)
static int renoir_tables_init(struct smu_context *smu, struct smu_table *tables) static int renoir_tables_init(struct smu_context *smu, struct smu_table *tables)
{ {
struct smu_table_context *smu_table = &smu->smu_table;
SMU_TABLE_INIT(tables, SMU_TABLE_WATERMARKS, sizeof(Watermarks_t), SMU_TABLE_INIT(tables, SMU_TABLE_WATERMARKS, sizeof(Watermarks_t),
PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM); PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
SMU_TABLE_INIT(tables, SMU_TABLE_DPMCLOCKS, sizeof(DpmClocks_t), SMU_TABLE_INIT(tables, SMU_TABLE_DPMCLOCKS, sizeof(DpmClocks_t),
...@@ -147,6 +149,10 @@ static int renoir_tables_init(struct smu_context *smu, struct smu_table *tables) ...@@ -147,6 +149,10 @@ static int renoir_tables_init(struct smu_context *smu, struct smu_table *tables)
SMU_TABLE_INIT(tables, SMU_TABLE_SMU_METRICS, sizeof(SmuMetrics_t), SMU_TABLE_INIT(tables, SMU_TABLE_SMU_METRICS, sizeof(SmuMetrics_t),
PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM); PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
smu_table->clocks_table = kzalloc(sizeof(DpmClocks_t), GFP_KERNEL);
if (!smu_table->clocks_table)
return -ENOMEM;
return 0; return 0;
} }
......
...@@ -1736,7 +1736,7 @@ static const struct smu_funcs smu_v11_0_funcs = { ...@@ -1736,7 +1736,7 @@ static const struct smu_funcs smu_v11_0_funcs = {
.notify_memory_pool_location = smu_v11_0_notify_memory_pool_location, .notify_memory_pool_location = smu_v11_0_notify_memory_pool_location,
.check_pptable = smu_v11_0_check_pptable, .check_pptable = smu_v11_0_check_pptable,
.parse_pptable = smu_v11_0_parse_pptable, .parse_pptable = smu_v11_0_parse_pptable,
.populate_smc_pptable = smu_v11_0_populate_smc_pptable, .populate_smc_tables = smu_v11_0_populate_smc_pptable,
.write_pptable = smu_v11_0_write_pptable, .write_pptable = smu_v11_0_write_pptable,
.write_watermarks_table = smu_v11_0_write_watermarks_table, .write_watermarks_table = smu_v11_0_write_watermarks_table,
.set_min_dcef_deep_sleep = smu_v11_0_set_min_dcef_deep_sleep, .set_min_dcef_deep_sleep = smu_v11_0_set_min_dcef_deep_sleep,
......
...@@ -295,11 +295,30 @@ static int smu_v12_0_fini_smc_tables(struct smu_context *smu) ...@@ -295,11 +295,30 @@ static int smu_v12_0_fini_smc_tables(struct smu_context *smu)
if (!smu_table->tables || smu_table->table_count == 0) if (!smu_table->tables || smu_table->table_count == 0)
return -EINVAL; return -EINVAL;
kfree(smu_table->clocks_table);
kfree(smu_table->tables); kfree(smu_table->tables);
smu_table->clocks_table = NULL;
smu_table->tables = NULL; smu_table->tables = NULL;
return 0; return 0;
} }
static int smu_v12_0_populate_smc_tables(struct smu_context *smu)
{
struct smu_table_context *smu_table = &smu->smu_table;
struct smu_table *table = NULL;
table = &smu_table->tables[SMU_TABLE_DPMCLOCKS];
if (!table)
return -EINVAL;
if (!table->cpu_addr)
return -EINVAL;
return smu_update_table(smu, SMU_TABLE_DPMCLOCKS, 0, smu_table->clocks_table, false);
}
static const struct smu_funcs smu_v12_0_funcs = { static const struct smu_funcs smu_v12_0_funcs = {
.check_fw_status = smu_v12_0_check_fw_status, .check_fw_status = smu_v12_0_check_fw_status,
.check_fw_version = smu_v12_0_check_fw_version, .check_fw_version = smu_v12_0_check_fw_version,
...@@ -312,6 +331,7 @@ static const struct smu_funcs smu_v12_0_funcs = { ...@@ -312,6 +331,7 @@ static const struct smu_funcs smu_v12_0_funcs = {
.gfx_off_control = smu_v12_0_gfx_off_control, .gfx_off_control = smu_v12_0_gfx_off_control,
.init_smc_tables = smu_v12_0_init_smc_tables, .init_smc_tables = smu_v12_0_init_smc_tables,
.fini_smc_tables = smu_v12_0_fini_smc_tables, .fini_smc_tables = smu_v12_0_fini_smc_tables,
.populate_smc_tables = smu_v12_0_populate_smc_tables,
}; };
void smu_v12_0_set_smu_funcs(struct smu_context *smu) void smu_v12_0_set_smu_funcs(struct smu_context *smu)
......
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