From: Michal Wajdeczko Date: Sun, 11 Aug 2019 19:51:29 +0000 (+0000) Subject: drm/i915/uc: Fail early if there is no GuC fw available X-Git-Tag: v5.4-rc1~32^2~13^2~113 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ae7a3166a708bee439c7f683327f7381bdfd08ec;p=platform%2Fkernel%2Flinux-rpi.git drm/i915/uc: Fail early if there is no GuC fw available We don't want to rely on misleading WOPCM partitioning error. Signed-off-by: Michal Wajdeczko Cc: Daniele Ceraolo Spurio Cc: Chris Wilson Reviewed-by: Chris Wilson Signed-off-by: Chris Wilson Link: https://patchwork.freedesktop.org/patch/msgid/20190811195132.9660-2-michal.wajdeczko@intel.com --- diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc.c b/drivers/gpu/drm/i915/gt/uc/intel_uc.c index 32aa450..aa9701c 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_uc.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_uc.c @@ -436,6 +436,11 @@ int intel_uc_init_hw(struct intel_uc *uc) if (!intel_uc_supports_guc(uc)) return 0; + if (!intel_uc_fw_is_available(&guc->fw)) { + ret = intel_uc_fw_status_to_error(guc->fw.status); + goto err_out; + } + ret = uc_init_wopcm(uc); if (ret) goto err_out; diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h index 0d22e73..ad7e723 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +++ b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h @@ -107,6 +107,27 @@ const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status) return ""; } +static inline int intel_uc_fw_status_to_error(enum intel_uc_fw_status status) +{ + switch (status) { + case INTEL_UC_FIRMWARE_NOT_SUPPORTED: + case INTEL_UC_FIRMWARE_UNINITIALIZED: + return -EPERM; + case INTEL_UC_FIRMWARE_MISSING: + return -ENOENT; + case INTEL_UC_FIRMWARE_ERROR: + return -ENOEXEC; + case INTEL_UC_FIRMWARE_FAIL: + return -EIO; + case INTEL_UC_FIRMWARE_SELECTED: + case INTEL_UC_FIRMWARE_AVAILABLE: + case INTEL_UC_FIRMWARE_TRANSFERRED: + case INTEL_UC_FIRMWARE_RUNNING: + return 0; + } + return -EINVAL; +} + static inline const char *intel_uc_fw_type_repr(enum intel_uc_fw_type type) { switch (type) {