Skip to contentSkip to conversation

drm/amd/pm: check specific index for aldebaran

PATCH In review Jesse Zhang 3 participants 4 messages May 14, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 drm/amd/pm: check specific index for aldebaran

To avoid warning problems, drop index and
use PPSMC_MSG_GfxDriverReset instead of index for aldebaran.

---
 drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +7 -6
index a22eb6bbb05e..d671314c46c8 100644
@@ -1880,17 +1880,18 @@ static int aldebaran_mode1_reset(struct smu_context *smu)
 
 static int aldebaran_mode2_reset(struct smu_context *smu)
 {
-	int ret = 0, index;
+	int ret = 0;
 	struct amdgpu_device *adev = smu->adev;
 	int timeout = 10;
 
-	index = smu_cmn_to_asic_specific_index(smu, CMN2ASIC_MAPPING_MSG,
-						SMU_MSG_GfxDeviceDriverReset);
-	if (index < 0 )
-		return -EINVAL;
 	mutex_lock(&smu->message_lock);
 	if (smu->smc_fw_version >= 0x00441400) {
-		ret = smu_cmn_send_msg_without_waiting(smu, (uint16_t)index, SMU_RESET_MODE_2);
+		ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_GfxDeviceDriverReset,
+								SMU_RESET_MODE_2, NULL);
+		if (ret) {
+			dev_err(smu->adev->dev, "Failed to mode2 reset!\n");
+			goto out;
+		}
 		/* This is similar to FLR, wait till max FLR timeout */
 		msleep(100);
 		dev_dbg(smu->adev->dev, "restore config space...\n");
Signature · 1 line
2.25.1
#1 lore raw
Quoted 20 lines · Jesse Zhang

To avoid warning problems, drop index and
use PPSMC_MSG_GfxDriverReset instead of index for aldebaran.

---
 drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1 -1
index a22eb6bbb05e..d671314c46c8 100644
@@ -1880,17 +1880,18 @@ static int aldebaran_mode1_reset(struct smu_context *smu)
 
 static int aldebaran_mode2_reset(struct smu_context *smu)
 {
-	int ret = 0, index;
+	int ret = 0;
 	struct amdgpu_device *adev = smu->adev;

drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static int aldebaran_mode1_reset(struct smu_context *smu) · line 1889

Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1 -5
 	int timeout = 10;
 
-	index = smu_cmn_to_asic_specific_index(smu, CMN2ASIC_MAPPING_MSG,
-						SMU_MSG_GfxDeviceDriverReset);
-	if (index < 0 )
-		return -EINVAL;
 	mutex_lock(&smu->message_lock);
 	if (smu->smc_fw_version >= 0x00441400) {
-		ret = smu_cmn_send_msg_without_waiting(smu, (uint16_t)index, SMU_RESET_MODE_2);
+		ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_GfxDeviceDriverReset,

PPSMC_MSG_GfxDriverReset is different from SMU_MSG_GfxDeviceDriverReset. Use PPSMC_MSG_GfxDriverReset here (for both patches).

Thanks,
Lijo

Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +5 -0
+								SMU_RESET_MODE_2, NULL);
+		if (ret) {
+			dev_err(smu->adev->dev, "Failed to mode2 reset!\n");
+			goto out;
+		}
 		/* This is similar to FLR, wait till max FLR timeout */
 		msleep(100);
 		dev_dbg(smu->adev->dev, "restore config space...\n");
#2 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Tuesday, May 14, 2024 2:07 PM
To: Zhang, Jesse(Jie) <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>
Subject: Re: [PATCH 2/2] drm/amd/pm: check specific index for aldebaran

Quoted 22 lines · Jesse Zhang

To avoid warning problems, drop index and use PPSMC_MSG_GfxDriverReset instead of index for aldebaran.

---
 drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1 -1
index a22eb6bbb05e..d671314c46c8 100644
@@ -1880,17 +1880,18 @@ static int aldebaran_mode1_reset(struct
 smu_context *smu)
 
 static int aldebaran_mode2_reset(struct smu_context *smu)  {
-     int ret = 0, index;
+     int ret = 0;
      struct amdgpu_device *adev = smu->adev;
      int timeout = 10;

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

Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +2 -5
 
-     index = smu_cmn_to_asic_specific_index(smu, CMN2ASIC_MAPPING_MSG,
-                                             SMU_MSG_GfxDeviceDriverReset);
-     if (index < 0 )
-             return -EINVAL;
      mutex_lock(&smu->message_lock);
      if (smu->smc_fw_version >= 0x00441400) {
-             ret = smu_cmn_send_msg_without_waiting(smu, (uint16_t)index, SMU_RESET_MODE_2);
+             ret = smu_cmn_send_smc_msg_with_param(smu,
+SMU_MSG_GfxDeviceDriverReset,

PPSMC_MSG_GfxDriverReset is different from SMU_MSG_GfxDeviceDriverReset. Use PPSMC_MSG_GfxDriverReset here (for both patches).

Thanks,
Lijo

[Kevin]:

There is no interface here to directly use PPSMC_MSG_XXX to send messages to smu/pmfw in the swSMU driver, and it is not recommended to do so to maintain code consistency.

Best Regards,
Kevin

Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +5 -0
+                                                             SMU_RESET_MODE_2, NULL);
+             if (ret) {
+                     dev_err(smu->adev->dev, "Failed to mode2 reset!\n");
+                     goto out;
+             }
              /* This is similar to FLR, wait till max FLR timeout */
              msleep(100);
              dev_dbg(smu->adev->dev, "restore config space...\n");
#3 lore raw
Quoted 48 lines · Yang(Kevin)

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Tuesday, May 14, 2024 2:07 PM
To: Zhang, Jesse(Jie) <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>
Subject: Re: [PATCH 2/2] drm/amd/pm: check specific index for aldebaran

Quoted 22 lines · Jesse Zhang

To avoid warning problems, drop index and use PPSMC_MSG_GfxDriverReset instead of index for aldebaran.

---
 drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1 -1
index a22eb6bbb05e..d671314c46c8 100644
@@ -1880,17 +1880,18 @@ static int aldebaran_mode1_reset(struct
 smu_context *smu)
 
 static int aldebaran_mode2_reset(struct smu_context *smu)  {
-     int ret = 0, index;
+     int ret = 0;
      struct amdgpu_device *adev = smu->adev;
      int timeout = 10;

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

Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +2 -5
 
-     index = smu_cmn_to_asic_specific_index(smu, CMN2ASIC_MAPPING_MSG,
-                                             SMU_MSG_GfxDeviceDriverReset);
-     if (index < 0 )
-             return -EINVAL;
      mutex_lock(&smu->message_lock);
      if (smu->smc_fw_version >= 0x00441400) {
-             ret = smu_cmn_send_msg_without_waiting(smu, (uint16_t)index, SMU_RESET_MODE_2);
+             ret = smu_cmn_send_smc_msg_with_param(smu,
+SMU_MSG_GfxDeviceDriverReset,

PPSMC_MSG_GfxDriverReset is different from SMU_MSG_GfxDeviceDriverReset. Use PPSMC_MSG_GfxDriverReset here (for both patches).

Quoted 8 lines

Thanks,
Lijo

[Kevin]:

There is no interface here to directly use PPSMC_MSG_XXX to send messages to smu/pmfw in the swSMU driver, and it is not recommended to do so to maintain code consistency.

Thanks, didn't notice earlier that smu_cmn_send_msg_without_waiting got changed as well with this patch. This API is a direct interface.

Please note not to change anything else other than what is specifically requested in review comment. The original comment was only to replace index with PPSMC_MSG_GfxDriverReset. Please stick to that, otherwise it will break the entire sequence.

Thanks,
Lijo

Quoted 11 lines

Best Regards,
Kevin

Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +5 -0
+                                                             SMU_RESET_MODE_2, NULL);
+             if (ret) {
+                     dev_err(smu->adev->dev, "Failed to mode2 reset!\n");
+                     goto out;
+             }
              /* This is similar to FLR, wait till max FLR timeout */
              msleep(100);
              dev_dbg(smu->adev->dev, "restore config space...\n");