FAILED: Patch "Revert "drm/amd/pm: fix the high voltage and temperature issue"" failed to apply to 6.8-stable tree

2024-03-27 Thread Sasha Levin
The patch below does not apply to the 6.8-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to .

Thanks,
Sasha

-- original commit in Linus's tree --

>From 7055c5856aa10a7f2d687557c50751a72080e4c8 Mon Sep 17 00:00:00 2001
From: Mario Limonciello 
Date: Fri, 19 Jan 2024 03:08:37 -0600
Subject: [PATCH] Revert "drm/amd/pm: fix the high voltage and temperature
 issue"

This reverts commit 5f38ac54e60562323ea4abb1bfb37d043ee23357.
This causes issues with rebooting and the 7800XT.

Cc: Kenneth Feng 
Cc: sta...@vger.kernel.org
Fixes: 5f38ac54e605 ("drm/amd/pm: fix the high voltage and temperature issue")
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3062
Signed-off-by: Mario Limonciello 
Acked-by: Alex Deucher 
Signed-off-by: Alex Deucher 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c| 24 --
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 33 ++-
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  1 -
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  |  8 +
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  |  8 +
 5 files changed, 11 insertions(+), 63 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 2df14f0e79d80..1a04ccba9542a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -4140,23 +4140,13 @@ int amdgpu_device_init(struct amdgpu_device *adev,
}
}
} else {
-   switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {
-   case IP_VERSION(13, 0, 0):
-   case IP_VERSION(13, 0, 7):
-   case IP_VERSION(13, 0, 10):
-   r = psp_gpu_reset(adev);
-   break;
-   default:
-   tmp = amdgpu_reset_method;
-   /* It should do a default reset when loading or 
reloading the driver,
-* regardless of the module parameter 
reset_method.
-*/
-   amdgpu_reset_method = AMD_RESET_METHOD_NONE;
-   r = amdgpu_asic_reset(adev);
-   amdgpu_reset_method = tmp;
-   break;
-   }
-
+   tmp = amdgpu_reset_method;
+   /* It should do a default reset when loading or 
reloading the driver,
+* regardless of the module parameter reset_method.
+*/
+   amdgpu_reset_method = AMD_RESET_METHOD_NONE;
+   r = amdgpu_asic_reset(adev);
+   amdgpu_reset_method = tmp;
if (r) {
dev_err(adev->dev, "asic reset on init 
failed\n");
goto failed;
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c 
b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index a54663f2e2ab9..13223fbaf3faa 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -734,7 +734,7 @@ static int smu_early_init(void *handle)
smu->adev = adev;
smu->pm_enabled = !!amdgpu_dpm;
smu->is_apu = false;
-   smu->smu_baco.state = SMU_BACO_STATE_NONE;
+   smu->smu_baco.state = SMU_BACO_STATE_EXIT;
smu->smu_baco.platform_support = false;
smu->user_dpm_profile.fan_mode = -1;
 
@@ -1954,31 +1954,10 @@ static int smu_smc_hw_cleanup(struct smu_context *smu)
return 0;
 }
 
-static int smu_reset_mp1_state(struct smu_context *smu)
-{
-   struct amdgpu_device *adev = smu->adev;
-   int ret = 0;
-
-   if ((!adev->in_runpm) && (!adev->in_suspend) &&
-   (!amdgpu_in_reset(adev)))
-   switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {
-   case IP_VERSION(13, 0, 0):
-   case IP_VERSION(13, 0, 7):
-   case IP_VERSION(13, 0, 10):
-   ret = smu_set_mp1_state(smu, PP_MP1_STATE_UNLOAD);
-   break;
-   default:
-   break;
-   }
-
-   return ret;
-}
-
 static int smu_hw_fini(void *handle)
 {
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
struct smu_context *smu = adev->powerplay.pp_handle;
-   int ret;
 
if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev))
return 0;
@@ -1996,15 +1975,7 @@ static int smu_hw_fini(void *handle)
 
adev->pm.dpm_enabled = false;
 
-   ret = smu_smc_hw_cl

Re: [PATCH] Revert "drm/amd/pm: fix the high voltage and temperature issue"

2024-01-19 Thread Deucher, Alexander
[AMD Official Use Only - General]

Acked-by: Alex Deucher 

From: amd-gfx  on behalf of Mario 
Limonciello 
Sent: Friday, January 19, 2024 4:16 AM
To: amd-gfx@lists.freedesktop.org 
Cc: Feng, Kenneth ; Limonciello, Mario 
; sta...@vger.kernel.org 
Subject: [PATCH] Revert "drm/amd/pm: fix the high voltage and temperature issue"

This reverts commit 5f38ac54e60562323ea4abb1bfb37d043ee23357.
This causes issues with rebooting and the 7800XT.

Cc: Kenneth Feng 
Cc: sta...@vger.kernel.org
Fixes: 5f38ac54e605 ("drm/amd/pm: fix the high voltage and temperature issue")
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3062
Signed-off-by: Mario Limonciello 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c| 24 --
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 33 ++-
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  1 -
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  |  8 +
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  |  8 +
 5 files changed, 11 insertions(+), 63 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index b4c19e3d0bf1..56d9dfa61290 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -4131,23 +4131,13 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 }
 }
 } else {
-   switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {
-   case IP_VERSION(13, 0, 0):
-   case IP_VERSION(13, 0, 7):
-   case IP_VERSION(13, 0, 10):
-   r = psp_gpu_reset(adev);
-   break;
-   default:
-   tmp = amdgpu_reset_method;
-   /* It should do a default reset when loading or 
reloading the driver,
-* regardless of the module parameter 
reset_method.
-*/
-   amdgpu_reset_method = AMD_RESET_METHOD_NONE;
-   r = amdgpu_asic_reset(adev);
-   amdgpu_reset_method = tmp;
-   break;
-   }
-
+   tmp = amdgpu_reset_method;
+   /* It should do a default reset when loading or 
reloading the driver,
+* regardless of the module parameter reset_method.
+*/
+   amdgpu_reset_method = AMD_RESET_METHOD_NONE;
+   r = amdgpu_asic_reset(adev);
+   amdgpu_reset_method = tmp;
 if (r) {
 dev_err(adev->dev, "asic reset on init 
failed\n");
 goto failed;
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c 
b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index c16703868e5c..961cd2aaf137 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -733,7 +733,7 @@ static int smu_early_init(void *handle)
 smu->adev = adev;
 smu->pm_enabled = !!amdgpu_dpm;
 smu->is_apu = false;
-   smu->smu_baco.state = SMU_BACO_STATE_NONE;
+   smu->smu_baco.state = SMU_BACO_STATE_EXIT;
 smu->smu_baco.platform_support = false;
 smu->user_dpm_profile.fan_mode = -1;

@@ -1961,31 +1961,10 @@ static int smu_smc_hw_cleanup(struct smu_context *smu)
 return 0;
 }

-static int smu_reset_mp1_state(struct smu_context *smu)
-{
-   struct amdgpu_device *adev = smu->adev;
-   int ret = 0;
-
-   if ((!adev->in_runpm) && (!adev->in_suspend) &&
-   (!amdgpu_in_reset(adev)))
-   switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {
-   case IP_VERSION(13, 0, 0):
-   case IP_VERSION(13, 0, 7):
-   case IP_VERSION(13, 0, 10):
-   ret = smu_set_mp1_state(smu, PP_MP1_STATE_UNLOAD);
-   break;
-   default:
-   break;
-   }
-
-   return ret;
-}
-
 static int smu_hw_fini(void *handle)
 {
 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 struct smu_context *smu = adev->powerplay.pp_handle;
-   int ret;

 if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev))
 return 0;
@@ -2003,15 +1982,7 @@ static int smu_hw_fini(void *handle)

 adev->pm.dpm_enabled = false;

-   ret = smu_smc_hw_cleanup(smu);
-   if (ret)
-   return ret;
-
-   ret = smu_reset_mp1_state(smu);
-   if (ret)
-   return ret;
-
-   return 0;
+   return smu_smc_hw_cleanup(smu

[PATCH] Revert "drm/amd/pm: fix the high voltage and temperature issue"

2024-01-19 Thread Mario Limonciello
This reverts commit 5f38ac54e60562323ea4abb1bfb37d043ee23357.
This causes issues with rebooting and the 7800XT.

Cc: Kenneth Feng 
Cc: sta...@vger.kernel.org
Fixes: 5f38ac54e605 ("drm/amd/pm: fix the high voltage and temperature issue")
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3062
Signed-off-by: Mario Limonciello 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c| 24 --
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 33 ++-
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  1 -
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  |  8 +
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  |  8 +
 5 files changed, 11 insertions(+), 63 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index b4c19e3d0bf1..56d9dfa61290 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -4131,23 +4131,13 @@ int amdgpu_device_init(struct amdgpu_device *adev,
}
}
} else {
-   switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {
-   case IP_VERSION(13, 0, 0):
-   case IP_VERSION(13, 0, 7):
-   case IP_VERSION(13, 0, 10):
-   r = psp_gpu_reset(adev);
-   break;
-   default:
-   tmp = amdgpu_reset_method;
-   /* It should do a default reset when loading or 
reloading the driver,
-* regardless of the module parameter 
reset_method.
-*/
-   amdgpu_reset_method = AMD_RESET_METHOD_NONE;
-   r = amdgpu_asic_reset(adev);
-   amdgpu_reset_method = tmp;
-   break;
-   }
-
+   tmp = amdgpu_reset_method;
+   /* It should do a default reset when loading or 
reloading the driver,
+* regardless of the module parameter reset_method.
+*/
+   amdgpu_reset_method = AMD_RESET_METHOD_NONE;
+   r = amdgpu_asic_reset(adev);
+   amdgpu_reset_method = tmp;
if (r) {
dev_err(adev->dev, "asic reset on init 
failed\n");
goto failed;
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c 
b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index c16703868e5c..961cd2aaf137 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -733,7 +733,7 @@ static int smu_early_init(void *handle)
smu->adev = adev;
smu->pm_enabled = !!amdgpu_dpm;
smu->is_apu = false;
-   smu->smu_baco.state = SMU_BACO_STATE_NONE;
+   smu->smu_baco.state = SMU_BACO_STATE_EXIT;
smu->smu_baco.platform_support = false;
smu->user_dpm_profile.fan_mode = -1;
 
@@ -1961,31 +1961,10 @@ static int smu_smc_hw_cleanup(struct smu_context *smu)
return 0;
 }
 
-static int smu_reset_mp1_state(struct smu_context *smu)
-{
-   struct amdgpu_device *adev = smu->adev;
-   int ret = 0;
-
-   if ((!adev->in_runpm) && (!adev->in_suspend) &&
-   (!amdgpu_in_reset(adev)))
-   switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {
-   case IP_VERSION(13, 0, 0):
-   case IP_VERSION(13, 0, 7):
-   case IP_VERSION(13, 0, 10):
-   ret = smu_set_mp1_state(smu, PP_MP1_STATE_UNLOAD);
-   break;
-   default:
-   break;
-   }
-
-   return ret;
-}
-
 static int smu_hw_fini(void *handle)
 {
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
struct smu_context *smu = adev->powerplay.pp_handle;
-   int ret;
 
if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev))
return 0;
@@ -2003,15 +1982,7 @@ static int smu_hw_fini(void *handle)
 
adev->pm.dpm_enabled = false;
 
-   ret = smu_smc_hw_cleanup(smu);
-   if (ret)
-   return ret;
-
-   ret = smu_reset_mp1_state(smu);
-   if (ret)
-   return ret;
-
-   return 0;
+   return smu_smc_hw_cleanup(smu);
 }
 
 static void smu_late_fini(void *handle)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h 
b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
index 2aa4fea87314..66e84defd0b6 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
+++ b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
@@ -424,7 +424,6 @@ enum smu_reset_mode {
 enum smu_baco_state {
SMU_BACO_STATE_ENTER = 0,
SMU_BACO_STATE_EXIT,
-   SMU_BACO_STATE_NONE,
 };
 
 struct