[Intel-gfx] [PATCH 3/3] drm/i915: Do not inline forcewake taking in mmio accessors

Chris Wilson chris at chris-wilson.co.uk
Wed Sep 28 12:38:47 UTC 2016


On Wed, Sep 28, 2016 at 01:25:46PM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> 
> Once we know we need to take new forcewakes, that being
> a slow operation, it does not make sense to inline that
> code into every mmio accessor.
> 
> Move it to a separate function and save some code.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
>  drivers/gpu/drm/i915/intel_uncore.c | 25 +++++++++++++++----------
>  1 file changed, 15 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
> index 079102b46fd3..c887ab0947c6 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.c
> +++ b/drivers/gpu/drm/i915/intel_uncore.c
> @@ -862,11 +862,22 @@ __gen2_read(64)
>  	trace_i915_reg_rw(false, reg, val, sizeof(val), trace); \
>  	return val
>  
> -static inline void __force_wake_auto(struct drm_i915_private *dev_priv,
> -				     enum forcewake_domains fw_domains)

noinline just to reinforce?

> +static void ___force_wake_auto(struct drm_i915_private *dev_priv,
> +			       enum forcewake_domains fw_domains)
>  {
>  	struct intel_uncore_forcewake_domain *domain;
>  
> +	/* Ideally GCC would be constant-fold and eliminate this loop */

That comment no longer applies, since we are now out of line.

> +	for_each_fw_domain_masked(domain, fw_domains, dev_priv)
> +		fw_domain_arm_timer(domain);
> +
> +	dev_priv->uncore.funcs.force_wake_get(dev_priv, fw_domains);
> +	dev_priv->uncore.fw_domains_active |= fw_domains;
> +}
> +
> +static inline void __force_wake_auto(struct drm_i915_private *dev_priv,
> +				     enum forcewake_domains fw_domains)
> +{
>  	if (WARN_ON(!fw_domains))
>  		return;
>  
> @@ -874,14 +885,8 @@ static inline void __force_wake_auto(struct drm_i915_private *dev_priv,
>  	fw_domains &= dev_priv->uncore.fw_domains;
>  	fw_domains &= ~dev_priv->uncore.fw_domains_active;

Ok, that seems a reasonable justification (and that is what would neuter
the /* Ideally... */ comment).
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list