Commit 9fa1ed5b authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher

drm/amd/powerplay: cache the watermark settings on system memory

So that we do not need to allocate a piece of VRAM for it. This
is a preparation for coming change which unifies the VRAM address
for all driver tables interaction with SMU.
Signed-off-by: default avatarEvan Quan <evan.quan@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent d5ec4b45
......@@ -1929,32 +1929,25 @@ int smu_set_df_cstate(struct smu_context *smu,
int smu_write_watermarks_table(struct smu_context *smu)
{
int ret = 0;
struct smu_table_context *smu_table = &smu->smu_table;
struct smu_table *table = NULL;
void *watermarks_table = smu->smu_table.watermarks_table;
table = &smu_table->tables[SMU_TABLE_WATERMARKS];
if (!table->cpu_addr)
if (!watermarks_table)
return -EINVAL;
ret = smu_update_table(smu, SMU_TABLE_WATERMARKS, 0, table->cpu_addr,
return smu_update_table(smu,
SMU_TABLE_WATERMARKS,
0,
watermarks_table,
true);
return ret;
}
int smu_set_watermarks_for_clock_ranges(struct smu_context *smu,
struct dm_pp_wm_sets_with_clock_ranges_soc15 *clock_ranges)
{
struct smu_table *watermarks;
void *table;
if (!smu->smu_table.tables)
return 0;
void *table = smu->smu_table.watermarks_table;
watermarks = &smu->smu_table.tables[SMU_TABLE_WATERMARKS];
table = watermarks->cpu_addr;
if (!table)
return -EINVAL;
mutex_lock(&smu->mutex);
......
......@@ -254,6 +254,7 @@ struct smu_table_context
unsigned long metrics_time;
void *metrics_table;
void *clocks_table;
void *watermarks_table;
void *max_sustainable_clocks;
struct smu_bios_boot_up_values boot_values;
......
......@@ -555,6 +555,10 @@ static int navi10_tables_init(struct smu_context *smu, struct smu_table *tables)
return -ENOMEM;
smu_table->metrics_time = 0;
smu_table->watermarks_table = kzalloc(sizeof(Watermarks_t), GFP_KERNEL);
if (!smu_table->watermarks_table)
return -ENOMEM;
return 0;
}
......
......@@ -209,6 +209,10 @@ static int renoir_tables_init(struct smu_context *smu, struct smu_table *tables)
return -ENOMEM;
smu_table->metrics_time = 0;
smu_table->watermarks_table = kzalloc(sizeof(Watermarks_t), GFP_KERNEL);
if (!smu_table->watermarks_table)
return -ENOMEM;
return 0;
}
......
......@@ -450,8 +450,10 @@ int smu_v11_0_fini_smc_tables(struct smu_context *smu)
kfree(smu_table->tables);
kfree(smu_table->metrics_table);
kfree(smu_table->watermarks_table);
smu_table->tables = NULL;
smu_table->metrics_table = NULL;
smu_table->watermarks_table = NULL;
smu_table->metrics_time = 0;
ret = smu_v11_0_fini_dpm_context(smu);
......
......@@ -338,6 +338,10 @@ static int vega20_tables_init(struct smu_context *smu, struct smu_table *tables)
return -ENOMEM;
smu_table->metrics_time = 0;
smu_table->watermarks_table = kzalloc(sizeof(Watermarks_t), GFP_KERNEL);
if (!smu_table->watermarks_table)
return -ENOMEM;
return 0;
}
......
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