<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#0000FF;margin:5pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[AMD Official Use Only - General]<br>
</p>
<br>
<div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; color: rgb(0, 0, 0);">Acked-by: Alex Deucher <alexander.deucher@amd.com></span></div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Mario Limonciello <mario.limonciello@amd.com><br>
<b>Sent:</b> Friday, January 19, 2024 4:16 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Feng, Kenneth <Kenneth.Feng@amd.com>; Limonciello, Mario <Mario.Limonciello@amd.com>; stable@vger.kernel.org <stable@vger.kernel.org><br>
<b>Subject:</b> [PATCH] Revert "drm/amd/pm: fix the high voltage and temperature issue"</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">This reverts commit 5f38ac54e60562323ea4abb1bfb37d043ee23357.<br>
This causes issues with rebooting and the 7800XT.<br>
<br>
Cc: Kenneth Feng <kenneth.feng@amd.com><br>
Cc: stable@vger.kernel.org<br>
Fixes: 5f38ac54e605 ("drm/amd/pm: fix the high voltage and temperature issue")<br>
Closes: <a href="https://gitlab.freedesktop.org/drm/amd/-/issues/3062">https://gitlab.freedesktop.org/drm/amd/-/issues/3062</a><br>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    | 24 ++++----------<br>
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     | 33 ++-----------------<br>
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  1 -<br>
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  |  8 +----<br>
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  |  8 +----<br>
 5 files changed, 11 insertions(+), 63 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
index b4c19e3d0bf1..56d9dfa61290 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
@@ -4131,23 +4131,13 @@ int amdgpu_device_init(struct amdgpu_device *adev,<br>
                                 }<br>
                         }<br>
                 } else {<br>
-                       switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {<br>
-                       case IP_VERSION(13, 0, 0):<br>
-                       case IP_VERSION(13, 0, 7):<br>
-                       case IP_VERSION(13, 0, 10):<br>
-                               r = psp_gpu_reset(adev);<br>
-                               break;<br>
-                       default:<br>
-                               tmp = amdgpu_reset_method;<br>
-                               /* It should do a default reset when loading or reloading the driver,<br>
-                                * regardless of the module parameter reset_method.<br>
-                                */<br>
-                               amdgpu_reset_method = AMD_RESET_METHOD_NONE;<br>
-                               r = amdgpu_asic_reset(adev);<br>
-                               amdgpu_reset_method = tmp;<br>
-                               break;<br>
-                       }<br>
-<br>
+                       tmp = amdgpu_reset_method;<br>
+                       /* It should do a default reset when loading or reloading the driver,<br>
+                        * regardless of the module parameter reset_method.<br>
+                        */<br>
+                       amdgpu_reset_method = AMD_RESET_METHOD_NONE;<br>
+                       r = amdgpu_asic_reset(adev);<br>
+                       amdgpu_reset_method = tmp;<br>
                         if (r) {<br>
                                 dev_err(adev->dev, "asic reset on init failed\n");<br>
                                 goto failed;<br>
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c<br>
index c16703868e5c..961cd2aaf137 100644<br>
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c<br>
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c<br>
@@ -733,7 +733,7 @@ static int smu_early_init(void *handle)<br>
         smu->adev = adev;<br>
         smu->pm_enabled = !!amdgpu_dpm;<br>
         smu->is_apu = false;<br>
-       smu->smu_baco.state = SMU_BACO_STATE_NONE;<br>
+       smu->smu_baco.state = SMU_BACO_STATE_EXIT;<br>
         smu->smu_baco.platform_support = false;<br>
         smu->user_dpm_profile.fan_mode = -1;<br>
 <br>
@@ -1961,31 +1961,10 @@ static int smu_smc_hw_cleanup(struct smu_context *smu)<br>
         return 0;<br>
 }<br>
 <br>
-static int smu_reset_mp1_state(struct smu_context *smu)<br>
-{<br>
-       struct amdgpu_device *adev = smu->adev;<br>
-       int ret = 0;<br>
-<br>
-       if ((!adev->in_runpm) && (!adev->in_suspend) &&<br>
-               (!amdgpu_in_reset(adev)))<br>
-               switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {<br>
-               case IP_VERSION(13, 0, 0):<br>
-               case IP_VERSION(13, 0, 7):<br>
-               case IP_VERSION(13, 0, 10):<br>
-                       ret = smu_set_mp1_state(smu, PP_MP1_STATE_UNLOAD);<br>
-                       break;<br>
-               default:<br>
-                       break;<br>
-               }<br>
-<br>
-       return ret;<br>
-}<br>
-<br>
 static int smu_hw_fini(void *handle)<br>
 {<br>
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;<br>
         struct smu_context *smu = adev->powerplay.pp_handle;<br>
-       int ret;<br>
 <br>
         if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev))<br>
                 return 0;<br>
