[Intel-gfx] [PATCH 1/3] drm/i915: Reorder early initialization

Chris Wilson chris at chris-wilson.co.uk
Thu Mar 22 20:48:16 UTC 2018


Quoting Michal Wajdeczko (2018-03-22 20:36:57)
> In upcoming patch, we want to perform more actions in early
> initialization of the uC. This reordering will help resolve
> new dependencies that will be introduced by future patch.
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.c | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index a7d3275..f60bc04 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -919,17 +919,21 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,
>         mutex_init(&dev_priv->wm.wm_mutex);
>         mutex_init(&dev_priv->pps_mutex);
>  
> -       intel_wopcm_init_early(&dev_priv->wopcm);
> -       intel_uc_init_early(dev_priv);
>         i915_memcpy_init_early(dev_priv);
>  
>         ret = i915_workqueues_init(dev_priv);
>         if (ret < 0)
>                 goto err_engines;
>  
> +       ret = i915_gem_load_init(dev_priv);
> +       if (ret < 0)
> +               goto err_workqueues;

Scary. But really misnamed. I was thinking this was i915_gem_init(),
could you rename this i915_gem_init_early() to indicate that all it is
doing is the early allocations and nothing HW related.

>         /* This must be called before any calls to HAS_PCH_* */
>         intel_detect_pch(dev_priv);
>  
> +       intel_wopcm_init_early(&dev_priv->wopcm);
> +       intel_uc_init_early(dev_priv);
>         intel_pm_setup(dev_priv);
>         intel_init_dpio(dev_priv);
>         intel_power_domains_init(dev_priv);
> @@ -938,18 +942,13 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,
>         intel_init_display_hooks(dev_priv);
>         intel_init_clock_gating_hooks(dev_priv);
>         intel_init_audio_hooks(dev_priv);
> -       ret = i915_gem_load_init(dev_priv);
> -       if (ret < 0)
> -               goto err_irq;
> -
>         intel_display_crc_init(dev_priv);
>  
>         intel_detect_preproduction_hw(dev_priv);
>  
>         return 0;
>  
> -err_irq:
> -       intel_irq_fini(dev_priv);
> +err_workqueues:
>         i915_workqueues_cleanup(dev_priv);
>  err_engines:
>         i915_engines_cleanup(dev_priv);
> @@ -962,8 +961,8 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,
>   */
>  static void i915_driver_cleanup_early(struct drm_i915_private *dev_priv)
>  {
> -       i915_gem_load_cleanup(dev_priv);
>         intel_irq_fini(dev_priv);
> +       i915_gem_load_cleanup(dev_priv);

Ok, onion preserved.

>         i915_workqueues_cleanup(dev_priv);
>         i915_engines_cleanup(dev_priv);

* mutters about dead code.

Code reordering looks fine,
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the Intel-gfx mailing list