[PATCH 9/9] drm/amdgpu/powerplay/vega120: only use PrepareMp1ForUnload for mode1 reset

Alex Deucher alexdeucher at gmail.com
Wed Jul 24 05:00:12 UTC 2019


Use PrepareMp1ForUnload for mode1 reset and PrepareMp1ForShutdown for
baco reset.

Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 .../gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
index e16d6654692f..c3d2b32f0b66 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
@@ -3756,6 +3756,7 @@ static int vega20_disable_dpm_tasks(struct pp_hwmgr *hwmgr)
 static int vega20_power_off_asic(struct pp_hwmgr *hwmgr)
 {
 	struct vega20_hwmgr *data = (struct vega20_hwmgr *)(hwmgr->backend);
+	struct amdgpu_device *adev = hwmgr->adev;
 	int result;
 
 	result = vega20_disable_dpm_tasks(hwmgr);
@@ -3764,10 +3765,19 @@ static int vega20_power_off_asic(struct pp_hwmgr *hwmgr)
 			);
 	data->water_marks_bitmap &= ~(WaterMarksLoaded);
 
-	PP_ASSERT_WITH_CODE((result = smum_send_msg_to_smc(hwmgr,
-			PPSMC_MSG_PrepareMp1ForUnload)) == 0,
-			"[PrepareMp1ForUnload] Failed!",
-			return result);
+	if (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_MODE1) {
+		PP_ASSERT_WITH_CODE((result =
+				     smum_send_msg_to_smc(hwmgr,
+							  PPSMC_MSG_PrepareMp1ForUnload)) == 0,
+				    "[PrepareMp1ForUnload] Failed!",
+				    return result);
+	} else {
+		PP_ASSERT_WITH_CODE((result =
+				     smum_send_msg_to_smc(hwmgr,
+							  PPSMC_MSG_PrepareMp1ForShutdown)) == 0,
+				    "[PrepareMp1ForUnload] Failed!",
+				    return result);
+	}
 
 	return result;
 }
-- 
2.20.1



More information about the amd-gfx mailing list