mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 19:43:40 +02:00
drm/amd/pm: Use driver table structure in smuv14
Use driver table structure for gpu metrics in smuv14. The default cache interval is set at 5ms. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Asad Kamal <asad.kamal@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
e3e4f03f25
commit
618c144145
|
|
@ -496,13 +496,12 @@ int smu_v14_0_fini_smc_tables(struct smu_context *smu)
|
|||
struct smu_table_context *smu_table = &smu->smu_table;
|
||||
struct smu_dpm_context *smu_dpm = &smu->smu_dpm;
|
||||
|
||||
kfree(smu_table->gpu_metrics_table);
|
||||
smu_driver_table_fini(smu, SMU_DRIVER_TABLE_GPU_METRICS);
|
||||
kfree(smu_table->combo_pptable);
|
||||
kfree(smu_table->boot_overdrive_table);
|
||||
kfree(smu_table->overdrive_table);
|
||||
kfree(smu_table->max_sustainable_clocks);
|
||||
kfree(smu_table->driver_pptable);
|
||||
smu_table->gpu_metrics_table = NULL;
|
||||
smu_table->combo_pptable = NULL;
|
||||
smu_table->boot_overdrive_table = NULL;
|
||||
smu_table->overdrive_table = NULL;
|
||||
|
|
|
|||
|
|
@ -186,6 +186,7 @@ static int smu_v14_0_0_init_smc_tables(struct smu_context *smu)
|
|||
{
|
||||
struct smu_table_context *smu_table = &smu->smu_table;
|
||||
struct smu_table *tables = smu_table->tables;
|
||||
int ret;
|
||||
|
||||
SMU_TABLE_INIT(tables, SMU_TABLE_WATERMARKS, sizeof(Watermarks_t),
|
||||
PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
|
||||
|
|
@ -207,9 +208,10 @@ static int smu_v14_0_0_init_smc_tables(struct smu_context *smu)
|
|||
if (!smu_table->watermarks_table)
|
||||
goto err2_out;
|
||||
|
||||
smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v3_0);
|
||||
smu_table->gpu_metrics_table = kzalloc(smu_table->gpu_metrics_table_size, GFP_KERNEL);
|
||||
if (!smu_table->gpu_metrics_table)
|
||||
ret = smu_driver_table_init(smu, SMU_DRIVER_TABLE_GPU_METRICS,
|
||||
sizeof(struct gpu_metrics_v3_0),
|
||||
SMU_GPU_METRICS_CACHE_INTERVAL);
|
||||
if (ret)
|
||||
goto err3_out;
|
||||
|
||||
return 0;
|
||||
|
|
@ -237,8 +239,7 @@ static int smu_v14_0_0_fini_smc_tables(struct smu_context *smu)
|
|||
kfree(smu_table->watermarks_table);
|
||||
smu_table->watermarks_table = NULL;
|
||||
|
||||
kfree(smu_table->gpu_metrics_table);
|
||||
smu_table->gpu_metrics_table = NULL;
|
||||
smu_driver_table_fini(smu, SMU_DRIVER_TABLE_GPU_METRICS);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -538,11 +539,11 @@ static int smu_v14_0_0_set_watermarks_table(struct smu_context *smu,
|
|||
}
|
||||
|
||||
static ssize_t smu_v14_0_0_get_gpu_metrics(struct smu_context *smu,
|
||||
void **table)
|
||||
void **table)
|
||||
{
|
||||
struct smu_table_context *smu_table = &smu->smu_table;
|
||||
struct gpu_metrics_v3_0 *gpu_metrics =
|
||||
(struct gpu_metrics_v3_0 *)smu_table->gpu_metrics_table;
|
||||
(struct gpu_metrics_v3_0 *)smu_driver_table_ptr(
|
||||
smu, SMU_DRIVER_TABLE_GPU_METRICS);
|
||||
SmuMetrics_t metrics;
|
||||
int ret = 0;
|
||||
|
||||
|
|
@ -611,6 +612,8 @@ static ssize_t smu_v14_0_0_get_gpu_metrics(struct smu_context *smu,
|
|||
|
||||
*table = (void *)gpu_metrics;
|
||||
|
||||
smu_driver_table_update_cache_time(smu, SMU_DRIVER_TABLE_GPU_METRICS);
|
||||
|
||||
return sizeof(struct gpu_metrics_v3_0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -415,6 +415,7 @@ static int smu_v14_0_2_tables_init(struct smu_context *smu)
|
|||
{
|
||||
struct smu_table_context *smu_table = &smu->smu_table;
|
||||
struct smu_table *tables = smu_table->tables;
|
||||
int ret;
|
||||
|
||||
SMU_TABLE_INIT(tables, SMU_TABLE_PPTABLE, sizeof(PPTable_t),
|
||||
PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
|
||||
|
|
@ -441,9 +442,10 @@ static int smu_v14_0_2_tables_init(struct smu_context *smu)
|
|||
goto err0_out;
|
||||
smu_table->metrics_time = 0;
|
||||
|
||||
smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v1_3);
|
||||
smu_table->gpu_metrics_table = kzalloc(smu_table->gpu_metrics_table_size, GFP_KERNEL);
|
||||
if (!smu_table->gpu_metrics_table)
|
||||
ret = smu_driver_table_init(smu, SMU_DRIVER_TABLE_GPU_METRICS,
|
||||
sizeof(struct gpu_metrics_v1_3),
|
||||
SMU_GPU_METRICS_CACHE_INTERVAL);
|
||||
if (ret)
|
||||
goto err1_out;
|
||||
|
||||
smu_table->watermarks_table = kzalloc(sizeof(Watermarks_t), GFP_KERNEL);
|
||||
|
|
@ -459,7 +461,7 @@ static int smu_v14_0_2_tables_init(struct smu_context *smu)
|
|||
err3_out:
|
||||
kfree(smu_table->watermarks_table);
|
||||
err2_out:
|
||||
kfree(smu_table->gpu_metrics_table);
|
||||
smu_driver_table_fini(smu, SMU_DRIVER_TABLE_GPU_METRICS);
|
||||
err1_out:
|
||||
kfree(smu_table->metrics_table);
|
||||
err0_out:
|
||||
|
|
@ -2121,9 +2123,9 @@ static void smu_v14_0_2_set_smu_mailbox_registers(struct smu_context *smu)
|
|||
static ssize_t smu_v14_0_2_get_gpu_metrics(struct smu_context *smu,
|
||||
void **table)
|
||||
{
|
||||
struct smu_table_context *smu_table = &smu->smu_table;
|
||||
struct gpu_metrics_v1_3 *gpu_metrics =
|
||||
(struct gpu_metrics_v1_3 *)smu_table->gpu_metrics_table;
|
||||
(struct gpu_metrics_v1_3 *)smu_driver_table_ptr(
|
||||
smu, SMU_DRIVER_TABLE_GPU_METRICS);
|
||||
SmuMetricsExternal_t metrics_ext;
|
||||
SmuMetrics_t *metrics = &metrics_ext.SmuMetrics;
|
||||
int ret = 0;
|
||||
|
|
@ -2197,6 +2199,8 @@ static ssize_t smu_v14_0_2_get_gpu_metrics(struct smu_context *smu,
|
|||
|
||||
*table = (void *)gpu_metrics;
|
||||
|
||||
smu_driver_table_update_cache_time(smu, SMU_DRIVER_TABLE_GPU_METRICS);
|
||||
|
||||
return sizeof(struct gpu_metrics_v1_3);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user