]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amd/pm: disable cstate feature for gpu reset scenario
authorEvan Quan <evan.quan@amd.com>
Thu, 29 Sep 2022 02:50:44 +0000 (10:50 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 19 Oct 2022 02:12:20 +0000 (22:12 -0400)
Suggested by PMFW team and same as what did for gfxoff feature.
This can address some Mode1Reset failures observed on SMU13.0.0.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org # 6.0.x
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c

index bb73fb420ffcd3acb21d2a5329f3d1a06520240a..e0445e8cc342498140b67e5c5401f4b428a6c397 100644 (file)
@@ -2928,6 +2928,14 @@ static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev)
        amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE);
        amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE);
 
+       /*
+        * Per PMFW team's suggestion, driver needs to handle gfxoff
+        * and df cstate features disablement for gpu reset(e.g. Mode1Reset)
+        * scenario. Add the missing df cstate disablement here.
+        */
+       if (amdgpu_dpm_set_df_cstate(adev, DF_CSTATE_DISALLOW))
+               dev_warn(adev->dev, "Failed to disallow df cstate");
+
        for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
                if (!adev->ip_blocks[i].status.valid)
                        continue;
index 445005571f76f0824a5fbc2483b07c397c65c105..9cd005131f5661683e193f57bfc0dda66b2332e5 100644 (file)
@@ -2242,9 +2242,17 @@ static void arcturus_get_unique_id(struct smu_context *smu)
 static int arcturus_set_df_cstate(struct smu_context *smu,
                                  enum pp_df_cstate state)
 {
+       struct amdgpu_device *adev = smu->adev;
        uint32_t smu_version;
        int ret;
 
+       /*
+        * Arcturus does not need the cstate disablement
+        * prerequisite for gpu reset.
+        */
+       if (amdgpu_in_reset(adev) || adev->in_suspend)
+               return 0;
+
        ret = smu_cmn_get_smc_version(smu, NULL, &smu_version);
        if (ret) {
                dev_err(smu->adev->dev, "Failed to get smu version!\n");
index 619aee51b12381fb70a99432738b0dd8bd1942cd..d30ec3005ea191ad693a473d20921f1a46bdaf9d 100644 (file)
@@ -1640,6 +1640,15 @@ static bool aldebaran_is_baco_supported(struct smu_context *smu)
 static int aldebaran_set_df_cstate(struct smu_context *smu,
                                   enum pp_df_cstate state)
 {
+       struct amdgpu_device *adev = smu->adev;
+
+       /*
+        * Aldebaran does not need the cstate disablement
+        * prerequisite for gpu reset.
+        */
+       if (amdgpu_in_reset(adev) || adev->in_suspend)
+               return 0;
+
        return smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_DFCstateControl, state, NULL);
 }