void intel_uc_runtime_suspend(struct drm_i915_private *i915) { struct intel_guc *guc = &i915->guc; int err; if (!intel_guc_is_loaded(guc)) return; err = intel_guc_suspend(guc); if (err) DRM_DEBUG_DRIVER("Failed to suspend GuC, err=%d", err); guc_disable_communication(guc); }
void intel_uc_fini_hw(struct drm_i915_private *i915) { struct intel_guc *guc = &i915->guc; if (!intel_guc_is_loaded(guc)) return; GEM_BUG_ON(!HAS_GUC(i915)); if (USES_GUC_SUBMISSION(i915)) intel_guc_submission_disable(guc); guc_disable_communication(guc); __uc_sanitize(i915); }
void intel_uc_fini_hw(struct drm_i915_private *dev_priv) { guc_free_load_err_log(&dev_priv->guc); if (!i915.enable_guc_loading) return; if (i915.enable_guc_submission) i915_guc_submission_disable(dev_priv); guc_disable_communication(&dev_priv->guc); if (i915.enable_guc_submission) { gen9_disable_guc_interrupts(dev_priv); i915_guc_submission_fini(dev_priv); } i915_ggtt_disable_guc(dev_priv); }
int intel_uc_init_hw(struct drm_i915_private *dev_priv) { struct intel_guc *guc = &dev_priv->guc; int ret, attempts; if (!i915.enable_guc_loading) return 0; guc_disable_communication(guc); gen9_reset_guc_interrupts(dev_priv); /* We need to notify the guc whenever we change the GGTT */ i915_ggtt_enable_guc(dev_priv); if (i915.enable_guc_submission) { /* * This is stuff we need to have available at fw load time * if we are planning to enable submission later */ ret = i915_guc_submission_init(dev_priv); if (ret) goto err_guc; } /* init WOPCM */ I915_WRITE(GUC_WOPCM_SIZE, intel_guc_wopcm_size(dev_priv)); I915_WRITE(DMA_GUC_WOPCM_OFFSET, GUC_WOPCM_OFFSET_VALUE | HUC_LOADING_AGENT_GUC); /* WaEnableuKernelHeaderValidFix:skl */ /* WaEnableGuCBootHashCheckNotSet:skl,bxt,kbl */ if (IS_GEN9(dev_priv)) attempts = 3; else attempts = 1; while (attempts--) { /* * Always reset the GuC just before (re)loading, so * that the state and timing are fairly predictable */ ret = __intel_uc_reset_hw(dev_priv); if (ret) goto err_submission; intel_huc_init_hw(&dev_priv->huc); ret = intel_guc_init_hw(&dev_priv->guc); if (ret == 0 || ret != -EAGAIN) break; DRM_DEBUG_DRIVER("GuC fw load failed: %d; will reset and " "retry %d more time(s)\n", ret, attempts); } /* Did we succeded or run out of retries? */ if (ret) goto err_log_capture; ret = guc_enable_communication(guc); if (ret) goto err_log_capture; intel_guc_auth_huc(dev_priv); if (i915.enable_guc_submission) { if (i915.guc_log_level >= 0) gen9_enable_guc_interrupts(dev_priv); ret = i915_guc_submission_enable(dev_priv); if (ret) goto err_interrupts; } return 0; /* * We've failed to load the firmware :( * * Decide whether to disable GuC submission and fall back to * execlist mode, and whether to hide the error by returning * zero or to return -EIO, which the caller will treat as a * nonfatal error (i.e. it doesn't prevent driver load, but * marks the GPU as wedged until reset). */ err_interrupts: guc_disable_communication(guc); gen9_disable_guc_interrupts(dev_priv); err_log_capture: guc_capture_load_err_log(guc); err_submission: if (i915.enable_guc_submission) i915_guc_submission_fini(dev_priv); err_guc: i915_ggtt_disable_guc(dev_priv); DRM_ERROR("GuC init failed\n"); if (i915.enable_guc_loading > 1 || i915.enable_guc_submission > 1) ret = -EIO; else ret = 0; if (i915.enable_guc_submission) { i915.enable_guc_submission = 0; DRM_NOTE("Falling back from GuC submission to execlist mode\n"); } i915.enable_guc_loading = 0; DRM_NOTE("GuC firmware loading disabled\n"); return ret; }
int intel_uc_init_hw(struct drm_i915_private *i915) { struct intel_guc *guc = &i915->guc; struct intel_huc *huc = &i915->huc; int ret, attempts; if (!USES_GUC(i915)) return 0; GEM_BUG_ON(!HAS_GUC(i915)); guc_reset_interrupts(guc); /* WaEnableuKernelHeaderValidFix:skl */ /* WaEnableGuCBootHashCheckNotSet:skl,bxt,kbl */ if (IS_GEN(i915, 9)) attempts = 3; else attempts = 1; while (attempts--) { /* * Always reset the GuC just before (re)loading, so * that the state and timing are fairly predictable */ ret = __intel_uc_reset_hw(i915); if (ret) goto err_out; if (USES_HUC(i915)) { ret = intel_huc_fw_upload(huc); if (ret) goto err_out; } intel_guc_ads_reset(guc); intel_guc_init_params(guc); ret = intel_guc_fw_upload(guc); if (ret == 0) break; DRM_DEBUG_DRIVER("GuC fw load failed: %d; will reset and " "retry %d more time(s)\n", ret, attempts); } /* Did we succeded or run out of retries? */ if (ret) goto err_log_capture; ret = guc_enable_communication(guc); if (ret) goto err_log_capture; if (USES_HUC(i915)) { ret = intel_huc_auth(huc); if (ret) goto err_communication; } ret = intel_guc_sample_forcewake(guc); if (ret) goto err_communication; if (USES_GUC_SUBMISSION(i915)) { ret = intel_guc_submission_enable(guc); if (ret) goto err_communication; } dev_info(i915->drm.dev, "GuC firmware version %u.%u\n", guc->fw.major_ver_found, guc->fw.minor_ver_found); dev_info(i915->drm.dev, "GuC submission %s\n", enableddisabled(USES_GUC_SUBMISSION(i915))); dev_info(i915->drm.dev, "HuC %s\n", enableddisabled(USES_HUC(i915))); return 0; /* * We've failed to load the firmware :( */ err_communication: guc_disable_communication(guc); err_log_capture: guc_capture_load_err_log(guc); err_out: __uc_sanitize(i915); /* * Note that there is no fallback as either user explicitly asked for * the GuC or driver default option was to run with the GuC enabled. */ if (GEM_WARN_ON(ret == -EIO)) ret = -EINVAL; dev_err(i915->drm.dev, "GuC initialization failed %d\n", ret); return ret; }