drm/amdgpu: resolve failed error inject msg
authorJohn Clements <john.clements@amd.com>
Wed, 11 Mar 2020 03:51:02 +0000 (11:51 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 13 Mar 2020 15:52:33 +0000 (11:52 -0400)
invoking an error injection successfully will cause an at_event intterrupt that

will occur before the invoke sequence can complete causing an invalid error

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
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c

index 6d9b05e21f973213a3d93151acf614efcbba10a6..be50867ea644fe655913a705aad9cdfbbc8d4763 100644 (file)
@@ -200,6 +200,7 @@ psp_cmd_submit_buf(struct psp_context *psp,
        int ret;
        int index;
        int timeout = 2000;
+       bool ras_intr = false;
 
        mutex_lock(&psp->mutex);
 
@@ -224,7 +225,8 @@ psp_cmd_submit_buf(struct psp_context *psp,
                 * because gpu reset thread triggered and lock resource should
                 * be released for psp resume sequence.
                 */
-               if (amdgpu_ras_intr_triggered())
+               ras_intr = amdgpu_ras_intr_triggered();
+               if (ras_intr)
                        break;
                msleep(1);
                amdgpu_asic_invalidate_hdp(psp->adev, NULL);
@@ -237,7 +239,7 @@ psp_cmd_submit_buf(struct psp_context *psp,
         * during psp initialization to avoid breaking hw_init and it doesn't
         * return -EINVAL.
         */
-       if (psp->cmd_buf_mem->resp.status || !timeout) {
+       if ((psp->cmd_buf_mem->resp.status || !timeout) && !ras_intr) {
                if (ucode)
                        DRM_WARN("failed to load ucode id (%d) ",
                                  ucode->ucode_id);
index 67dd9d2d4b689c3dcc3b48735f11068b5ea14c6a..0afd610a1263faeb276de8ca284eeb4f1308e497 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "amdgpu.h"
 #include "amdgpu_psp.h"
+#include "amdgpu_ras.h"
 #include "amdgpu_ucode.h"
 #include "soc15_common.h"
 #include "psp_v11_0.h"
@@ -868,6 +869,11 @@ static int psp_v11_0_ras_trigger_error(struct psp_context *psp,
        if (ret)
                return -EINVAL;
 
+       /* If err_event_athub occurs error inject was successful, however
+          return status from TA is no long reliable */
+       if (amdgpu_ras_intr_triggered())
+               return 0;
+
        return ras_cmd->ras_status;
 }