drm/i915/uc: correctly track uc_fw init failure

The FAILURE state of uc_fw currently implies that the fw is loadable
(i.e init completed), so we can't use it for init failures and instead
need a dedicated error code.

Note that this currently does not cause any issues because if we fail to
init any of the firmwares we abort the load, but better be accurate
anyway in case things change in the future.
Signed-off-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Reviewed-by: default avatarMatthew Brost <matthew.brost@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211211000756.1698923-2-daniele.ceraolospurio@intel.com
parent 63cb9da6
...@@ -164,6 +164,6 @@ int intel_guc_fw_upload(struct intel_guc *guc) ...@@ -164,6 +164,6 @@ int intel_guc_fw_upload(struct intel_guc *guc)
return 0; return 0;
out: out:
intel_uc_fw_change_status(&guc->fw, INTEL_UC_FIRMWARE_FAIL); intel_uc_fw_change_status(&guc->fw, INTEL_UC_FIRMWARE_LOAD_FAIL);
return ret; return ret;
} }
...@@ -199,7 +199,7 @@ int intel_huc_auth(struct intel_huc *huc) ...@@ -199,7 +199,7 @@ int intel_huc_auth(struct intel_huc *huc)
fail: fail:
i915_probe_error(gt->i915, "HuC: Authentication failed %d\n", ret); i915_probe_error(gt->i915, "HuC: Authentication failed %d\n", ret);
intel_uc_fw_change_status(&huc->fw, INTEL_UC_FIRMWARE_FAIL); intel_uc_fw_change_status(&huc->fw, INTEL_UC_FIRMWARE_LOAD_FAIL);
return ret; return ret;
} }
......
...@@ -573,7 +573,7 @@ int intel_uc_fw_upload(struct intel_uc_fw *uc_fw, u32 dst_offset, u32 dma_flags) ...@@ -573,7 +573,7 @@ int intel_uc_fw_upload(struct intel_uc_fw *uc_fw, u32 dst_offset, u32 dma_flags)
i915_probe_error(gt->i915, "Failed to load %s firmware %s (%d)\n", i915_probe_error(gt->i915, "Failed to load %s firmware %s (%d)\n",
intel_uc_fw_type_repr(uc_fw->type), uc_fw->path, intel_uc_fw_type_repr(uc_fw->type), uc_fw->path,
err); err);
intel_uc_fw_change_status(uc_fw, INTEL_UC_FIRMWARE_FAIL); intel_uc_fw_change_status(uc_fw, INTEL_UC_FIRMWARE_LOAD_FAIL);
return err; return err;
} }
...@@ -591,7 +591,7 @@ int intel_uc_fw_init(struct intel_uc_fw *uc_fw) ...@@ -591,7 +591,7 @@ int intel_uc_fw_init(struct intel_uc_fw *uc_fw)
if (err) { if (err) {
DRM_DEBUG_DRIVER("%s fw pin-pages err=%d\n", DRM_DEBUG_DRIVER("%s fw pin-pages err=%d\n",
intel_uc_fw_type_repr(uc_fw->type), err); intel_uc_fw_type_repr(uc_fw->type), err);
intel_uc_fw_change_status(uc_fw, INTEL_UC_FIRMWARE_FAIL); intel_uc_fw_change_status(uc_fw, INTEL_UC_FIRMWARE_INIT_FAIL);
} }
return err; return err;
......
...@@ -32,11 +32,12 @@ struct intel_gt; ...@@ -32,11 +32,12 @@ struct intel_gt;
* | | MISSING <--/ | \--> ERROR | * | | MISSING <--/ | \--> ERROR |
* | fetch | V | * | fetch | V |
* | | AVAILABLE | * | | AVAILABLE |
* +------------+- | -+ * +------------+- | \ -+
* | | | \--> INIT FAIL |
* | init | V | * | init | V |
* | | /------> LOADABLE <----<-----------\ | * | | /------> LOADABLE <----<-----------\ |
* +------------+- \ / \ \ \ -+ * +------------+- \ / \ \ \ -+
* | | FAIL <--< \--> TRANSFERRED \ | * | | LOAD FAIL <--< \--> TRANSFERRED \ |
* | upload | \ / \ / | * | upload | \ / \ / |
* | | \---------/ \--> RUNNING | * | | \---------/ \--> RUNNING |
* +------------+---------------------------------------------------+ * +------------+---------------------------------------------------+
...@@ -50,8 +51,9 @@ enum intel_uc_fw_status { ...@@ -50,8 +51,9 @@ enum intel_uc_fw_status {
INTEL_UC_FIRMWARE_MISSING, /* blob not found on the system */ INTEL_UC_FIRMWARE_MISSING, /* blob not found on the system */
INTEL_UC_FIRMWARE_ERROR, /* invalid format or version */ INTEL_UC_FIRMWARE_ERROR, /* invalid format or version */
INTEL_UC_FIRMWARE_AVAILABLE, /* blob found and copied in mem */ INTEL_UC_FIRMWARE_AVAILABLE, /* blob found and copied in mem */
INTEL_UC_FIRMWARE_INIT_FAIL, /* failed to prepare fw objects for load */
INTEL_UC_FIRMWARE_LOADABLE, /* all fw-required objects are ready */ INTEL_UC_FIRMWARE_LOADABLE, /* all fw-required objects are ready */
INTEL_UC_FIRMWARE_FAIL, /* failed to xfer or init/auth the fw */ INTEL_UC_FIRMWARE_LOAD_FAIL, /* failed to xfer or init/auth the fw */
INTEL_UC_FIRMWARE_TRANSFERRED, /* dma xfer done */ INTEL_UC_FIRMWARE_TRANSFERRED, /* dma xfer done */
INTEL_UC_FIRMWARE_RUNNING /* init/auth done */ INTEL_UC_FIRMWARE_RUNNING /* init/auth done */
}; };
...@@ -130,10 +132,12 @@ const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status) ...@@ -130,10 +132,12 @@ const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status)
return "ERROR"; return "ERROR";
case INTEL_UC_FIRMWARE_AVAILABLE: case INTEL_UC_FIRMWARE_AVAILABLE:
return "AVAILABLE"; return "AVAILABLE";
case INTEL_UC_FIRMWARE_INIT_FAIL:
return "INIT FAIL";
case INTEL_UC_FIRMWARE_LOADABLE: case INTEL_UC_FIRMWARE_LOADABLE:
return "LOADABLE"; return "LOADABLE";
case INTEL_UC_FIRMWARE_FAIL: case INTEL_UC_FIRMWARE_LOAD_FAIL:
return "FAIL"; return "LOAD FAIL";
case INTEL_UC_FIRMWARE_TRANSFERRED: case INTEL_UC_FIRMWARE_TRANSFERRED:
return "TRANSFERRED"; return "TRANSFERRED";
case INTEL_UC_FIRMWARE_RUNNING: case INTEL_UC_FIRMWARE_RUNNING:
...@@ -155,7 +159,8 @@ static inline int intel_uc_fw_status_to_error(enum intel_uc_fw_status status) ...@@ -155,7 +159,8 @@ static inline int intel_uc_fw_status_to_error(enum intel_uc_fw_status status)
return -ENOENT; return -ENOENT;
case INTEL_UC_FIRMWARE_ERROR: case INTEL_UC_FIRMWARE_ERROR:
return -ENOEXEC; return -ENOEXEC;
case INTEL_UC_FIRMWARE_FAIL: case INTEL_UC_FIRMWARE_INIT_FAIL:
case INTEL_UC_FIRMWARE_LOAD_FAIL:
return -EIO; return -EIO;
case INTEL_UC_FIRMWARE_SELECTED: case INTEL_UC_FIRMWARE_SELECTED:
return -ESTALE; return -ESTALE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment