Re: [PATCH] drm/i915/guc: Assert that we switch between known ggtt->invalidate functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 01, 2017 at 10:04:46AM +0100, Chris Wilson wrote:
> When we enable the GuC, we enable an alternative mechanism for doing
> post-GGTT update invalidation. Likewise, when we disable the GuC, we
> restore the previous method. Assert that we change between known
> endpoints, so that we can catch if we accidentally clobber some other
> gen and if we change the invalidate routine without updating guc.
> 
> Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxxxxxxxx>
> Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>
> Cc: Oscar Mateo <oscar.mateo@xxxxxxxxx>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@xxxxxxxxx>
> Cc: Michal Wajdeczko <michal.wajdeczko@xxxxxxxxx>
> Cc: Arkadiusz Hiler <arkadiusz.hiler@xxxxxxxxx>
> Cc: Michel Thierry <michel.thierry@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 1489c3af7145..4ff854e6413c 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -3095,13 +3095,17 @@ int i915_ggtt_enable_hw(struct drm_i915_private *dev_priv)
>  
>  void i915_ggtt_enable_guc(struct drm_i915_private *i915)
>  {
> +	GEM_BUG_ON(i915->ggtt.invalidate != gen6_ggtt_invalidate);
> +
>  	i915->ggtt.invalidate = guc_ggtt_invalidate;
>  }
>  
>  void i915_ggtt_disable_guc(struct drm_i915_private *i915)
>  {
> -	if (i915->ggtt.invalidate == guc_ggtt_invalidate)
> -		i915->ggtt.invalidate = gen6_ggtt_invalidate;
> +	/* We should only be called after i915_ggtt_enable_guc() */
> +	GEM_BUG_ON(i915->ggtt.invalidate != guc_ggtt_invalidate);
> +
> +	i915->ggtt.invalidate = gen6_ggtt_invalidate;
>  }

While this looks correct today, it may not work in the future if we
will need somethig other than gen6_ggtt_invalidate() as base invalidate
function or guc_gtt_invalidate() as the one for the guc. Just a head up.

Reviewed-by: Michal Wajdeczko <michal.wajdeczko@xxxxxxxxx>

>  
>  void i915_gem_restore_gtt_mappings(struct drm_i915_private *dev_priv)
> -- 
> 2.11.0
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux