Skip to contentSkip to conversation

drm/amd/pm: only send GmiPwrDnControl msg on master die (v2)

PATCH In review Tao Zhou 2 participants 3 messages Jan 11, 2022

Subsystems (3)
lore
Share & tools
lore

Tao Zhou

author
#0 lore raw

PATCH 1/1 drm/amd/pm: only send GmiPwrDnControl msg on master die (v2)

PMFW only returns 0 on master die and sends NACK back on other dies for the message.

v2: only send GmiPwrDnControl msg on master die instead of all dies.

---
 .../drm/amd/pm/swsmu/smu13/aldebaran_ppt.c    | 25 ++++++++++++++++---
 1 file changed, 21 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +21 -4
index 261892977654..3fe5c05ced77 100644
@@ -1625,10 +1625,27 @@ static int aldebaran_set_df_cstate(struct smu_context *smu,
 
 static int aldebaran_allow_xgmi_power_down(struct smu_context *smu, bool en)
 {
-	return smu_cmn_send_smc_msg_with_param(smu,
-					       SMU_MSG_GmiPwrDnControl,
-					       en ? 0 : 1,
-					       NULL);
+	struct amdgpu_device *adev = smu->adev;
+
+	/* The message only works on master die and NACK will be sent
+	   back for other dies, only send it on master die */
+	if (adev->smuio.funcs &&
+	    adev->smuio.funcs->get_socket_id &&
+	    adev->smuio.funcs->get_die_id) {
+		if (!adev->smuio.funcs->get_socket_id(adev) &&
+		    !adev->smuio.funcs->get_die_id(adev))
+			return smu_cmn_send_smc_msg_with_param(smu,
+					   SMU_MSG_GmiPwrDnControl,
+					   en ? 0 : 1,
+					   NULL);
+		else
+			return 0;
+	}
+	else
+		return smu_cmn_send_smc_msg_with_param(smu,
+					   SMU_MSG_GmiPwrDnControl,
+					   en ? 0 : 1,
+					   NULL);
 }
 
 static const struct throttling_logging_label {
Signature · 1 line
2.17.1
#1 lore raw
Quoted 30 lines · Tao Zhou

PMFW only returns 0 on master die and sends NACK back on other dies for the message.

v2: only send GmiPwrDnControl msg on master die instead of all dies.

---
  .../drm/amd/pm/swsmu/smu13/aldebaran_ppt.c    | 25 ++++++++++++++++---
  1 file changed, 21 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +7 -4
index 261892977654..3fe5c05ced77 100644
@@ -1625,10 +1625,27 @@ static int aldebaran_set_df_cstate(struct smu_context *smu,
 
  static int aldebaran_allow_xgmi_power_down(struct smu_context *smu, bool en)
  {
-	return smu_cmn_send_smc_msg_with_param(smu,
-					       SMU_MSG_GmiPwrDnControl,
-					       en ? 0 : 1,
-					       NULL);
+	struct amdgpu_device *adev = smu->adev;
+
+	/* The message only works on master die and NACK will be sent
+	   back for other dies, only send it on master die */
+	if (adev->smuio.funcs &&
+	    adev->smuio.funcs->get_socket_id &&
+	    adev->smuio.funcs->get_die_id) {

drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static int aldebaran_set_df_cstate(struct smu_context *smu, · line 1644

Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +10 -0
+		if (!adev->smuio.funcs->get_socket_id(adev) &&
+		    !adev->smuio.funcs->get_die_id(adev))
+			return smu_cmn_send_smc_msg_with_param(smu,
+					   SMU_MSG_GmiPwrDnControl,
+					   en ? 0 : 1,
+					   NULL);
+		else
+			return 0;
+	}
+	else

The else part can be dropped. We always expect smuio functions to be present in aldebaran.

Thanks,
Lijo

Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +4 -0
+		return smu_cmn_send_smc_msg_with_param(smu,
+					   SMU_MSG_GmiPwrDnControl,
+					   en ? 0 : 1,
+					   NULL);
  }
 
  static const struct throttling_logging_label {
author
#2 lore raw

[AMD Official Use Only]

Quoted 58 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, January 11, 2022 3:00 PM
To: Zhou1, Tao <[email protected]>; [email protected]; Zhang, Hawking <[email protected]>; Quan, Evan <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: only send GmiPwrDnControl msg on master die (v2)

Quoted 8 lines · Tao Zhou

PMFW only returns 0 on master die and sends NACK back on other dies for the message.

v2: only send GmiPwrDnControl msg on master die instead of all dies.

---
  .../drm/amd/pm/swsmu/smu13/aldebaran_ppt.c    | 25 ++++++++++++++++--

-

drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static int aldebaran_set_df_cstate(struct · line 1627

Quoted 11 lines
  1 file changed, 21 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0 -0
index 261892977654..3fe5c05ced77 100644
@@ -1625,10 +1625,27 @@ static int aldebaran_set_df_cstate(struct
 smu_context *smu,
 
  static int aldebaran_allow_xgmi_power_down(struct smu_context *smu,

bool en)

Quoted 12 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +7 -4
  {
-	return smu_cmn_send_smc_msg_with_param(smu,
-					       SMU_MSG_GmiPwrDnControl,
-					       en ? 0 : 1,
-					       NULL);
+	struct amdgpu_device *adev = smu->adev;
+
+	/* The message only works on master die and NACK will be sent
+	   back for other dies, only send it on master die */
+	if (adev->smuio.funcs &&
+	    adev->smuio.funcs->get_socket_id &&
+	    adev->smuio.funcs->get_die_id) {

drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static int aldebaran_set_df_cstate(struct smu_context *smu, · line 1644

Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +10 -0
+		if (!adev->smuio.funcs->get_socket_id(adev) &&
+		    !adev->smuio.funcs->get_die_id(adev))
+			return smu_cmn_send_smc_msg_with_param(smu,
+					   SMU_MSG_GmiPwrDnControl,
+					   en ? 0 : 1,
+					   NULL);
+		else
+			return 0;
+	}
+	else

The else part can be dropped. We always expect smuio functions to be present in aldebaran.

Quoted 2 lines

Thanks,
Lijo

[Tao] OK, I'll also remove the pointer check for get_socket_id and get_die_id.

Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +4 -0
+		return smu_cmn_send_smc_msg_with_param(smu,
+					   SMU_MSG_GmiPwrDnControl,
+					   en ? 0 : 1,
+					   NULL);
  }
 
  static const struct throttling_logging_label {