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>
        int ret;
        int index;
        int timeout = 2000;
+       bool ras_intr = false;
 
        mutex_lock(&psp->mutex);
 
                 * 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);
         * 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);
 
 
 #include "amdgpu.h"
 #include "amdgpu_psp.h"
+#include "amdgpu_ras.h"
 #include "amdgpu_ucode.h"
 #include "soc15_common.h"
 #include "psp_v11_0.h"
        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;
 }