[Intel-gfx] [PATCH 03/12] drm/i915/guc: Initialize GuC before restarting engines

Michel Thierry michel.thierry at intel.com
Thu Oct 12 20:43:30 UTC 2017


On 09/10/17 07:52, Michał Winiarski wrote:
> Now that we're handling request resubmission the same way as regular
> submission (from the tasklet), we can move GuC initialization earlier,
> before restarting the engines. This way, we're no longer being in the
> state of flux during engine restart - we're already in user requested
> submission mode.
> 
> Signed-off-by: Michał Winiarski <michal.winiarski at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Michel Thierry <michel.thierry at intel.com>
> Cc: Mika Kuoppala <mika.kuoppala at intel.com>
> Cc: Oscar Mateo <oscar.mateo at intel.com>
> Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

The nice side-effect of this is that in order support reset engine using 
GuC submission, now the only missing bit is to use a h2g command instead 
of calling intel_gpu_reset.

Tested-by: Michel Thierry <michel.thierry at intel.com>

> ---
>   drivers/gpu/drm/i915/i915_gem.c            | 10 +++++-----
>   drivers/gpu/drm/i915/i915_guc_submission.c |  7 -------
>   drivers/gpu/drm/i915/intel_lrc.c           |  2 +-
>   3 files changed, 6 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 82a10036fb38..6c9f0a151d0f 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4780,6 +4780,11 @@ int i915_gem_init_hw(struct drm_i915_private *dev_priv)
>   		goto out;
>   	}
>   
> +	/* We can't enable contexts until all firmware is loaded */
> +	ret = intel_uc_init_hw(dev_priv);
> +	if (ret)
> +		goto out;
> +
>   	/* Need to do basic initialisation of all rings first: */
>   	ret = __i915_gem_restart_engines(dev_priv);
>   	if (ret)
> @@ -4787,11 +4792,6 @@ int i915_gem_init_hw(struct drm_i915_private *dev_priv)
>   
>   	intel_mocs_init_l3cc_table(dev_priv);
>   
> -	/* We can't enable contexts until all firmware is loaded */
> -	ret = intel_uc_init_hw(dev_priv);
> -	if (ret)
> -		goto out;
> -
>   out:
>   	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
>   	return ret;
> diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
> index 30f026566001..7e2c9136a2fa 100644
> --- a/drivers/gpu/drm/i915/i915_guc_submission.c
> +++ b/drivers/gpu/drm/i915/i915_guc_submission.c
> @@ -1186,14 +1186,7 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv)
>   
>   	for_each_engine(engine, dev_priv, id) {
>   		struct intel_engine_execlists * const execlists = &engine->execlists;
> -		/* The tasklet was initialised by execlists, and may be in
> -		 * a state of flux (across a reset) and so we just want to
> -		 * take over the callback without changing any other state
> -		 * in the tasklet.
> -		 */
>   		execlists->irq_tasklet.func = i915_guc_irq_handler;
> -		clear_bit(ENGINE_IRQ_EXECLIST, &engine->irq_posted);
> -		tasklet_schedule(&execlists->irq_tasklet);
>   	}
>   
>   	return 0;
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index 721432ddf403..52f4dbf2fc40 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -1462,7 +1462,7 @@ static int gen8_init_common_ring(struct intel_engine_cs *engine)
>   	execlists->preempt = false;
>   
>   	/* After a GPU reset, we may have requests to replay */
> -	if (!i915_modparams.enable_guc_submission && execlists->first)
> +	if (execlists->first)
>   		tasklet_schedule(&execlists->irq_tasklet);
>   
>   	return 0;
> 


More information about the Intel-gfx mailing list