Commit 4a600cb7 authored by Michal Wajdeczko's avatar Michal Wajdeczko Committed by Chris Wilson

drm/i915/uc: Cleanup fw fetch on every GuC/HuC init failure

Be consistent and always perform fw fetch cleanup in GuC/HuC specific
init functions on every failure. Also while converting firmware
status to error, stop treating SELECTED as non-error, as long term
we should not see it.
Signed-off-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20190817131144.26884-3-michal.wajdeczko@intel.com
parent 5bde5a45
...@@ -302,6 +302,7 @@ int intel_guc_init(struct intel_guc *guc) ...@@ -302,6 +302,7 @@ int intel_guc_init(struct intel_guc *guc)
intel_uc_fw_fini(&guc->fw); intel_uc_fw_fini(&guc->fw);
err_fetch: err_fetch:
intel_uc_fw_cleanup_fetch(&guc->fw); intel_uc_fw_cleanup_fetch(&guc->fw);
DRM_DEV_DEBUG_DRIVER(gt->i915->drm.dev, "failed with %d\n", ret);
return ret; return ret;
} }
......
...@@ -77,11 +77,12 @@ static void intel_huc_rsa_data_destroy(struct intel_huc *huc) ...@@ -77,11 +77,12 @@ static void intel_huc_rsa_data_destroy(struct intel_huc *huc)
int intel_huc_init(struct intel_huc *huc) int intel_huc_init(struct intel_huc *huc)
{ {
struct drm_i915_private *i915 = huc_to_gt(huc)->i915;
int err; int err;
err = intel_uc_fw_init(&huc->fw); err = intel_uc_fw_init(&huc->fw);
if (err) if (err)
return err; goto out;
/* /*
* HuC firmware image is outside GuC accessible range. * HuC firmware image is outside GuC accessible range.
...@@ -96,6 +97,9 @@ int intel_huc_init(struct intel_huc *huc) ...@@ -96,6 +97,9 @@ int intel_huc_init(struct intel_huc *huc)
out_fini: out_fini:
intel_uc_fw_fini(&huc->fw); intel_uc_fw_fini(&huc->fw);
out:
intel_uc_fw_cleanup_fetch(&huc->fw);
DRM_DEV_DEBUG_DRIVER(i915->drm.dev, "failed with %d\n", err);
return err; return err;
} }
......
...@@ -305,16 +305,10 @@ int intel_uc_init(struct intel_uc *uc) ...@@ -305,16 +305,10 @@ int intel_uc_init(struct intel_uc *uc)
return ret; return ret;
if (intel_uc_uses_huc(uc)) { if (intel_uc_uses_huc(uc)) {
ret = intel_huc_init(huc); intel_huc_init(huc);
if (ret)
goto out_huc;
} }
return 0; return 0;
out_huc:
intel_uc_fw_cleanup_fetch(&huc->fw);
return 0;
} }
void intel_uc_fini(struct intel_uc *uc) void intel_uc_fini(struct intel_uc *uc)
......
...@@ -542,9 +542,11 @@ int intel_uc_fw_init(struct intel_uc_fw *uc_fw) ...@@ -542,9 +542,11 @@ int intel_uc_fw_init(struct intel_uc_fw *uc_fw)
return -ENOEXEC; return -ENOEXEC;
err = i915_gem_object_pin_pages(uc_fw->obj); err = i915_gem_object_pin_pages(uc_fw->obj);
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);
}
return err; return err;
} }
......
...@@ -141,6 +141,7 @@ static inline int intel_uc_fw_status_to_error(enum intel_uc_fw_status status) ...@@ -141,6 +141,7 @@ static inline int intel_uc_fw_status_to_error(enum intel_uc_fw_status status)
case INTEL_UC_FIRMWARE_FAIL: case INTEL_UC_FIRMWARE_FAIL:
return -EIO; return -EIO;
case INTEL_UC_FIRMWARE_SELECTED: case INTEL_UC_FIRMWARE_SELECTED:
return -ESTALE;
case INTEL_UC_FIRMWARE_AVAILABLE: case INTEL_UC_FIRMWARE_AVAILABLE:
case INTEL_UC_FIRMWARE_TRANSFERRED: case INTEL_UC_FIRMWARE_TRANSFERRED:
case INTEL_UC_FIRMWARE_RUNNING: case INTEL_UC_FIRMWARE_RUNNING:
......
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