drm/amdgpu: add status checking after fw is loaded
authorHuang Rui <ray.huang@amd.com>
Sun, 5 Aug 2018 04:45:35 +0000 (12:45 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 27 Aug 2018 16:11:03 +0000 (11:11 -0500)
The status field must be 0 after FW is loaded.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

index 58e20385eab5932c2ef86dac56645ee8a736437d..bd397d2916fb7a739576b6ef8a4755f179a63315 100644 (file)
@@ -134,6 +134,13 @@ psp_cmd_submit_buf(struct psp_context *psp,
                msleep(1);
        }
 
+       /* the status field must be 0 after FW is loaded */
+       if (ucode && psp->cmd_buf_mem->resp.status) {
+               DRM_ERROR("failed loading with status (%d) and ucode id (%d)\n",
+                         psp->cmd_buf_mem->resp.status, ucode->ucode_id);
+               return -EINVAL;
+       }
+
        if (ucode) {
                ucode->tmr_mc_addr_lo = psp->cmd_buf_mem->resp.fw_addr_lo;
                ucode->tmr_mc_addr_hi = psp->cmd_buf_mem->resp.fw_addr_hi;