From: jsg Date: Fri, 22 Jul 2022 06:13:09 +0000 (+0000) Subject: drm/i915/uc: correctly track uc_fw init failure X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=669f2e97e096e9a14f2e2e56bf5ce6c33ae1aefe;p=openbsd drm/i915/uc: correctly track uc_fw init failure From Daniele Ceraolo Spurio 60d1bb301ea5a4be3e1071d3d0c179140b270ef8 in linux 5.15.y/5.15.56 35d4efec103e1afde968cfc9305f00f9aceb19cc in mainline linux --- diff --git a/sys/dev/pci/drm/i915/gt/uc/intel_guc_fw.c b/sys/dev/pci/drm/i915/gt/uc/intel_guc_fw.c index 76fe766ad1b..bb951b8d520 100644 --- a/sys/dev/pci/drm/i915/gt/uc/intel_guc_fw.c +++ b/sys/dev/pci/drm/i915/gt/uc/intel_guc_fw.c @@ -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; } diff --git a/sys/dev/pci/drm/i915/gt/uc/intel_huc.c b/sys/dev/pci/drm/i915/gt/uc/intel_huc.c index fc5387b410a..9ee22ac9254 100644 --- a/sys/dev/pci/drm/i915/gt/uc/intel_huc.c +++ b/sys/dev/pci/drm/i915/gt/uc/intel_huc.c @@ -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; } diff --git a/sys/dev/pci/drm/i915/gt/uc/intel_uc_fw.c b/sys/dev/pci/drm/i915/gt/uc/intel_uc_fw.c index 614308ffaec..79a7bbd569e 100644 --- a/sys/dev/pci/drm/i915/gt/uc/intel_uc_fw.c +++ b/sys/dev/pci/drm/i915/gt/uc/intel_uc_fw.c @@ -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; diff --git a/sys/dev/pci/drm/i915/gt/uc/intel_uc_fw.h b/sys/dev/pci/drm/i915/gt/uc/intel_uc_fw.h index 99bb1fe1af6..c1a7246fb7d 100644 --- a/sys/dev/pci/drm/i915/gt/uc/intel_uc_fw.h +++ b/sys/dev/pci/drm/i915/gt/uc/intel_uc_fw.h @@ -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;