summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/intel_uc.c
diff options
context:
space:
mode:
authorMichał Winiarski <michal.winiarski@intel.com>2017-12-14 01:13:48 +0300
committerChris Wilson <chris@chris-wilson.co.uk>2017-12-14 11:06:56 +0300
commit61b5c1587dd82a8493d7838bb2f9289fd0903364 (patch)
treefc0a3a50a3a821953c4fcfc397f2bd5cd7976baa /drivers/gpu/drm/i915/intel_uc.c
parent3176ff49bc3e56871ec9f338cac759dacd0135e1 (diff)
downloadlinux-61b5c1587dd82a8493d7838bb2f9289fd0903364.tar.xz
drm/i915/guc: Extract guc_init from guc_init_hw
After GPU reset, GuC HW needs to be reinitialized (with FW reload). Unfortunately, we're doing some extra work there (mostly allocating stuff), work that can be moved to guc_init and called once at driver load time. As a side effect we're no longer hitting an assert in i915_ggtt_enable_guc on suspend/resume. v2: Do not duplicate disable_communication / reset_guc_interrupts v3: Add proper teardown after rebase References: 04f7b24eccdf ("drm/i915/guc: Assert that we switch between known ggtt->invalidate functions") Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com> Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Link: https://patchwork.freedesktop.org/patch/msgid/20171213221352.7173-3-michal.winiarski@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/intel_uc.c')
-rw-r--r--drivers/gpu/drm/i915/intel_uc.c71
1 files changed, 46 insertions, 25 deletions
diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c
index 785850838a44..907deac6e3fa 100644
--- a/drivers/gpu/drm/i915/intel_uc.c
+++ b/drivers/gpu/drm/i915/intel_uc.c
@@ -214,26 +214,20 @@ void intel_uc_fini_wq(struct drm_i915_private *dev_priv)
intel_guc_fini_wq(&dev_priv->guc);
}
-int intel_uc_init_hw(struct drm_i915_private *dev_priv)
+int intel_uc_init(struct drm_i915_private *dev_priv)
{
struct intel_guc *guc = &dev_priv->guc;
- struct intel_huc *huc = &dev_priv->huc;
- int ret, attempts;
+ int ret;
if (!USES_GUC(dev_priv))
return 0;
- if (!HAS_GUC(dev_priv)) {
- ret = -ENODEV;
- goto err_out;
- }
-
- guc_disable_communication(guc);
- gen9_reset_guc_interrupts(dev_priv);
+ if (!HAS_GUC(dev_priv))
+ return -ENODEV;
ret = intel_guc_init(guc);
if (ret)
- goto err_out;
+ return ret;
if (USES_GUC_SUBMISSION(dev_priv)) {
/*
@@ -241,10 +235,44 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
* if we are planning to enable submission later
*/
ret = intel_guc_submission_init(guc);
- if (ret)
- goto err_guc;
+ if (ret) {
+ intel_guc_fini(guc);
+ return ret;
+ }
}
+ return 0;
+}
+
+void intel_uc_fini(struct drm_i915_private *dev_priv)
+{
+ struct intel_guc *guc = &dev_priv->guc;
+
+ if (!USES_GUC(dev_priv))
+ return;
+
+ GEM_BUG_ON(!HAS_GUC(dev_priv));
+
+ if (USES_GUC_SUBMISSION(dev_priv))
+ intel_guc_submission_fini(guc);
+
+ intel_guc_fini(guc);
+}
+
+int intel_uc_init_hw(struct drm_i915_private *dev_priv)
+{
+ struct intel_guc *guc = &dev_priv->guc;
+ struct intel_huc *huc = &dev_priv->huc;
+ int ret, attempts;
+
+ if (!USES_GUC(dev_priv))
+ return 0;
+
+ GEM_BUG_ON(!HAS_GUC(dev_priv));
+
+ guc_disable_communication(guc);
+ gen9_reset_guc_interrupts(dev_priv);
+
/* init WOPCM */
I915_WRITE(GUC_WOPCM_SIZE, intel_guc_wopcm_size(dev_priv));
I915_WRITE(DMA_GUC_WOPCM_OFFSET,
@@ -264,12 +292,12 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
*/
ret = __intel_uc_reset_hw(dev_priv);
if (ret)
- goto err_submission;
+ goto err_out;
if (USES_HUC(dev_priv)) {
ret = intel_huc_init_hw(huc);
if (ret)
- goto err_submission;
+ goto err_out;
}
intel_guc_init_params(guc);
@@ -322,11 +350,6 @@ err_communication:
guc_disable_communication(guc);
err_log_capture:
guc_capture_load_err_log(guc);
-err_submission:
- if (USES_GUC_SUBMISSION(dev_priv))
- intel_guc_submission_fini(guc);
-err_guc:
- intel_guc_fini(guc);
err_out:
/*
* Note that there is no fallback as either user explicitly asked for
@@ -348,15 +371,13 @@ void intel_uc_fini_hw(struct drm_i915_private *dev_priv)
if (!USES_GUC(dev_priv))
return;
+ GEM_BUG_ON(!HAS_GUC(dev_priv));
+
if (USES_GUC_SUBMISSION(dev_priv))
intel_guc_submission_disable(guc);
guc_disable_communication(guc);
- if (USES_GUC_SUBMISSION(dev_priv)) {
+ if (USES_GUC_SUBMISSION(dev_priv))
gen9_disable_guc_interrupts(dev_priv);
- intel_guc_submission_fini(guc);
- }
-
- intel_guc_fini(guc);
}