Skip to contentSkip to conversation

drm/amdgpu: Apply poison mode check to GFX IP only

PATCH In review Hawking Zhang 2 participants 4 messages Jul 3, 2023 – Jul 4, 2023

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

PATCH 1/3 drm/amdgpu: Apply poison mode check to GFX IP only

For GFX IP that only supports poison consumption, GFX RAS won't be marked as enabled. i.e., hardware doesn't support gfx sram ecc. But driver still needs to issue firmware to enable poison consumption mode for GFX IP. In such case, check poison mode and treat GFX IP as RAS capable IP block.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -0
index 041112c7fbbd..8524365761b6 100644
@@ -3150,6 +3150,7 @@ int amdgpu_ras_is_supported(struct amdgpu_device *adev,
 	 * that the ras block supports ras function.
 	 */
 	if (!ret &&
+	    block == AMDGPU_RAS_BLOCK__GFX &&
 	    amdgpu_ras_is_poison_mode_supported(adev) &&
 	    amdgpu_ras_get_ras_block(adev, block, 0))
 		ret = 1;
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/3 drm/amdgpu: Remove gfx v11_0_3 ras_late_init call

amdgpu_ras_late_init will invoke ras_late_init call per IP block

---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 26 --------------------------
 1 file changed, 26 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -26
index 3a7af59e83ca..66d38890d393 100644
@@ -4650,26 +4650,6 @@ static int gfx_v11_0_early_init(void *handle)
 	return gfx_v11_0_init_microcode(adev);
 }
 
-static int gfx_v11_0_ras_late_init(void *handle)
-{
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-	struct ras_common_if *gfx_common_if;
-	int ret;
-
-	gfx_common_if = kzalloc(sizeof(struct ras_common_if), GFP_KERNEL);
-	if (!gfx_common_if)
-		return -ENOMEM;
-
-	gfx_common_if->block = AMDGPU_RAS_BLOCK__GFX;
-
-	ret = amdgpu_ras_feature_enable(adev, gfx_common_if, true);
-	if (ret)
-		dev_warn(adev->dev, "Failed to enable gfx11 ras feature\n");
-
-	kfree(gfx_common_if);
-	return 0;
-}
-
 static int gfx_v11_0_late_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -4683,12 +4663,6 @@ static int gfx_v11_0_late_init(void *handle)
 	if (r)
 		return r;
 
-	if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(11, 0, 3)) {
-		r = gfx_v11_0_ras_late_init(handle);
-		if (r)
-			return r;
-	}
-
 	return 0;
 }
 
Signature · 1 line
2.17.1
#2 lore raw

PATCH 3/3 drm/amdgpu: Issue ras enable_feature for gfx ip only

In reply to Hawking Zhang

For non-GFX IP blocks, set up ras obj if ras feature is allowed. For GFX IP blocks, force issue ras enable_feature command to firmware and only set up ras obj if ras feature is allowed

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 30 +++++++++----------------
 1 file changed, 10 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +10 -20
index 8524365761b6..2e9154bbec64 100644
@@ -761,16 +761,6 @@ static int __amdgpu_ras_feature_enable(struct amdgpu_device *adev,
 	return 0;
 }
 
-static int amdgpu_ras_check_feature_allowed(struct amdgpu_device *adev,
-		struct ras_common_if *head)
-{
-	if (amdgpu_ras_is_feature_allowed(adev, head) ||
-		amdgpu_ras_is_poison_mode_supported(adev))
-		return 1;
-	else
-		return 0;
-}
-
 /* wrapper of psp_ras_enable_features */
 int amdgpu_ras_feature_enable(struct amdgpu_device *adev,
 		struct ras_common_if *head, bool enable)
@@ -782,7 +772,16 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev,
 	if (!con)
 		return -EINVAL;
 
