[PATCH] drm/amdgpu: fix AMDGPU_RAS_BLOCK__DF check

Zhang, Hawking Hawking.Zhang at amd.com
Wed Mar 29 05:31:25 UTC 2023


[AMD Official Use Only - General]

Reviewed-by: Hawking Zhang <Hawking.Zhang at amd.com>

Regards,
Hawking
-----Original Message-----
From: Dan Carpenter <error27 at gmail.com> 
Sent: Wednesday, March 29, 2023 13:28
To: Zhang, Hawking <Hawking.Zhang at amd.com>
Cc: Koenig, Christian <Christian.Koenig at amd.com>; Pan, Xinhui <Xinhui.Pan at amd.com>; David Airlie <airlied at gmail.com>; Daniel Vetter <daniel at ffwll.ch>; Zhang, Hawking <Hawking.Zhang at amd.com>; Zhou1, Tao <Tao.Zhou1 at amd.com>; Yang, Stanley <Stanley.Yang at amd.com>; Chai, Thomas <YiPeng.Chai at amd.com>; Zhao, Victor <Victor.Zhao at amd.com>; Li, Candice <Candice.Li at amd.com>; amd-gfx at lists.freedesktop.org; kernel-janitors at vger.kernel.org
Subject: [PATCH] drm/amdgpu: fix AMDGPU_RAS_BLOCK__DF check

There is a mixup where AMDGPU_RAS_BLOCK__DF is used as a mask instead of a shifter.  It means that this condition will be true for AMDGPU_RAS_BLOCK__MMHUB instead of for AMDGPU_RAS_BLOCK__DF.

Fixes: b6f512168478 ("drm/amdgpu: Add fatal error handling in nbio v4_3")
Signed-off-by: Dan Carpenter <error27 at gmail.com>
---
>From static analysis.  Not tested at all.

 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index fac45f98145d..4069bce9479f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -2564,7 +2564,7 @@ int amdgpu_ras_init(struct amdgpu_device *adev)
 			adev->nbio.ras = &nbio_v7_4_ras;
 		break;
 	case IP_VERSION(4, 3, 0):
-		if (adev->ras_hw_enabled & AMDGPU_RAS_BLOCK__DF)
+		if (adev->ras_hw_enabled & (1 << AMDGPU_RAS_BLOCK__DF))
 			/* unlike other generation of nbio ras,
 			 * nbio v4_3 only support fatal error interrupt
 			 * to inform software that DF is freezed due to
--
2.39.1


More information about the amd-gfx mailing list