drm/amd/pm: fulfill the support for DriverSmuConfig table
authorEvan Quan <evan.quan@amd.com>
Tue, 18 Jan 2022 07:58:51 +0000 (15:58 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 11 Feb 2022 21:12:53 +0000 (16:12 -0500)
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>
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

index 218de8f..17594ce 100644 (file)
@@ -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
index f2a00e6..66f9276 100644 (file)
@@ -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);
@@ -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:
index 762b633..358031c 100644 (file)
@@ -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)
@@ -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:
index d71155a..b87f550 100644 (file)
@@ -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;