OSDN Git Service

drm/amdgpu: centralize checking for RAS TA status
authorTao Zhou <tao.zhou1@amd.com>
Fri, 15 Oct 2021 08:57:43 +0000 (16:57 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 19 Oct 2021 21:32:52 +0000 (17:32 -0400)
Create new function to check status returned by RAS TA.

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

index 88274c2..bcf9598 100644 (file)
@@ -1292,6 +1292,25 @@ static int psp_ras_unload(struct psp_context *psp)
        return psp_ta_unload(psp, &psp->ras_context.context);
 }
 
+static void psp_ras_ta_check_status(struct psp_context *psp)
+{
+       struct ta_ras_shared_memory *ras_cmd =
+               (struct ta_ras_shared_memory *)psp->ras_context.context.mem_context.shared_buf;
+
+       switch (ras_cmd->ras_status) {
+       case TA_RAS_STATUS__ERROR_UNSUPPORTED_IP:
+               dev_warn(psp->adev->dev,
+                               "RAS WARNING: cmd failed due to unsupported ip\n");
+               break;
+       case TA_RAS_STATUS__SUCCESS:
+               break;
+       default:
+               dev_warn(psp->adev->dev,
+                               "RAS WARNING: ras status = 0x%X\n", ras_cmd->ras_status);
+               break;
+       }
+}
+
 int psp_ras_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
 {
        struct ta_ras_shared_memory *ras_cmd;
@@ -1326,10 +1345,7 @@ int psp_ras_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
                        dev_warn(psp->adev->dev,
                                 "RAS internal register access blocked\n");
 
-               if (ras_cmd->ras_status == TA_RAS_STATUS__ERROR_UNSUPPORTED_IP)
-                   dev_warn(psp->adev->dev, "RAS WARNING: cmd failed due to unsupported ip\n");
-               else if (ras_cmd->ras_status)
-                   dev_warn(psp->adev->dev, "RAS WARNING: ras status = 0x%X\n", ras_cmd->ras_status);
+               psp_ras_ta_check_status(psp);
        }
 
        return ret;