drm/i915/uc: correctly track uc_fw init failure
authorjsg <jsg@openbsd.org>
Fri, 22 Jul 2022 06:13:09 +0000 (06:13 +0000)
committerjsg <jsg@openbsd.org>
Fri, 22 Jul 2022 06:13:09 +0000 (06:13 +0000)
From Daniele Ceraolo Spurio
60d1bb301ea5a4be3e1071d3d0c179140b270ef8 in linux 5.15.y/5.15.56
35d4efec103e1afde968cfc9305f00f9aceb19cc in mainline linux

sys/dev/pci/drm/i915/gt/uc/intel_guc_fw.c
sys/dev/pci/drm/i915/gt/uc/intel_huc.c
sys/dev/pci/drm/i915/gt/uc/intel_uc_fw.c
sys/dev/pci/drm/i915/gt/uc/intel_uc_fw.h

index 76fe766..bb951b8 100644 (file)
@@ -159,6 +159,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 fc5387b..9ee22ac 100644 (file)
@@ -191,7 +191,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 614308f..79a7bbd 100644 (file)
@@ -528,7 +528,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;
 }
 
@@ -546,7 +546,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 99bb1fe..c1a7246 100644 (file)
@@ -31,11 +31,12 @@ struct intel_gt;
  * |            |    MISSING <--/    |    \--> ERROR                |
  * |   fetch    |                    V                              |
  * |            |                 AVAILABLE                         |
- * +------------+-                   |                             -+
+ * +------------+-                   |   \                         -+
+ * |            |                    |    \--> INIT FAIL            |
  * |   init     |                    V                              |
  * |            |        /------> LOADABLE <----<-----------\       |
  * +------------+-       \         /    \        \           \     -+
- * |            |         FAIL <--<      \--> TRANSFERRED     \     |
+ * |            |    LOAD FAIL <--<      \--> TRANSFERRED     \     |
  * |   upload   |                  \           /   \          /     |
  * |            |                   \---------/     \--> RUNNING    |
  * +------------+---------------------------------------------------+
@@ -49,8 +50,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 */
 };
@@ -121,10 +123,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:
@@ -146,7 +150,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;