[Intel-gfx] [PATCH] drm/i915/uc: Add explicit DISABLED state for firmware

Chris Wilson chris at chris-wilson.co.uk
Fri Aug 16 07:03:46 UTC 2019


Quoting Michal Wajdeczko (2019-08-16 00:48:32)
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
> index d056e1f4bd6d..ce828ae3ea03 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
> @@ -206,8 +206,10 @@ void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw,
>                 __uc_fw_user_override(uc_fw);
>         }
>  
> -       intel_uc_fw_change_status(uc_fw, uc_fw->path && *uc_fw->path ?
> +       intel_uc_fw_change_status(uc_fw, uc_fw->path ?
> +                                 uc_fw->path ?

uc_fw->path ? *uc_fw->path ?

>                                   INTEL_UC_FIRMWARE_SELECTED :
> +                                 INTEL_UC_FIRMWARE_DISABLED :
>                                   INTEL_UC_FIRMWARE_NOT_SUPPORTED);
>  }

> 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 ce8e83128a95..40927d17efe2 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h
> @@ -19,8 +19,9 @@ struct intel_gt;
>  #define INTEL_UC_FIRMWARE_URL "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915"
>  
>  enum intel_uc_fw_status {
> -       INTEL_UC_FIRMWARE_NOT_SUPPORTED = -1, /* no uc HW or disabled */
> +       INTEL_UC_FIRMWARE_NOT_SUPPORTED = -1, /* no uc HW */
>         INTEL_UC_FIRMWARE_UNINITIALIZED = 0, /* used to catch checks done too early */
> +       INTEL_UC_FIRMWARE_DISABLED, /* disabled */
>         INTEL_UC_FIRMWARE_SELECTED, /* selected the blob we want to load */
>         INTEL_UC_FIRMWARE_MISSING, /* blob not found on the system */
>         INTEL_UC_FIRMWARE_ERROR, /* invalid format or version */
> @@ -84,6 +85,8 @@ const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status)
>                 return "N/A";
>         case INTEL_UC_FIRMWARE_UNINITIALIZED:
>                 return "UNINITIALIZED";
> +       case INTEL_UC_FIRMWARE_DISABLED:
> +               return "DISABLED";
>         case INTEL_UC_FIRMWARE_SELECTED:
>                 return "SELECTED";
>         case INTEL_UC_FIRMWARE_MISSING:
> @@ -106,7 +109,9 @@ static inline int intel_uc_fw_status_to_error(enum intel_uc_fw_status status)
>  {
>         switch (status) {
>         case INTEL_UC_FIRMWARE_NOT_SUPPORTED:
> +               return -ENODEV;
>         case INTEL_UC_FIRMWARE_UNINITIALIZED:

return -EACCES; ?

> +       case INTEL_UC_FIRMWARE_DISABLED:
>                 return -EPERM;

>         case INTEL_UC_FIRMWARE_MISSING:
>                 return -ENOENT;
> @@ -142,6 +147,16 @@ __intel_uc_fw_status(struct intel_uc_fw *uc_fw)
>         return uc_fw->status;
>  }
>  
> +static inline bool intel_uc_fw_is_supported(struct intel_uc_fw *uc_fw)
> +{
> +       return __intel_uc_fw_status(uc_fw) != INTEL_UC_FIRMWARE_NOT_SUPPORTED;
> +}
> +
> +static inline bool intel_uc_fw_is_enabled(struct intel_uc_fw *uc_fw)
> +{
> +       return __intel_uc_fw_status(uc_fw) > INTEL_UC_FIRMWARE_DISABLED;
> +}

Ok.
-Chris


More information about the Intel-gfx mailing list