[Intel-gfx] [PATCH 1/4] drm/i915/uc: Fail early if there is no GuC fw available
Chris Wilson
chris at chris-wilson.co.uk
Sun Aug 11 20:22:29 UTC 2019
Quoting Michal Wajdeczko (2019-08-11 20:51:29)
> We don't want to rely on misleading WOPCM partitioning error.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/gt/uc/intel_uc.c | 5 +++++
> drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h | 21 +++++++++++++++++++++
> 2 files changed, 26 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc.c b/drivers/gpu/drm/i915/gt/uc/intel_uc.c
> index 32aa4509ba1d..aa9701cfc754 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 0d22e73dff15..ad7e72316dcc 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 "<invalid>";
> }
>
> +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;
Worth distinguishing with -ENXIO or is the similarity to -EIO important?
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris
More information about the Intel-gfx
mailing list