-	if (head->block == AMDGPU_RAS_BLOCK__GFX) {
+	/* Do not enable ras feature if it is not allowed */
+	if (enable &&
+	    head->block != AMDGPU_RAS_BLOCK__GFX &&
+	    !amdgpu_ras_is_feature_allowed(adev, head))
+		goto out;
+
+	/* Only enable gfx ras feature from host side */
+	if (head->block == AMDGPU_RAS_BLOCK__GFX &&
+	    !amdgpu_sriov_vf(adev) &&
+	    !amdgpu_ras_intr_triggered()) {
 		info = kzalloc(sizeof(union ta_ras_cmd_input), GFP_KERNEL);
 		if (!info)
 			return -ENOMEM;
@@ -798,16 +797,7 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev,
 				.error_type = amdgpu_ras_error_to_ta(head->type),
 			};
 		}
-	}
 
-	/* Do not enable if it is not allowed. */
-	if (enable && !amdgpu_ras_check_feature_allowed(adev, head))
-		goto out;
-
-	/* Only enable ras feature operation handle on host side */
-	if (head->block == AMDGPU_RAS_BLOCK__GFX &&
-		!amdgpu_sriov_vf(adev) &&
-		!amdgpu_ras_intr_triggered()) {
 		ret = psp_ras_enable_features(&adev->psp, info, enable);
 		if (ret) {
 			dev_err(adev->dev, "ras %s %s failed poison:%d ret:%d\n",
Signature · 1 line
2.17.1
Reviewed-by on v1 3/3
#3 lore raw

RE: [PATCH 3/3] drm/amdgpu: Issue ras enable_feature for gfx ip only

[AMD Official Use Only - General]

The series is:

Quoted 81 lines

-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: Monday, July 3, 2023 4:56 PM
To: [email protected]; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>; Chai, Thomas <[email protected]>; Li, Candice <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: Issue ras enable_feature for gfx ip only

For non-GFX IP blocks, set up ras obj if ras feature is allowed. For GFX IP blocks, force issue ras enable_feature command to firmware and only set up ras obj if ras feature is allowed

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 30 +++++++++----------------
 1 file changed, 10 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0 -10
index 8524365761b6..2e9154bbec64 100644
@@ -761,16 +761,6 @@ static int __amdgpu_ras_feature_enable(struct
 amdgpu_device *adev,
      return 0;
 }
 
-static int amdgpu_ras_check_feature_allowed(struct amdgpu_device *adev,
-             struct ras_common_if *head)
-{
-     if (amdgpu_ras_is_feature_allowed(adev, head) ||
-             amdgpu_ras_is_poison_mode_supported(adev))
-             return 1;
-     else
-             return 0;
-}
-
 /* wrapper of psp_ras_enable_features */  int
 amdgpu_ras_feature_enable(struct amdgpu_device *adev,
              struct ras_common_if *head, bool enable) @@ -782,7 +772,16
@@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev,
      if (!con)
              return -EINVAL;
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +10 -10
-     if (head->block == AMDGPU_RAS_BLOCK__GFX) {
+     /* Do not enable ras feature if it is not allowed */
+     if (enable &&
+         head->block != AMDGPU_RAS_BLOCK__GFX &&
+         !amdgpu_ras_is_feature_allowed(adev, head))
+             goto out;
+
+     /* Only enable gfx ras feature from host side */
+     if (head->block == AMDGPU_RAS_BLOCK__GFX &&
+         !amdgpu_sriov_vf(adev) &&
+         !amdgpu_ras_intr_triggered()) {
              info = kzalloc(sizeof(union ta_ras_cmd_input), GFP_KERNEL);
              if (!info)
                      return -ENOMEM;
@@ -798,16 +797,7 @@ int amdgpu_ras_feature_enable(struct amdgpu_device
 *adev,
                              .error_type = amdgpu_ras_error_to_ta(head-
 >type),
                      };
              }
-     }
 
-     /* Do not enable if it is not allowed. */
-     if (enable && !amdgpu_ras_check_feature_allowed(adev, head))
-             goto out;
-
-     /* Only enable ras feature operation handle on host side */
-     if (head->block == AMDGPU_RAS_BLOCK__GFX &&
-             !amdgpu_sriov_vf(adev) &&
-             !amdgpu_ras_intr_triggered()) {
              ret = psp_ras_enable_features(&adev->psp, info, enable);
              if (ret) {
                      dev_err(adev->dev, "ras %s %s failed poison:%d

ret:%d\n",
--
2.17.1