mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 11:33:28 +02:00
drm/amd/pm: Use driver table structure in smuv12
Use driver table structure for gpu metrics in smuv12. 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
d1010ca49b
commit
f8e8d7da25
|
|
@ -157,6 +157,7 @@ static int renoir_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);
|
||||
|
|
@ -178,9 +179,10 @@ static int renoir_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_v2_2);
|
||||
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_v2_2),
|
||||
SMU_GPU_METRICS_CACHE_INTERVAL);
|
||||
if (ret)
|
||||
goto err3_out;
|
||||
|
||||
return 0;
|
||||
|
|
@ -1371,9 +1373,9 @@ static bool renoir_is_dpm_running(struct smu_context *smu)
|
|||
static ssize_t renoir_get_gpu_metrics(struct smu_context *smu,
|
||||
void **table)
|
||||
{
|
||||
struct smu_table_context *smu_table = &smu->smu_table;
|
||||
struct gpu_metrics_v2_2 *gpu_metrics =
|
||||
(struct gpu_metrics_v2_2 *)smu_table->gpu_metrics_table;
|
||||
(struct gpu_metrics_v2_2 *)smu_driver_table_ptr(
|
||||
smu, SMU_DRIVER_TABLE_GPU_METRICS);
|
||||
SmuMetrics_t metrics;
|
||||
int ret = 0;
|
||||
|
||||
|
|
@ -1429,6 +1431,8 @@ static ssize_t renoir_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_v2_2);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -192,8 +192,7 @@ int smu_v12_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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user