I have one additional suggestion, the amdgpu_gfx_ras_sw_init is declared twice in amdgpu_gfx.h file, it can be removed one in this patch. Regards, Stanley > -----Original Message----- > From: Zhang, Hawking <Hawking.Zhang@xxxxxxx> > Sent: Monday, March 6, 2023 10:32 AM > To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx; Zhou1, Tao <Tao.Zhou1@xxxxxxx>; > Yang, Stanley <Stanley.Yang@xxxxxxx>; Li, Candice <Candice.Li@xxxxxxx>; > Chai, Thomas <YiPeng.Chai@xxxxxxx> > Cc: Zhang, Hawking <Hawking.Zhang@xxxxxxx> > Subject: [PATCH 03/11] drm/amdgpu: Init gfx ras block when ras is supported > > Initialize gfx ras block only when gfx ip block supports ras features. > > Signed-off-by: Hawking Zhang <Hawking.Zhang@xxxxxxx> > --- > drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 9 ++++++--- > drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 9 ++++++--- > 2 files changed, 12 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c > b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c > index 3bf697a80cf2..d7d4847e2644 100644 > --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c > +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c > @@ -1409,9 +1409,12 @@ static int gfx_v11_0_sw_init(void *handle) > if (r) > return r; > > - if (amdgpu_gfx_ras_sw_init(adev)) { > - dev_err(adev->dev, "Failed to initialize gfx ras block!\n"); > - return -EINVAL; > + if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__GFX)) { > + r = amdgpu_gfx_ras_sw_init(adev); > + if (r) { > + dev_err(adev->dev, "Failed to initialize gfx ras > block!\n"); > + return r; > + } > } > > return 0; > diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c > b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c > index ae09fc1cfe6b..c9657e89d40e 100644 > --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c > +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c > @@ -2177,9 +2177,12 @@ static int gfx_v9_0_sw_init(void *handle) > if (r) > return r; > > - if (amdgpu_gfx_ras_sw_init(adev)) { > - dev_err(adev->dev, "Failed to initialize gfx ras block!\n"); > - return -EINVAL; > + if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__GFX)) { > + r = amdgpu_gfx_ras_sw_init(adev); > + if (r) { > + dev_err(adev->dev, "Failed to initialize gfx ras > block!\n"); > + return r; > + } > } > > return 0; > -- > 2.17.1