Skip to content

Commit 908cebc

Browse files
Li Maalexdeucher
authored andcommitted
drm/amd/swsmu: remove fw version check in sw_init.
dorp fw version check and using max table size to init table. Signed-off-by: Li Ma <li.ma@amd.com> Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com> Reviewed-by: Yang Wang <kevinyang.wang@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 34ec3ce commit 908cebc

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -234,24 +234,15 @@ static int vangogh_tables_init(struct smu_context *smu)
234234
PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
235235
SMU_TABLE_INIT(tables, SMU_TABLE_ACTIVITY_MONITOR_COEFF, sizeof(DpmActivityMonitorCoeffExt_t),
236236
PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
237+
SMU_TABLE_INIT(tables, SMU_TABLE_SMU_METRICS, max(sizeof(SmuMetrics_t), sizeof(SmuMetrics_legacy_t)),
238+
PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
237239

238-
if (smu->smc_fw_if_version < 0x3) {
239-
SMU_TABLE_INIT(tables, SMU_TABLE_SMU_METRICS, sizeof(SmuMetrics_legacy_t),
240-
PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
241-
smu_table->metrics_table = kzalloc(sizeof(SmuMetrics_legacy_t), GFP_KERNEL);
242-
} else {
243-
SMU_TABLE_INIT(tables, SMU_TABLE_SMU_METRICS, sizeof(SmuMetrics_t),
244-
PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
245-
smu_table->metrics_table = kzalloc(sizeof(SmuMetrics_t), GFP_KERNEL);
246-
}
240+
smu_table->metrics_table = kzalloc(max(sizeof(SmuMetrics_t), sizeof(SmuMetrics_legacy_t)), GFP_KERNEL);
247241
if (!smu_table->metrics_table)
248242
goto err0_out;
249243
smu_table->metrics_time = 0;
250244

251-
if (smu->smc_fw_version >= 0x043F3E00)
252-
smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v2_3);
253-
else
254-
smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v2_2);
245+
smu_table->gpu_metrics_table_size = max(sizeof(struct gpu_metrics_v2_3), sizeof(struct gpu_metrics_v2_2));
255246
smu_table->gpu_metrics_table = kzalloc(smu_table->gpu_metrics_table_size, GFP_KERNEL);
256247
if (!smu_table->gpu_metrics_table)
257248
goto err1_out;

0 commit comments

Comments
 (0)