Skip to contentSkip to conversation

drm/amdgpu/sdma4.4.2: add apu support in sdma queue reset

PATCH In review [email protected] 3 participants 5 messages Dec 16, 2024 – Dec 17, 2024

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

PATCH 1/3 drm/amdgpu/sdma4.4.2: add apu support in sdma queue reset

From: "[email protected]" <[email protected]>

Remove apu check in sdma queue reset.

---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +1 -1
index 5e1cb1c2c0f8..e39f1f495ea8 100644
@@ -1600,7 +1600,7 @@ static int sdma_v4_4_2_reset_queue(struct amdgpu_ring *ring, unsigned int vmid)
 	int i, r;
 	u32 inst_mask;
 
-	if ((adev->flags & AMD_IS_APU) || amdgpu_sriov_vf(adev))
+	if (amdgpu_sriov_vf(adev))
 		return -EINVAL;
 
 	/* stop queue */
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/3 drm/amdgpu/pm: add PPSMC_MSG_ResetSDMA2 definition

add the PPSMC_MSG_ResetSDMA2 definition for smu 13.0.6

---
 drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_6_ppsmc.h | 1 +
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h                 | 3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c         | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_6_ppsmc.h +1 -0
index 147bfb12fd75..7b65a27fb302 100644
@@ -93,6 +93,7 @@
 #define PPSMC_MSG_SelectPLPDMode                    0x40
 #define PPSMC_MSG_RmaDueToBadPageThreshold          0x43
 #define PPSMC_MSG_SelectPstatePolicy                0x44
+#define PPSMC_MSG_ResetSDMA2                        0x45
 #define PPSMC_MSG_ResetSDMA                         0x4D
 #define PPSMC_Message_Count                         0x4E
 
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +2 -1
index e4cd6a0d13da..b0dab9797c70 100644
@@ -276,7 +276,8 @@
 	__SMU_DUMMY_MAP(SelectPstatePolicy), \
 	__SMU_DUMMY_MAP(MALLPowerController), \
 	__SMU_DUMMY_MAP(MALLPowerState), \
-	__SMU_DUMMY_MAP(ResetSDMA),
+	__SMU_DUMMY_MAP(ResetSDMA), \
+	__SMU_DUMMY_MAP(ResetSDMA2),
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)	SMU_MSG_##type
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +1 -0
index 5b86df0c8536..9222e7a777a6 100644
@@ -194,6 +194,7 @@ static const struct cmn2asic_msg_mapping smu_v13_0_6_message_map[SMU_MSG_MAX_COU
 	MSG_MAP(RmaDueToBadPageThreshold,            PPSMC_MSG_RmaDueToBadPageThreshold,        0),
 	MSG_MAP(SelectPstatePolicy,                  PPSMC_MSG_SelectPstatePolicy,              0),
 	MSG_MAP(ResetSDMA,                           PPSMC_MSG_ResetSDMA,                       0),
+	MSG_MAP(ResetSDMA2,                          PPSMC_MSG_ResetSDMA2,                      0),
 };
 
 // clang-format on
Signature · 1 line
2.25.1
#2 lore raw

PATCH 3/3 drm/amdgpu/pm: Implement SDMA queue reset for different asic

In reply to [email protected]

Implement sdma queue reset by SMU_MSG_ResetSDMA2

---
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c  | 30 ++++++++++++++-----
 1 file changed, 22 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +22 -8
