[Intel-gfx] [PATCH v8 04/12] drm/i915: Introduce i915_gem_fini_hw for symmetry with i915_gem_init_hw
Sagar Arun Kamble
sagar.a.kamble at intel.com
Mon Apr 9 15:01:19 UTC 2018
On 4/9/2018 5:53 PM, Michal Wajdeczko wrote:
> We have i915_gem_init_hw function that on failure requires some
> cleanup in uC and then in other places we were trying to do
> such cleanup directly. Let's fix that by adding i915_gem_fini_hw
> for nice symmetry with init_hw and call it on cleanup paths.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Sagar Arun Kamble <sagar.a.kamble at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
Reviewed-by: Sagar Arun Kamble <sagar.a.kamble at intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 1 +
> drivers/gpu/drm/i915/i915_gem.c | 13 +++++++++++--
> 2 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index f8bc276..dbd95a4 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -3144,6 +3144,7 @@ void i915_gem_reset_engine(struct intel_engine_cs *engine,
> int __must_check i915_gem_init_hw(struct drm_i915_private *dev_priv);
> void i915_gem_init_swizzling(struct drm_i915_private *dev_priv);
> void i915_gem_fini(struct drm_i915_private *dev_priv);
> +void i915_gem_fini_hw(struct drm_i915_private *dev_priv);
> void i915_gem_cleanup_engines(struct drm_i915_private *dev_priv);
> int i915_gem_wait_for_idle(struct drm_i915_private *dev_priv,
> unsigned int flags);
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index fb99485..6f71099 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -5257,6 +5257,15 @@ int i915_gem_init_hw(struct drm_i915_private *dev_priv)
> goto out;
> }
>
> +void i915_gem_fini_hw(struct drm_i915_private *dev_priv)
> +{
> + intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
> +
> + intel_uc_fini_hw(dev_priv);
> +
> + intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
> +}
> +
> static int __intel_engines_record_defaults(struct drm_i915_private *i915)
> {
> struct i915_gem_context *ctx;
> @@ -5482,7 +5491,7 @@ int i915_gem_init(struct drm_i915_private *dev_priv)
> err_init_hw:
> i915_gem_wait_for_idle(dev_priv, I915_WAIT_LOCKED);
> i915_gem_contexts_lost(dev_priv);
> - intel_uc_fini_hw(dev_priv);
> + i915_gem_fini_hw(dev_priv);
> err_uc_init:
> intel_uc_fini(dev_priv);
> err_pm:
> @@ -5526,7 +5535,7 @@ void i915_gem_fini(struct drm_i915_private *dev_priv)
> i915_gem_drain_workqueue(dev_priv);
>
> mutex_lock(&dev_priv->drm.struct_mutex);
> - intel_uc_fini_hw(dev_priv);
> + i915_gem_fini_hw(dev_priv);
> intel_uc_fini(dev_priv);
> i915_gem_cleanup_engines(dev_priv);
> i915_gem_contexts_fini(dev_priv);
--
Thanks,
Sagar
More information about the Intel-gfx
mailing list