AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/amdgpu: Apply poison mode check to GFX IP only
@ 2023-07-03  8:55 Hawking Zhang
  2023-07-03  8:55 ` [PATCH 2/3] drm/amdgpu: Remove gfx v11_0_3 ras_late_init call Hawking Zhang
  2023-07-03  8:55 ` [PATCH 3/3] drm/amdgpu: Issue ras enable_feature for gfx ip only Hawking Zhang
  0 siblings, 2 replies; 4+ messages in thread
From: Hawking Zhang @ 2023-07-03  8:55 UTC (permalink / raw)
  To: amd-gfx, Tao Zhou, Stanley Yang, Thomas Chai, Candice Li; +Cc: Hawking Zhang

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.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 041112c7fbbd..8524365761b6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] drm/amdgpu: Remove gfx v11_0_3 ras_late_init call
  2023-07-03  8:55 [PATCH 1/3] drm/amdgpu: Apply poison mode check to GFX IP only Hawking Zhang
@ 2023-07-03  8:55 ` Hawking Zhang
  2023-07-03  8:55 ` [PATCH 3/3] drm/amdgpu: Issue ras enable_feature for gfx ip only Hawking Zhang
  1 sibling, 0 replies; 4+ messages in thread
From: Hawking Zhang @ 2023-07-03  8:55 UTC (permalink / raw)
  To: amd-gfx, Tao Zhou, Stanley Yang, Thomas Chai, Candice Li; +Cc: Hawking Zhang

amdgpu_ras_late_init will invoke ras_late_init call
per IP block

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 26 --------------------------
 1 file changed, 26 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
index 3a7af59e83ca..66d38890d393 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
@@ -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;
 }
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] drm/amdgpu: Issue ras enable_feature for gfx ip only
  2023-07-03  8:55 [PATCH 1/3] drm/amdgpu: Apply poison mode check to GFX IP only Hawking Zhang
  2023-07-03  8:55 ` [PATCH 2/3] drm/amdgpu: Remove gfx v11_0_3 ras_late_init call Hawking Zhang
@ 2023-07-03  8:55 ` Hawking Zhang
  2023-07-04  4:00   ` Zhou1, Tao
  1 sibling, 1 reply; 4+ messages in thread
From: Hawking Zhang @ 2023-07-03  8:55 UTC (permalink / raw)
  To: amd-gfx, Tao Zhou, Stanley Yang, Thomas Chai, Candice Li; +Cc: 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

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 30 +++++++++----------------
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 8524365761b6..2e9154bbec64 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -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",
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH 3/3] drm/amdgpu: Issue ras enable_feature for gfx ip only
  2023-07-03  8:55 ` [PATCH 3/3] drm/amdgpu: Issue ras enable_feature for gfx ip only Hawking Zhang
@ 2023-07-04  4:00   ` Zhou1, Tao
  0 siblings, 0 replies; 4+ messages in thread
From: Zhou1, Tao @ 2023-07-04  4:00 UTC (permalink / raw)
  To: Zhang, Hawking, amd-gfx@lists.freedesktop.org, Yang, Stanley,
	Chai, Thomas, Li, Candice

[AMD Official Use Only - General]

The series is:

Reviewed-by: Tao Zhou <tao.zhou1@amd.com>

> -----Original Message-----
> From: Zhang, Hawking <Hawking.Zhang@amd.com>
> Sent: Monday, July 3, 2023 4:56 PM
> To: amd-gfx@lists.freedesktop.org; Zhou1, Tao <Tao.Zhou1@amd.com>; Yang,
> Stanley <Stanley.Yang@amd.com>; Chai, Thomas <YiPeng.Chai@amd.com>; Li,
> Candice <Candice.Li@amd.com>
> Cc: Zhang, Hawking <Hawking.Zhang@amd.com>
> 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
>
> Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 30 +++++++++----------------
>  1 file changed, 10 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> index 8524365761b6..2e9154bbec64 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> @@ -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",
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-04  4:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-03  8:55 [PATCH 1/3] drm/amdgpu: Apply poison mode check to GFX IP only Hawking Zhang
2023-07-03  8:55 ` [PATCH 2/3] drm/amdgpu: Remove gfx v11_0_3 ras_late_init call Hawking Zhang
2023-07-03  8:55 ` [PATCH 3/3] drm/amdgpu: Issue ras enable_feature for gfx ip only Hawking Zhang
2023-07-04  4:00   ` Zhou1, Tao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox