GEM_BUG_ON(guc_fw->type != INTEL_UC_FW_TYPE_GUC);
- if (!HAS_GUC(i915))
+ if (!HAS_GUC(i915)) {
+ guc_fw->fetch_status = INTEL_UC_FIRMWARE_NOT_SUPPORTED;
return;
+ }
+
+ guc_fw->fetch_status = INTEL_UC_FIRMWARE_NOT_STARTED;
if (i915_modparams.guc_firmware_path) {
guc_fw->path = i915_modparams.guc_firmware_path;
GEM_BUG_ON(huc_fw->type != INTEL_UC_FW_TYPE_HUC);
- if (!HAS_HUC(dev_priv))
+ if (!HAS_HUC(dev_priv)) {
+ huc_fw->fetch_status = INTEL_UC_FIRMWARE_NOT_SUPPORTED;
return;
+ }
+
+ huc_fw->fetch_status = INTEL_UC_FIRMWARE_NOT_STARTED;
if (i915_modparams.huc_firmware_path) {
huc_fw->path = i915_modparams.huc_firmware_path;
{
int guc_log_level;
- if (!HAS_GUC(i915) || !intel_uc_is_using_guc(i915))
+ if (!intel_uc_fw_supported(&i915->guc.fw) ||
+ !intel_uc_is_using_guc(i915))
guc_log_level = GUC_LOG_LEVEL_DISABLED;
else if (IS_ENABLED(CONFIG_DRM_I915_DEBUG) ||
IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM))
if (intel_uc_is_using_guc(i915) && !intel_uc_fw_is_selected(guc_fw)) {
DRM_WARN("Incompatible option detected: %s=%d, %s!\n",
"enable_guc", i915_modparams.enable_guc,
- !HAS_GUC(i915) ? "no GuC hardware" :
- "no GuC firmware");
+ !intel_uc_fw_supported(guc_fw) ?
+ "no GuC hardware" : "no GuC firmware");
}
/* Verify HuC firmware availability */
if (intel_uc_is_using_huc(i915) && !intel_uc_fw_is_selected(huc_fw)) {
DRM_WARN("Incompatible option detected: %s=%d, %s!\n",
"enable_guc", i915_modparams.enable_guc,
- !HAS_HUC(i915) ? "no HuC hardware" :
- "no HuC firmware");
+ !intel_uc_fw_supported(huc_fw) ?
+ "no HuC hardware" : "no HuC firmware");
}
/* XXX: GuC submission is unavailable for now */
if (i915_modparams.guc_log_level > 0 && !intel_uc_is_using_guc(i915)) {
DRM_WARN("Incompatible option detected: %s=%d, %s!\n",
"guc_log_level", i915_modparams.guc_log_level,
- !HAS_GUC(i915) ? "no GuC hardware" :
- "GuC not enabled");
+ !intel_uc_fw_supported(guc_fw) ?
+ "no GuC hardware" : "GuC not enabled");
i915_modparams.guc_log_level = 0;
}
if (!USES_GUC(i915))
return 0;
- if (!HAS_GUC(i915))
+ if (!intel_uc_fw_supported(&guc->fw))
return -ENODEV;
/* XXX: GuC submission is unavailable for now */
if (!USES_GUC(i915))
return;
- GEM_BUG_ON(!HAS_GUC(i915));
+ GEM_BUG_ON(!intel_uc_fw_supported(&guc->fw));
if (USES_GUC_SUBMISSION(i915))
intel_guc_submission_fini(guc);
struct intel_guc *guc = &i915->guc;
struct intel_huc *huc = &i915->huc;
- GEM_BUG_ON(!HAS_GUC(i915));
+ GEM_BUG_ON(!intel_uc_fw_supported(&guc->fw));
intel_huc_sanitize(huc);
intel_guc_sanitize(guc);
if (!USES_GUC(i915))
return 0;
- GEM_BUG_ON(!HAS_GUC(i915));
+ GEM_BUG_ON(!intel_uc_fw_supported(&guc->fw));
guc_reset_interrupts(guc);
if (!intel_guc_is_loaded(guc))
return;
- GEM_BUG_ON(!HAS_GUC(i915));
+ GEM_BUG_ON(!intel_uc_fw_supported(&guc->fw));
if (USES_GUC_SUBMISSION(i915))
intel_guc_submission_disable(guc);
size_t size;
int err;
+ GEM_BUG_ON(!intel_uc_fw_supported(uc_fw));
+
if (!uc_fw->path) {
dev_info(dev_priv->drm.dev,
"%s: No firmware was defined for %s!\n",
if (obj)
i915_gem_object_put(obj);
- uc_fw->fetch_status = INTEL_UC_FIRMWARE_NONE;
+ uc_fw->fetch_status = INTEL_UC_FIRMWARE_NOT_STARTED;
}
/**
#define _INTEL_UC_FW_H_
#include <linux/types.h>
+#include "i915_gem.h"
struct drm_printer;
struct drm_i915_private;
#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 = -2, /* no uc HW */
INTEL_UC_FIRMWARE_FAIL = -1,
- INTEL_UC_FIRMWARE_NONE = 0,
+ INTEL_UC_FIRMWARE_UNINITIALIZED = 0, /* used to catch checks done too early */
+ INTEL_UC_FIRMWARE_NOT_STARTED = 1,
INTEL_UC_FIRMWARE_PENDING,
INTEL_UC_FIRMWARE_SUCCESS
};
const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status)
{
switch (status) {
+ case INTEL_UC_FIRMWARE_NOT_SUPPORTED:
+ return "N/A - uc HW not available";
case INTEL_UC_FIRMWARE_FAIL:
return "FAIL";
- case INTEL_UC_FIRMWARE_NONE:
- return "NONE";
+ case INTEL_UC_FIRMWARE_UNINITIALIZED:
+ return "UNINITIALIZED";
+ case INTEL_UC_FIRMWARE_NOT_STARTED:
+ return "NOT_STARTED";
case INTEL_UC_FIRMWARE_PENDING:
return "PENDING";
case INTEL_UC_FIRMWARE_SUCCESS:
void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw,
enum intel_uc_fw_type type)
{
+ /*
+ * we use FIRMWARE_UNINITIALIZED to detect checks against fetch_status
+ * before we're looked at the HW caps to see if we have uc support
+ */
+ BUILD_BUG_ON(INTEL_UC_FIRMWARE_UNINITIALIZED);
+
uc_fw->path = NULL;
- uc_fw->fetch_status = INTEL_UC_FIRMWARE_NONE;
- uc_fw->load_status = INTEL_UC_FIRMWARE_NONE;
+ uc_fw->fetch_status = INTEL_UC_FIRMWARE_UNINITIALIZED;
+ uc_fw->load_status = INTEL_UC_FIRMWARE_NOT_STARTED;
uc_fw->type = type;
}
return uc_fw->load_status == INTEL_UC_FIRMWARE_SUCCESS;
}
+static inline bool intel_uc_fw_supported(struct intel_uc_fw *uc_fw)
+{
+ /* shouldn't call this before checking hw/blob availability */
+ GEM_BUG_ON(uc_fw->fetch_status == INTEL_UC_FIRMWARE_UNINITIALIZED);
+ return uc_fw->fetch_status != INTEL_UC_FIRMWARE_NOT_SUPPORTED;
+}
+
static inline void intel_uc_fw_sanitize(struct intel_uc_fw *uc_fw)
{
if (intel_uc_fw_is_loaded(uc_fw))