[Intel-gfx] [PATCH 3/4] drm/i915/guc: Extract guc_init from guc_init_hw

Chris Wilson chris at chris-wilson.co.uk
Mon Dec 11 15:37:31 UTC 2017


Quoting Michał Winiarski (2017-12-11 15:15:20)
> 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.
> 
> References: 04f7b24eccdf ("drm/i915/guc: Assert that we switch between known ggtt->invalidate functions")
> Signed-off-by: Michał Winiarski <michal.winiarski at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Sagar Arun Kamble <sagar.a.kamble at intel.com>
> ---
> @@ -241,10 +238,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)

I have a fondness for laying out the code in roughly the order it should
be used in the API, quite often reverse order to keep forward decls to a
minimum.

Looks like it is a clean split and does what you say on the tin,
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the Intel-gfx mailing list