drm/amdgpu: Optimize gfx ras block initialization code for gfx v9_0
authorYiPeng Chai <YiPeng.Chai@amd.com>
Wed, 11 Jan 2023 02:40:14 +0000 (10:40 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 17 Jan 2023 21:11:52 +0000 (16:11 -0500)
  Use gfx ras common initialization interface to
initialize gfx ras block.

V2:
  Update function call due to amdgpu_gfx_ras_sw_init
interface changes.

Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

index d4b0fa4..8ad5c03 100644 (file)
@@ -1936,27 +1936,6 @@ static int gfx_v9_0_gpu_early_init(struct amdgpu_device *adev)
                break;
        }
 
-       if (adev->gfx.ras) {
-               err = amdgpu_ras_register_ras_block(adev, &adev->gfx.ras->ras_block);
-               if (err) {
-                       DRM_ERROR("Failed to register gfx ras block!\n");
-                       return err;
-               }
-
-               strcpy(adev->gfx.ras->ras_block.ras_comm.name, "gfx");
-               adev->gfx.ras->ras_block.ras_comm.block = AMDGPU_RAS_BLOCK__GFX;
-               adev->gfx.ras->ras_block.ras_comm.type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
-               adev->gfx.ras_if = &adev->gfx.ras->ras_block.ras_comm;
-
-               /* If not define special ras_late_init function, use gfx default ras_late_init */
-               if (!adev->gfx.ras->ras_block.ras_late_init)
-                       adev->gfx.ras->ras_block.ras_late_init = amdgpu_gfx_ras_late_init;
-
-               /* If not defined special ras_cb function, use default ras_cb */
-               if (!adev->gfx.ras->ras_block.ras_cb)
-                       adev->gfx.ras->ras_block.ras_cb = amdgpu_gfx_process_ras_data_cb;
-       }
-
        adev->gfx.config.gb_addr_config = gb_addr_config;
 
        adev->gfx.config.gb_addr_config_fields.num_pipes = 1 <<
@@ -2198,6 +2177,11 @@ 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;
+       }
+
        return 0;
 }