@@ -2003,15 +1982,7 @@ static int smu_hw_fini(void *handle)<br>
 <br>
         adev->pm.dpm_enabled = false;<br>
 <br>
-       ret = smu_smc_hw_cleanup(smu);<br>
-       if (ret)<br>
-               return ret;<br>
-<br>
-       ret = smu_reset_mp1_state(smu);<br>
-       if (ret)<br>
-               return ret;<br>
-<br>
-       return 0;<br>
+       return smu_smc_hw_cleanup(smu);<br>
 }<br>
 <br>
 static void smu_late_fini(void *handle)<br>
diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h<br>
index 2aa4fea87314..66e84defd0b6 100644<br>
--- a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h<br>
+++ b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h<br>
@@ -424,7 +424,6 @@ enum smu_reset_mode {<br>
 enum smu_baco_state {<br>
         SMU_BACO_STATE_ENTER = 0,<br>
         SMU_BACO_STATE_EXIT,<br>
-       SMU_BACO_STATE_NONE,<br>
 };<br>
 <br>
 struct smu_baco_context {<br>
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c<br>
index 231122622a9c..bc8bd67c48ac 100644<br>
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c<br>
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c<br>
@@ -2748,13 +2748,7 @@ static int smu_v13_0_0_set_mp1_state(struct smu_context *smu,<br>
 <br>
         switch (mp1_state) {<br>
         case PP_MP1_STATE_UNLOAD:<br>
-               ret = smu_cmn_send_smc_msg_with_param(smu,<br>
-                                                                                         SMU_MSG_PrepareMp1ForUnload,<br>
-                                                                                         0x55, NULL);<br>
-<br>
-               if (!ret && smu->smu_baco.state == SMU_BACO_STATE_EXIT)<br>
-                       ret = smu_v13_0_disable_pmfw_state(smu);<br>
-<br>
+               ret = smu_cmn_set_mp1_state(smu, mp1_state);<br>
                 break;<br>
         default:<br>
                 /* Ignore others */<br>
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c<br>
index 59606a19e3d2..0906221231ea 100644<br>
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c<br>
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c<br>
@@ -2504,13 +2504,7 @@ static int smu_v13_0_7_set_mp1_state(struct smu_context *smu,<br>
 <br>
         switch (mp1_state) {<br>
         case PP_MP1_STATE_UNLOAD:<br>
-               ret = smu_cmn_send_smc_msg_with_param(smu,<br>
-                                                                                         SMU_MSG_PrepareMp1ForUnload,<br>
-                                                                                         0x55, NULL);<br>
-<br>
-               if (!ret && smu->smu_baco.state == SMU_BACO_STATE_EXIT)<br>
-                       ret = smu_v13_0_disable_pmfw_state(smu);<br>
-<br>
+               ret = smu_cmn_set_mp1_state(smu, mp1_state);<br>
                 break;<br>
         default:<br>
                 /* Ignore others */<br>
-- <br>
2.34.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>