Skip to content

Commit

Permalink
drm/amd/pm: fulfill the support for DriverSmuConfig table
Browse files Browse the repository at this point in the history
Enable the support for DriverSmuConfig table on Navi1x and
Sienna_Cichlid.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Evan Quan authored and Alex Deucher committed Feb 11, 2022
1 parent 60aac46 commit 816d61d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ struct smu_table_context
struct smu_bios_boot_up_values boot_values;
void *driver_pptable;
void *ecc_table;
void *driver_smu_config_table;
struct smu_table tables[SMU_TABLE_COUNT];
/*
* The driver table is just a staging buffer for
Expand Down
9 changes: 9 additions & 0 deletions drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,8 @@ static int navi10_tables_init(struct smu_context *smu)
SMU_TABLE_INIT(tables, SMU_TABLE_ACTIVITY_MONITOR_COEFF,
sizeof(DpmActivityMonitorCoeffInt_t), PAGE_SIZE,
AMDGPU_GEM_DOMAIN_VRAM);
SMU_TABLE_INIT(tables, SMU_TABLE_DRIVER_SMU_CONFIG, sizeof(DriverSmuConfig_t),
PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);

smu_table->metrics_table = kzalloc(sizeof(SmuMetrics_NV1X_t),
GFP_KERNEL);
Expand All @@ -526,8 +528,15 @@ static int navi10_tables_init(struct smu_context *smu)
if (!smu_table->watermarks_table)
goto err2_out;

smu_table->driver_smu_config_table =
kzalloc(tables[SMU_TABLE_DRIVER_SMU_CONFIG].size, GFP_KERNEL);
if (!smu_table->driver_smu_config_table)
goto err3_out;

return 0;

err3_out:
kfree(smu_table->watermarks_table);
err2_out:
kfree(smu_table->gpu_metrics_table);
err1_out:
Expand Down
13 changes: 12 additions & 1 deletion drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,8 @@ static int sienna_cichlid_tables_init(struct smu_context *smu)
AMDGPU_GEM_DOMAIN_VRAM);
SMU_TABLE_INIT(tables, SMU_TABLE_ECCINFO, sizeof(EccInfoTable_t),
PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
SMU_TABLE_INIT(tables, SMU_TABLE_DRIVER_SMU_CONFIG, sizeof(DriverSmuConfigExternal_t),
PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);

smu_table->metrics_table = kzalloc(sizeof(SmuMetricsExternal_t), GFP_KERNEL);
if (!smu_table->metrics_table)
Expand All @@ -492,10 +494,19 @@ static int sienna_cichlid_tables_init(struct smu_context *smu)

smu_table->ecc_table = kzalloc(tables[SMU_TABLE_ECCINFO].size, GFP_KERNEL);
if (!smu_table->ecc_table)
return -ENOMEM;
goto err3_out;

smu_table->driver_smu_config_table =
kzalloc(tables[SMU_TABLE_DRIVER_SMU_CONFIG].size, GFP_KERNEL);
if (!smu_table->driver_smu_config_table)
goto err4_out;

return 0;

err4_out:
kfree(smu_table->ecc_table);
err3_out:
kfree(smu_table->watermarks_table);
err2_out:
kfree(smu_table->gpu_metrics_table);
err1_out:
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,9 +473,11 @@ int smu_v11_0_fini_smc_tables(struct smu_context *smu)
kfree(smu_table->hardcode_pptable);
smu_table->hardcode_pptable = NULL;

kfree(smu_table->driver_smu_config_table);
kfree(smu_table->ecc_table);
kfree(smu_table->metrics_table);
kfree(smu_table->watermarks_table);
smu_table->driver_smu_config_table = NULL;
smu_table->ecc_table = NULL;
smu_table->metrics_table = NULL;
smu_table->watermarks_table = NULL;
Expand Down

0 comments on commit 816d61d

Please sign in to comment.