drm/amd/pm: enable MACO support for SMU 13.0.0
authorEvan Quan <evan.quan@amd.com>
Tue, 7 Jun 2022 06:40:24 +0000 (14:40 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 15 Jun 2022 01:38:40 +0000 (21:38 -0400)
Enable BAMACO reset support for SMU 13.0.0.

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/smu13/smu_v13_0.c
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c

index fba0b87d01fbe1a34092b662b76467cc41060208..f18f9605e586ec152241fa2d6637f96a8264f9ed 100644 (file)
@@ -2271,7 +2271,8 @@ int smu_v13_0_baco_set_state(struct smu_context *smu,
        if (state == SMU_BACO_STATE_ENTER) {
                ret = smu_cmn_send_smc_msg_with_param(smu,
                                                      SMU_MSG_EnterBaco,
-                                                     0,
+                                                     smu_baco->maco_support ?
+                                                     BACO_SEQ_BAMACO : BACO_SEQ_BACO,
                                                      NULL);
        } else {
                ret = smu_cmn_send_smc_msg(smu,
index 495713e4ebd434a9ed10a2a1fdb19ffe9176cec2..6fb2b072a730e44d4e873f81ff96ba4e8e79a14a 100644 (file)
@@ -325,6 +325,9 @@ static int smu_v13_0_0_check_powerplay_table(struct smu_context *smu)
            powerplay_table->platform_caps & SMU_13_0_0_PP_PLATFORM_CAP_MACO)
                smu_baco->platform_support = true;
 
+       if (powerplay_table->platform_caps & SMU_13_0_0_PP_PLATFORM_CAP_MACO)
+               smu_baco->maco_support = true;
+
        table_context->thermal_controller_type =
                powerplay_table->thermal_controller_type;
 
index 185058637f7d52f1dd270e04925c518856e7c992..193222fdd1c46251a652e9f6c126fbd1f3056095 100644 (file)
@@ -1543,54 +1543,6 @@ static int smu_v13_0_7_set_power_profile_mode(struct smu_context *smu, long *inp
        return ret;
 }
 
-static int smu_v13_0_7_baco_set_state(struct smu_context *smu,
-                            enum smu_baco_state state)
-{
-       struct smu_baco_context *smu_baco = &smu->smu_baco;
-       struct amdgpu_device *adev = smu->adev;
-       bool is_maco_support = smu_baco->maco_support;
-       int ret;
-
-       if (smu_v13_0_baco_get_state(smu) == state)
-               return 0;
-
-       if (state == SMU_BACO_STATE_ENTER) {
-               ret = smu_cmn_send_smc_msg_with_param(smu,
-                                                     SMU_MSG_EnterBaco,
-                                                     (is_maco_support ? 2 : 0),
-                                                     NULL);
-       } else {
-               ret = smu_cmn_send_smc_msg(smu,
-                                          SMU_MSG_ExitBaco,
-                                          NULL);
-               if (ret)
-                       return ret;
-
-               /* clear vbios scratch 6 and 7 for coming asic reinit */
-               WREG32(adev->bios_scratch_reg_offset + 6, 0);
-               WREG32(adev->bios_scratch_reg_offset + 7, 0);
-       }
-
-       if (!ret)
-               smu_baco->state = state;
-
-       return ret;
-}
-
-static int smu_v13_0_7_baco_enter(struct smu_context *smu)
-{
-       int ret = 0;
-
-       ret = smu_v13_0_7_baco_set_state(smu,
-                                      SMU_BACO_STATE_ENTER);
-       if (ret)
-               return ret;
-
-       msleep(10);
-
-       return ret;
-}
-
 static const struct pptable_funcs smu_v13_0_7_ppt_funcs = {
        .get_allowed_feature_mask = smu_v13_0_7_get_allowed_feature_mask,
        .set_default_dpm_table = smu_v13_0_7_set_default_dpm_table,
@@ -1645,8 +1597,8 @@ static const struct pptable_funcs smu_v13_0_7_ppt_funcs = {
        .set_pp_feature_mask = smu_cmn_set_pp_feature_mask,
        .baco_is_support = smu_v13_0_baco_is_support,
        .baco_get_state = smu_v13_0_baco_get_state,
-       .baco_set_state = smu_v13_0_7_baco_set_state,
-       .baco_enter = smu_v13_0_7_baco_enter,
+       .baco_set_state = smu_v13_0_baco_set_state,
+       .baco_enter = smu_v13_0_baco_enter,
        .baco_exit = smu_v13_0_baco_exit,
        .set_mp1_state = smu_cmn_set_mp1_state,
 };