drm/amd/pm: correct the softpptable ids used for SMU 13.0.0
authorEvan Quan <evan.quan@amd.com>
Tue, 10 May 2022 03:04:06 +0000 (11:04 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 26 May 2022 18:56:32 +0000 (14:56 -0400)
To better match with the pptable_id settings from VBIOS.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@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/smu13/smu_v13_0.c

index ae6321af9d8804f03bc741da9abff41dd74a2fe5..7be4f6875a7bc57466785a08dd298b790b5ebbb2 100644 (file)
@@ -218,13 +218,25 @@ int smu_v13_0_init_pptable_microcode(struct smu_context *smu)
                        pptable_id == 3688)
                        pptable_id = 36881;
                /*
-                * Temporary solution for SMU V13.0.0:
-                *   - use 99991 signed pptable when SCPM enabled
-                * TODO: drop this when the pptable carried in vbios
-                * is ready.
+                * Temporary solution for SMU V13.0.0 with SCPM enabled:
+                *   - use 36831 signed pptable when pp_table_id is 3683
+                *   - use 36641 signed pptable when pp_table_id is 3664 or 0
+                * TODO: drop these when the pptable carried in vbios is ready.
                 */
-               if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0))
-                       pptable_id = 99991;
+               if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)) {
+                       switch (pptable_id) {
+                       case 0:
+                       case 3664:
+                               pptable_id = 36641;
+                               break;
+                       case 3683:
+                               pptable_id = 36831;
+                               break;
+                       default:
+                               dev_err(adev->dev, "Unsupported pptable id %d\n", pptable_id);
+                               return -EINVAL;
+                       }
+               }
        }
 
        /* "pptable_id == 0" means vbios carries the pptable. */
@@ -448,13 +460,24 @@ int smu_v13_0_setup_pptable(struct smu_context *smu)
                pptable_id = smu->smu_table.boot_values.pp_table_id;
 
                /*
-                * Temporary solution for SMU V13.0.0:
-                *   - use 9999 unsigned pptable when SCPM disabled
-                * TODO: drop this when the pptable carried in vbios
-                * is ready.
+                * Temporary solution for SMU V13.0.0 with SCPM disabled:
+                *   - use 3664 or 3683 on request
+                *   - use 3664 when pptable_id is 0
+                * TODO: drop these when the pptable carried in vbios is ready.
                 */
-               if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0))
-                       pptable_id = 9999;
+               if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)) {
+                       switch (pptable_id) {
+                       case 0:
+                               pptable_id = 3664;
+                               break;
+                       case 3664:
+                       case 3683:
+                               break;
+                       default:
+                               dev_err(adev->dev, "Unsupported pptable id %d\n", pptable_id);
+                               return -EINVAL;
+                       }
+               }
        }
 
        /* force using vbios pptable in sriov mode */