drm/amdgpu: reorganize RAS injection flow
authorTao Zhou <tao.zhou1@amd.com>
Mon, 13 Mar 2023 08:24:11 +0000 (16:24 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 9 Jun 2023 14:37:13 +0000 (10:37 -0400)
So GFX RAS injection could use default function if it doesn't define its
own injection interface.

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

index 7ae08f1..b7d8250 100644 (file)
@@ -1123,16 +1123,15 @@ int amdgpu_ras_error_inject(struct amdgpu_device *adev,
                                                          block_info.address);
        }
 
-       if (info->head.block == AMDGPU_RAS_BLOCK__GFX) {
-               if (block_obj->hw_ops->ras_error_inject)
+       if (block_obj->hw_ops->ras_error_inject) {
+               if (info->head.block == AMDGPU_RAS_BLOCK__GFX)
                        ret = block_obj->hw_ops->ras_error_inject(adev, info, info->instance_mask);
-       } else {
-               /* If defined special ras_error_inject(e.g: xgmi), implement special ras_error_inject */
-               if (block_obj->hw_ops->ras_error_inject)
+               else /* Special ras_error_inject is defined (e.g: xgmi) */
                        ret = block_obj->hw_ops->ras_error_inject(adev, &block_info,
                                                info->instance_mask);
-               else  /*If not defined .ras_error_inject, use default ras_error_inject*/
-                       ret = psp_ras_trigger_error(&adev->psp, &block_info, info->instance_mask);
+       } else {
+               /* default path */
+               ret = psp_ras_trigger_error(&adev->psp, &block_info, info->instance_mask);
        }
 
        if (ret)