drm/amdgpu: Update RAS init handling
authorJohn Clements <john.clements@amd.com>
Fri, 11 Sep 2020 06:26:13 +0000 (14:26 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 15 Sep 2020 21:52:39 +0000 (17:52 -0400)
Output RAS init status

If RAS init fails, teardown RAS context

Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: John Clements <john.clements@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

index a7771aa..9782fbc 100644 (file)
@@ -935,6 +935,7 @@ static int psp_ras_load(struct psp_context *psp)
 {
        int ret;
        struct psp_gfx_cmd_resp *cmd;
+       struct ta_ras_shared_memory *ras_cmd;
 
        /*
         * TODO: bypass the loading in sriov for now
@@ -958,11 +959,20 @@ static int psp_ras_load(struct psp_context *psp)
        ret = psp_cmd_submit_buf(psp, NULL, cmd,
                        psp->fence_buf_mc_addr);
 
+       ras_cmd = (struct ta_ras_shared_memory*)psp->ras.ras_shared_buf;
+
        if (!ret) {
-               psp->ras.ras_initialized = true;
                psp->ras.session_id = cmd->resp.session_id;
+
+               if (!ras_cmd->ras_status)
+                       psp->ras.ras_initialized = true;
+               else
+                       dev_warn(psp->adev->dev, "RAS Init Status: 0x%X\n", ras_cmd->ras_status);
        }
 
+       if (ret || ras_cmd->ras_status)
+               amdgpu_ras_fini(psp->adev);
+
        kfree(cmd);
 
        return ret;