]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/uc: correctly track uc_fw init failure
authorDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Sat, 11 Dec 2021 00:07:54 +0000 (16:07 -0800)
committerDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Mon, 13 Dec 2021 19:37:47 +0000 (11:37 -0800)
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: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211211000756.1698923-2-daniele.ceraolospurio@intel.com
drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c
drivers/gpu/drm/i915/gt/uc/intel_huc.c
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h

index 196424be0998c1cc93b32fe799239ac0ac649edb..796483a41353d897fa321c35bf23ae3de2f66c53 100644 (file)
@@ -164,6 +164,6 @@ int intel_guc_fw_upload(struct intel_guc *guc)
        return 0;
 
 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;
 }
index ff4b6869b80bf182f668a06d84bbca7fa641e776..c10736dddfb48b89e3d6565d78d1b634179b63e5 100644 (file)
@@ -199,7 +199,7 @@ int intel_huc_auth(struct intel_huc *huc)
 
 fail:
        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;
 }
 
index a7788ce507361cd176f53f355b5523e824a02bc5..2520743a84341532ec2c0077533a4c3ef7585039 100644 (file)
@@ -573,7 +573,7 @@ fail:
        i915_probe_error(gt->i915, "Failed to load %s firmware %s (%d)\n",
                         intel_uc_fw_type_repr(uc_fw->type), uc_fw->path,
                         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;
 }
 
@@ -591,7 +591,7 @@ int intel_uc_fw_init(struct intel_uc_fw *uc_fw)
        if (err) {
                DRM_DEBUG_DRIVER("%s fw pin-pages err=%d\n",
                                 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;
index 1e00bf65639e77c020b48ba6a525ba8896c1c175..fd17abf2ab02fe7f4ec23dc7e40c61291947b34f 100644 (file)
@@ -32,11 +32,12 @@ struct intel_gt;
  * |            |    MISSING <--/    |    \--> ERROR                |
  * |   fetch    |                    V                              |
  * |            |                 AVAILABLE                         |
- * +------------+-                   |                             -+
+ * +------------+-                   |   \                         -+
+ * |            |                    |    \--> INIT FAIL            |
  * |   init     |                    V                              |
  * |            |        /------> LOADABLE <----<-----------\       |
  * +------------+-       \         /    \        \           \     -+
- * |            |         FAIL <--<      \--> TRANSFERRED     \     |
+ * |            |    LOAD FAIL <--<      \--> TRANSFERRED     \     |
  * |   upload   |                  \           /   \          /     |
  * |            |                   \---------/     \--> RUNNING    |
  * +------------+---------------------------------------------------+
@@ -50,8 +51,9 @@ enum intel_uc_fw_status {
        INTEL_UC_FIRMWARE_MISSING, /* blob not found on the system */
        INTEL_UC_FIRMWARE_ERROR, /* invalid format or version */
        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_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_RUNNING /* init/auth done */
 };
@@ -130,10 +132,12 @@ const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status)
                return "ERROR";
        case INTEL_UC_FIRMWARE_AVAILABLE:
                return "AVAILABLE";
+       case INTEL_UC_FIRMWARE_INIT_FAIL:
+               return "INIT FAIL";
        case INTEL_UC_FIRMWARE_LOADABLE:
                return "LOADABLE";
-       case INTEL_UC_FIRMWARE_FAIL:
-               return "FAIL";
+       case INTEL_UC_FIRMWARE_LOAD_FAIL:
+               return "LOAD FAIL";
        case INTEL_UC_FIRMWARE_TRANSFERRED:
                return "TRANSFERRED";
        case INTEL_UC_FIRMWARE_RUNNING:
@@ -155,7 +159,8 @@ static inline int intel_uc_fw_status_to_error(enum intel_uc_fw_status status)
                return -ENOENT;
        case INTEL_UC_FIRMWARE_ERROR:
                return -ENOEXEC;
-       case INTEL_UC_FIRMWARE_FAIL:
+       case INTEL_UC_FIRMWARE_INIT_FAIL:
+       case INTEL_UC_FIRMWARE_LOAD_FAIL:
                return -EIO;
        case INTEL_UC_FIRMWARE_SELECTED:
                return -ESTALE;