[Intel-gfx] [PATCH 12/36] drm/i915/gt: Track if an engine requires forcewake w/a

Mika Kuoppala mika.kuoppala at linux.intel.com
Mon Jun 1 12:17:23 UTC 2020


Chris Wilson <chris at chris-wilson.co.uk> writes:

> Sometimes an engine might need to keep forcewake active while it is busy
> submitting requests for a particular workaround. Track such nuisance
> with engine->fw_domain.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

Reviewed-by: Mika Kuoppala <mika.kuoppala at linux.intel.com>

> ---
>  drivers/gpu/drm/i915/gt/intel_engine_types.h   | 9 +++++++++
>  drivers/gpu/drm/i915/gt/intel_ring_scheduler.c | 4 ++++
>  2 files changed, 13 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_engine_types.h b/drivers/gpu/drm/i915/gt/intel_engine_types.h
> index 3782e27c2945..ccdd69923793 100644
> --- a/drivers/gpu/drm/i915/gt/intel_engine_types.h
> +++ b/drivers/gpu/drm/i915/gt/intel_engine_types.h
> @@ -313,6 +313,15 @@ struct intel_engine_cs {
>  	u32 context_size;
>  	u32 mmio_base;
>  
> +	/*
> +	 * Some w/a require forcewake to be held (which prevents RC6) while
> +	 * a particular engine is active. If so, we set fw_domain to which
> +	 * domains need to be held for the duration of request activity,
> +	 * and 0 if none.
> +	 */
> +	unsigned int fw_domain;
> +	unsigned int fw_active;
> +
>  	unsigned long context_tag;
>  
>  	struct rb_node uabi_node;
> diff --git a/drivers/gpu/drm/i915/gt/intel_ring_scheduler.c b/drivers/gpu/drm/i915/gt/intel_ring_scheduler.c
> index aaff554865b1..777cab6d9540 100644
> --- a/drivers/gpu/drm/i915/gt/intel_ring_scheduler.c
> +++ b/drivers/gpu/drm/i915/gt/intel_ring_scheduler.c
> @@ -60,6 +60,8 @@ static struct i915_request *
>  schedule_in(struct intel_engine_cs *engine, struct i915_request *rq)
>  {
>  	__intel_gt_pm_get(engine->gt);
> +	if (!engine->fw_active++ && engine->fw_domain)
> +		intel_uncore_forcewake_get(engine->uncore, engine->fw_domain);
>  	intel_engine_context_in(engine);
>  	return i915_request_get(rq);
>  }
> @@ -74,6 +76,8 @@ schedule_out(struct intel_engine_cs *engine, struct i915_request *rq)
>  
>  	i915_request_put(rq);
>  	intel_engine_context_out(engine);
> +	if (!--engine->fw_active && engine->fw_domain)
> +		intel_uncore_forcewake_put(engine->uncore, engine->fw_domain);
>  	intel_gt_pm_put_async(engine->gt);
>  }
>  
> -- 
> 2.20.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx


More information about the Intel-gfx mailing list