Skip to contentSkip to conversation

drm/amdgpu: revise the mode2 reset for vangogh

PATCH In review Huang Rui 2 participants 2 messages Dec 23, 2020

Subsystems (3)
lore
Share & tools
lore

Huang Rui

author
#0 lore raw

PATCH 1/1 drm/amdgpu: revise the mode2 reset for vangogh

PCIE MMIO bar needs to be restored firstly after the reset event triggers. So it's unable to access the registers to wait for response from SMU. Becasue the value of mmMP1_SMN_C2PMSG_90 is invalid at that moment.

---
 .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 22 +++++++++-
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c        | 42 ++++++++++---------
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h        |  2 +
 3 files changed, 46 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +21 -1
index 49864efdeffe..93328eaec0da 100644
@@ -888,9 +888,29 @@ static int vangogh_set_fine_grain_gfx_freq_parameters(struct smu_context *smu)
 	return 0;
 }
 
+static int vangogh_mode_reset(struct smu_context *smu, int type)
+{
+	int ret = 0, index = 0;
+
+	index = smu_cmn_to_asic_specific_index(smu, CMN2ASIC_MAPPING_MSG,
+					       SMU_MSG_GfxDeviceDriverReset);
+	if (index < 0)
+		return index == -EACCES ? 0 : index;
+
+	mutex_lock(&smu->message_lock);
+
+	ret = smu_cmn_send_msg_without_waiting(smu, (uint16_t)index, type);
+
+	mutex_unlock(&smu->message_lock);
+
+	mdelay(10);
+
+	return ret;
+}
+
 static int vangogh_mode2_reset(struct smu_context *smu)
 {
-	return smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_GfxDeviceDriverReset, SMU_RESET_MODE_2, NULL);
+	return vangogh_mode_reset(smu, SMU_RESET_MODE_2);
 }
 
 static const struct pptable_funcs vangogh_ppt_funcs = {
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +23 -19

61 lines not on this page · raw message

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +2 -0
index 01e825d83d8d..08ccf2d3257c 100644
@@ -26,6 +26,8 @@
 #include "amdgpu_smu.h"
 
 #if defined(SWSMU_CODE_LAYER_L2) || defined(SWSMU_CODE_LAYER_L3) || defined(SWSMU_CODE_LAYER_L4)
+int smu_cmn_send_msg_without_waiting(struct smu_context *smu,
+				     uint16_t msg, uint32_t param);
 int smu_cmn_send_smc_msg_with_param(struct smu_context *smu,
 				    enum smu_message_type msg,
 				    uint32_t param,
Signature · 6 lines
2.25.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Acked-by on v1 1/1
#1 lore raw

[AMD Official Use Only - Internal Distribution Only]

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Huang Rui
Sent: Wednesday, December 23, 2020 10:08 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Su, Jinzhou (Joe) <[email protected]>; Huang, Ray <[email protected]>
Subject: [PATCH] drm/amdgpu: revise the mode2 reset for vangogh

PCIE MMIO bar needs to be restored firstly after the reset event triggers. So it's unable to access the registers to wait for response from SMU. Becasue the value of mmMP1_SMN_C2PMSG_90 is invalid at that moment.

---
 .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 22 +++++++++-
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c        | 42 ++++++++++---------
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h        |  2 +
 3 files changed, 46 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +21 -1
index 49864efdeffe..93328eaec0da 100644
@@ -888,9 +888,29 @@ static int vangogh_set_fine_grain_gfx_freq_parameters(struct smu_context *smu)
 return 0;
 }
 
+static int vangogh_mode_reset(struct smu_context *smu, int type)
+{
+int ret = 0, index = 0;
+
+index = smu_cmn_to_asic_specific_index(smu, CMN2ASIC_MAPPING_MSG,
+       SMU_MSG_GfxDeviceDriverReset);
+if (index < 0)
+return index == -EACCES ? 0 : index;
+
+mutex_lock(&smu->message_lock);
+
+ret = smu_cmn_send_msg_without_waiting(smu, (uint16_t)index, type);
+
+mutex_unlock(&smu->message_lock);
+
+mdelay(10);
+
+return ret;
+}
+
 static int vangogh_mode2_reset(struct smu_context *smu)
 {
-return smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_GfxDeviceDriverReset, SMU_RESET_MODE_2, NULL);
+return vangogh_mode_reset(smu, SMU_RESET_MODE_2);
 }
 
 static const struct pptable_funcs vangogh_ppt_funcs = {
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +23 -19

61 lines not on this page · raw message

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +2 -0
index 01e825d83d8d..08ccf2d3257c 100644
@@ -26,6 +26,8 @@
 #include "amdgpu_smu.h"
 
 #if defined(SWSMU_CODE_LAYER_L2) || defined(SWSMU_CODE_LAYER_L3) || defined(SWSMU_CODE_LAYER_L4)
+int smu_cmn_send_msg_without_waiting(struct smu_context *smu,
+     uint16_t msg, uint32_t param);
 int smu_cmn_send_smc_msg_with_param(struct smu_context *smu,
     enum smu_message_type msg,
     uint32_t param,

--
2.25.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cevan.quan%40amd.com%7C7f292c1025234e6c2d2b08d8a6e7a3d5%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637442861103766873%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=6qYjw519hhNI77EiaBSgDskyt%2BOoHyoD9KOQW6on0aw%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx