drm/amd/pm: Allocate dummy table only if needed
authorLijo Lazar <lijo.lazar@amd.com>
Thu, 19 Jan 2023 13:13:28 +0000 (18:43 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 16 Feb 2023 03:24:08 +0000 (22:24 -0500)
Only Navi1x requires dummy read workaround. Allocate the table in VRAM
only for Navi1x.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c

index 3f96c4772d39623df06fde1341d0c3a5d192f0e4..834d146c4991fae99156113ef223858c95c57540 100644 (file)
@@ -904,9 +904,8 @@ static int smu_alloc_dummy_read_table(struct smu_context *smu)
        struct amdgpu_device *adev = smu->adev;
        int ret = 0;
 
-       dummy_read_1_table->size = 0x40000;
-       dummy_read_1_table->align = PAGE_SIZE;
-       dummy_read_1_table->domain = AMDGPU_GEM_DOMAIN_VRAM;
+       if (!dummy_read_1_table->size)
+               return 0;
 
        ret = amdgpu_bo_create_kernel(adev,
                                      dummy_read_1_table->size,
index 0bcd4fe0ef177666f54c79a673cdadc9cb2414d1..95da6dd1cc656d429995c20cc44c57ae8bb938d7 100644 (file)
@@ -494,6 +494,8 @@ static int navi10_tables_init(struct smu_context *smu)
 {
        struct smu_table_context *smu_table = &smu->smu_table;
        struct smu_table *tables = smu_table->tables;
+       struct smu_table *dummy_read_1_table =
+                       &smu_table->dummy_read_1_table;
 
        SMU_TABLE_INIT(tables, SMU_TABLE_PPTABLE, sizeof(PPTable_t),
                       PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
@@ -513,6 +515,10 @@ static int navi10_tables_init(struct smu_context *smu)
        SMU_TABLE_INIT(tables, SMU_TABLE_DRIVER_SMU_CONFIG, sizeof(DriverSmuConfig_t),
                       PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
 
+       dummy_read_1_table->size = 0x40000;
+       dummy_read_1_table->align = PAGE_SIZE;
+       dummy_read_1_table->domain = AMDGPU_GEM_DOMAIN_VRAM;
+
        smu_table->metrics_table = kzalloc(sizeof(SmuMetrics_NV1X_t),
                                           GFP_KERNEL);
        if (!smu_table->metrics_table)