index 9222e7a777a6..446959145058 100644
@@ -2721,17 +2721,31 @@ static int smu_v13_0_6_send_rma_reason(struct smu_context *smu)
 
 static int smu_v13_0_6_reset_sdma(struct smu_context *smu, uint32_t inst_mask)
 {
-	struct amdgpu_device *adev = smu->adev;
+	uint32_t smu_program;
 	int ret = 0;
 
-	/* the message is only valid on SMU 13.0.6 with pmfw 85.121.00 and above */
-	if ((adev->flags & AMD_IS_APU) ||
-	    amdgpu_ip_version(adev, MP1_HWIP, 0) != IP_VERSION(13, 0, 6) ||
-	    smu->smc_fw_version < 0x00557900)
-		return 0;
+	smu_program = (smu->smc_fw_version >> 24) & 0xff;
+	switch (amdgpu_ip_version(smu->adev, MP1_HWIP, 0)) {
+	case IP_VERSION(13, 0, 6):
+		if (((smu_program == 7) && (smu->smc_fw_version > 0x07550763)) ||
+			((smu_program == 0) && (smu->smc_fw_version > 0x00557700)))
+			ret = smu_cmn_send_smc_msg_with_param(smu,
+				SMU_MSG_ResetSDMA, inst_mask, NULL);
+		else if ((smu_program == 4) &&
+			(smu->smc_fw_version > 0x4556e6c))
+			ret = smu_cmn_send_smc_msg_with_param(smu,
+				      SMU_MSG_ResetSDMA2, inst_mask, NULL);
+		break;
+	case IP_VERSION(13, 0, 14):
+		if ((smu_program == 5) &&
+			(smu->smc_fw_version > 0x05550f00))
+			ret = smu_cmn_send_smc_msg_with_param(smu,
+				      SMU_MSG_ResetSDMA2, inst_mask, NULL);
+		break;
+	default:
+		break;
+	}
 
-	ret = smu_cmn_send_smc_msg_with_param(smu,
-					      SMU_MSG_ResetSDMA, inst_mask, NULL);
 	if (ret)
 		dev_err(smu->adev->dev,
 			"failed to send ResetSDMA event with mask 0x%x\n",
Signature · 1 line
2.25.1
Acked-by on v1 3/3
#3 lore raw

Re: [PATCH 3/3] drm/amdgpu/pm: Implement SDMA queue reset for different asic

Quoted 5 lines · On Mon, Dec 16, 2024 at 4:30 AM [email protected] <[email protected]> wrote:

Implement sdma queue reset by SMU_MSG_ResetSDMA2

Series is:

Quoted 51 lines
---
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c  | 30 ++++++++++++++-----
 1 file changed, 22 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +22 -9
index 9222e7a777a6..446959145058 100644
@@ -2721,17 +2721,31 @@ static int smu_v13_0_6_send_rma_reason(struct smu_context *smu)
 
 static int smu_v13_0_6_reset_sdma(struct smu_context *smu, uint32_t inst_mask)
 {
-       struct amdgpu_device *adev = smu->adev;
+       uint32_t smu_program;
        int ret = 0;
 
-       /* the message is only valid on SMU 13.0.6 with pmfw 85.121.00 and above */
-       if ((adev->flags & AMD_IS_APU) ||
-           amdgpu_ip_version(adev, MP1_HWIP, 0) != IP_VERSION(13, 0, 6) ||
-           smu->smc_fw_version < 0x00557900)
-               return 0;
+       smu_program = (smu->smc_fw_version >> 24) & 0xff;
+       switch (amdgpu_ip_version(smu->adev, MP1_HWIP, 0)) {
+       case IP_VERSION(13, 0, 6):
+               if (((smu_program == 7) && (smu->smc_fw_version > 0x07550763)) ||
+                       ((smu_program == 0) && (smu->smc_fw_version > 0x00557700)))
+                       ret = smu_cmn_send_smc_msg_with_param(smu,
+                               SMU_MSG_ResetSDMA, inst_mask, NULL);
+               else if ((smu_program == 4) &&
+                       (smu->smc_fw_version > 0x4556e6c))
+                       ret = smu_cmn_send_smc_msg_with_param(smu,
+                                     SMU_MSG_ResetSDMA2, inst_mask, NULL);
+               break;
+       case IP_VERSION(13, 0, 14):
+               if ((smu_program == 5) &&
+                       (smu->smc_fw_version > 0x05550f00))
+                       ret = smu_cmn_send_smc_msg_with_param(smu,
+                                     SMU_MSG_ResetSDMA2, inst_mask, NULL);
+               break;
+       default:
+               break;
+       }
 
-       ret = smu_cmn_send_smc_msg_with_param(smu,
-                                             SMU_MSG_ResetSDMA, inst_mask, NULL);
        if (ret)
                dev_err(smu->adev->dev,
                        "failed to send ResetSDMA event with mask 0x%x\n",
--

2.25.1

Reviewed-by Tim Huang on v1 3/3
#4 lore raw

Re: [PATCH 3/3] drm/amdgpu/pm: Implement SDMA queue reset for different asic

In reply to [email protected]

[AMD Official Use Only - AMD Internal Distribution Only]

Looks ok to me. This Series is,

________________________________
From: [email protected] <[email protected]>
Sent: Monday, December 16, 2024 5:29:56 PM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhu, Jiadong <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Huang, Tim <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu/pm: Implement SDMA queue reset for different asic

Implement sdma queue reset by SMU_MSG_ResetSDMA2

---
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c  | 30 ++++++++++++++-----
 1 file changed, 22 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +22 -8
index 9222e7a777a6..446959145058 100644
@@ -2721,17 +2721,31 @@ static int smu_v13_0_6_send_rma_reason(struct smu_context *smu)
 
 static int smu_v13_0_6_reset_sdma(struct smu_context *smu, uint32_t inst_mask)
 {
-       struct amdgpu_device *adev = smu->adev;
+       uint32_t smu_program;
         int ret = 0;
 
-       /* the message is only valid on SMU 13.0.6 with pmfw 85.121.00 and above */
-       if ((adev->flags & AMD_IS_APU) ||
-           amdgpu_ip_version(adev, MP1_HWIP, 0) != IP_VERSION(13, 0, 6) ||
-           smu->smc_fw_version < 0x00557900)
-               return 0;
+       smu_program = (smu->smc_fw_version >> 24) & 0xff;
+       switch (amdgpu_ip_version(smu->adev, MP1_HWIP, 0)) {
+       case IP_VERSION(13, 0, 6):
+               if (((smu_program == 7) && (smu->smc_fw_version > 0x07550763)) ||
+                       ((smu_program == 0) && (smu->smc_fw_version > 0x00557700)))
+                       ret = smu_cmn_send_smc_msg_with_param(smu,
+                               SMU_MSG_ResetSDMA, inst_mask, NULL);
+               else if ((smu_program == 4) &&
+                       (smu->smc_fw_version > 0x4556e6c))
+                       ret = smu_cmn_send_smc_msg_with_param(smu,
+                                     SMU_MSG_ResetSDMA2, inst_mask, NULL);
+               break;
+       case IP_VERSION(13, 0, 14):
+               if ((smu_program == 5) &&
+                       (smu->smc_fw_version > 0x05550f00))
+                       ret = smu_cmn_send_smc_msg_with_param(smu,
+                                     SMU_MSG_ResetSDMA2, inst_mask, NULL);
+               break;
+       default:
+               break;
+       }
 
-       ret = smu_cmn_send_smc_msg_with_param(smu,
-                                             SMU_MSG_ResetSDMA, inst_mask, NULL);
         if (ret)
                 dev_err(smu->adev->dev,
                         "failed to send ResetSDMA event with mask 0x%x\n",

--
2.25.1