static inline bool intel_guc_is_supported(struct intel_guc *guc)
{
- return intel_uc_fw_supported(&guc->fw);
+ return intel_uc_fw_is_supported(&guc->fw);
+}
+
+static inline bool intel_guc_is_enabled(struct intel_guc *guc)
+{
+ return intel_uc_fw_is_enabled(&guc->fw);
}
static inline bool intel_guc_is_running(struct intel_guc *guc)
static inline bool intel_huc_is_supported(struct intel_huc *huc)
{
- return intel_uc_fw_supported(&huc->fw);
+ return intel_uc_fw_is_supported(&huc->fw);
+}
+
+static inline bool intel_huc_is_enabled(struct intel_huc *huc)
+{
+ return intel_uc_fw_is_enabled(&huc->fw);
}
static inline bool intel_huc_is_authenticated(struct intel_huc *huc)
struct drm_i915_private *i915 = gt->i915;
intel_uc_fw_init_early(&huc->fw, INTEL_UC_FW_TYPE_HUC,
- intel_uc_supports_guc(uc),
+ intel_uc_uses_guc(uc),
INTEL_INFO(i915)->platform, INTEL_REVID(i915));
}
DRM_DEV_DEBUG_DRIVER(i915->drm.dev,
"enable_guc=%d (guc:%s submission:%s huc:%s)\n",
i915_modparams.enable_guc,
- yesno(intel_uc_supports_guc(uc)),
- yesno(intel_uc_supports_guc_submission(uc)),
- yesno(intel_uc_supports_huc(uc)));
+ yesno(intel_uc_uses_guc(uc)),
+ yesno(intel_uc_uses_guc_submission(uc)),
+ yesno(intel_uc_uses_huc(uc)));
if (i915_modparams.enable_guc == -1)
return;
if (i915_modparams.enable_guc == 0) {
- GEM_BUG_ON(intel_uc_supports_guc(uc));
- GEM_BUG_ON(intel_uc_supports_guc_submission(uc));
- GEM_BUG_ON(intel_uc_supports_huc(uc));
+ GEM_BUG_ON(intel_uc_uses_guc(uc));
+ GEM_BUG_ON(intel_uc_uses_guc_submission(uc));
+ GEM_BUG_ON(intel_uc_uses_huc(uc));
return;
}
struct drm_i915_private *i915 = uc_to_gt(uc)->i915;
int err;
- if (!intel_uc_supports_guc(uc))
+ if (!intel_uc_uses_guc(uc))
return;
err = intel_uc_fw_fetch(&uc->guc.fw, i915);
if (err)
return;
- if (intel_uc_supports_huc(uc))
+ if (intel_uc_uses_huc(uc))
intel_uc_fw_fetch(&uc->huc.fw, i915);
}
void intel_uc_cleanup_firmwares(struct intel_uc *uc)
{
- if (!intel_uc_supports_guc(uc))
+ if (!intel_uc_uses_guc(uc))
return;
- if (intel_uc_supports_huc(uc))
+ if (intel_uc_uses_huc(uc))
intel_uc_fw_cleanup_fetch(&uc->huc.fw);
intel_uc_fw_cleanup_fetch(&uc->guc.fw);
struct intel_huc *huc = &uc->huc;
int ret;
- if (!intel_uc_supports_guc(uc))
+ if (!intel_uc_uses_guc(uc))
return 0;
/* XXX: GuC submission is unavailable for now */
if (ret)
return ret;
- if (intel_uc_supports_huc(uc)) {
+ if (intel_uc_uses_huc(uc)) {
ret = intel_huc_init(huc);
if (ret)
goto out_huc;
{
struct intel_guc *guc = &uc->guc;
- if (!intel_uc_supports_guc(uc))
+ if (!intel_uc_uses_guc(uc))
return;
- if (intel_uc_supports_huc(uc))
+ if (intel_uc_uses_huc(uc))
intel_huc_fini(&uc->huc);
intel_guc_fini(guc);
struct intel_uncore *uncore = gt->uncore;
u32 base = intel_wopcm_guc_base(>->i915->wopcm);
u32 size = intel_wopcm_guc_size(>->i915->wopcm);
- u32 huc_agent = intel_uc_supports_huc(uc) ? HUC_LOADING_AGENT_GUC : 0;
+ u32 huc_agent = intel_uc_uses_huc(uc) ? HUC_LOADING_AGENT_GUC : 0;
u32 mask;
int err;
if (!intel_uc_supports_guc(uc))
return 0;
+ if (!intel_uc_uses_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;
if (ret)
goto err_out;
- if (intel_uc_supports_huc(uc)) {
+ if (intel_uc_uses_huc(uc)) {
ret = intel_huc_fw_upload(huc);
if (ret && intel_uc_fw_is_overridden(&huc->fw))
goto err_out;
"submission",
enableddisabled(intel_uc_supports_guc_submission(uc)));
- if (intel_uc_supports_huc(uc)) {
+ if (intel_uc_uses_huc(uc)) {
dev_info(i915->drm.dev, "%s firmware %s version %u.%u %s:%s\n",
intel_uc_fw_type_repr(INTEL_UC_FW_TYPE_HUC),
huc->fw.path,
return intel_guc_is_supported(&uc->guc);
}
+static inline bool intel_uc_uses_guc(struct intel_uc *uc)
+{
+ return intel_guc_is_enabled(&uc->guc);
+}
+
static inline bool intel_uc_supports_guc_submission(struct intel_uc *uc)
{
return intel_guc_is_submission_supported(&uc->guc);
}
+static inline bool intel_uc_uses_guc_submission(struct intel_uc *uc)
+{
+ return intel_guc_is_submission_supported(&uc->guc);
+}
+
static inline bool intel_uc_supports_huc(struct intel_uc *uc)
{
- return intel_huc_is_supported(&uc->huc);
+ return intel_uc_supports_guc(uc);
+}
+
+static inline bool intel_uc_uses_huc(struct intel_uc *uc)
+{
+ return intel_huc_is_enabled(&uc->huc);
}
#endif
__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 ?
INTEL_UC_FIRMWARE_SELECTED :
+ INTEL_UC_FIRMWARE_DISABLED :
INTEL_UC_FIRMWARE_NOT_SUPPORTED);
}
int err;
GEM_BUG_ON(!i915->wopcm.size);
- GEM_BUG_ON(!intel_uc_fw_supported(uc_fw));
+ GEM_BUG_ON(!intel_uc_fw_is_enabled(uc_fw));
err = i915_inject_load_error(i915, -ENXIO);
if (err)
/* Home of GuC, HuC and DMC firmwares */
#define INTEL_UC_FIRMWARE_URL "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915"
+/*
+ * +------------+---------------------------------------------------+
+ * | PHASE | FIRMWARE STATUS TRANSITIONS |
+ * +============+===================================================+
+ * | | UNINITIALIZED |
+ * +------------+- / | \ -+
+ * | | DISABLED <--/ | \--> NOT_SUPPORTED |
+ * | init_early | V |
+ * | | SELECTED |
+ * +------------+- / | \ -+
+ * | | MISSING <--/ | \--> ERROR |
+ * | fetch | | |
+ * | | /------> AVAILABLE <---<-----------\ |
+ * +------------+- \ / \ \ \ -+
+ * | | FAIL <--< \--> TRANSFERRED \ |
+ * | upload | \ / \ / |
+ * | | \---------/ \--> RUNNING |
+ * +------------+---------------------------------------------------+
+ */
+
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 */
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:
{
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;
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;
+}
+
static inline bool intel_uc_fw_is_available(struct intel_uc_fw *uc_fw)
{
return __intel_uc_fw_status(uc_fw) >= INTEL_UC_FIRMWARE_AVAILABLE;
return __intel_uc_fw_status(uc_fw) == INTEL_UC_FIRMWARE_RUNNING;
}
-static inline bool intel_uc_fw_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_overridden(const struct intel_uc_fw *uc_fw)
{
return uc_fw->user_overridden;
#define HAS_GT_UC(dev_priv) (INTEL_INFO(dev_priv)->has_gt_uc)
/* Having GuC is not the same as using GuC */
-#define USES_GUC(dev_priv) intel_uc_supports_guc(&(dev_priv)->gt.uc)
-#define USES_GUC_SUBMISSION(dev_priv) intel_uc_supports_guc_submission(&(dev_priv)->gt.uc)
+#define USES_GUC(dev_priv) intel_uc_uses_guc(&(dev_priv)->gt.uc)
+#define USES_GUC_SUBMISSION(dev_priv) intel_uc_uses_guc_submission(&(dev_priv)->gt.uc)
#define HAS_POOLED_EU(dev_priv) (INTEL_INFO(dev_priv)->has_pooled_eu)