[Intel-xe] [PATCH] drm/xe: Invalidate media GT TLB for objects mapped by media GT

Matthew Brost matthew.brost at intel.com
Tue Apr 11 01:34:41 UTC 2023


On Mon, Apr 10, 2023 at 05:27:59PM -0700, Matt Roper wrote:
> Xe is still lacking some general infrastructure to handle GGTT TLB
> invalidation properly for platforms like MTL where multiple GTs share a
> single GGTT.  As a temporary bandaid while that infrastructure is
> missing, make xe_ggtt_map_bo invalidate on bo->gt rather than ggtt->gt.
> This allows MTL's driver initialization to make some forward progress
> since using ggtt->gt (which is always the primary GT) results in driver
> timeouts while setting up the HWSP for hardware engines on the media GT.
> 
> A proper solution here will likely involve invalidating the TLBs of both
> GTs rather than just one (gitlab issue #220); this is just a temporary
> hack for now to help unblock other MTL-related driver work.
> 

We probably need flags to kernel BOs indicating which GTs they are
mapped in. A LRC for is tied to a single GT (e.g. a LRC for a BCS
hardwarwe engine would main tile while one for VCS would be media).
While the example you gave (HWSP) would be mapped in both GTs. I'd
suggest we convert bo->gt to a gt_mask long term.

I'd prefer just to fix this properly right now but wont block progress
either. With that:

Reviewed-by: Matthew Brost <matthew.brost at intel.com>

> Reference: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/220
> Signed-off-by: Matt Roper <matthew.d.roper at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_ggtt.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c
> index 0ae373b604f6..11461c02a831 100644
> --- a/drivers/gpu/drm/xe/xe_ggtt.c
> +++ b/drivers/gpu/drm/xe/xe_ggtt.c
> @@ -271,7 +271,13 @@ void xe_ggtt_map_bo(struct xe_ggtt *ggtt, struct xe_bo *bo)
>  		xe_ggtt_set_pte(ggtt, start + offset, pte);
>  	}
>  
> -	xe_ggtt_invalidate(ggtt->gt);
> +	/*
> +	 * FIXME:  Multiple GTs can share a single GGTT on platforms like
> +	 * MTL, so simply invalidating a single GT's TLB isn't really correct.
> +	 * We really need more extensive changes to invalidate all appropriate
> +	 * GTs rather than just one.
> +	 */
> +	xe_ggtt_invalidate(bo->gt);
>  }
>  
>  static int __xe_ggtt_insert_bo_at(struct xe_ggtt *ggtt, struct xe_bo *bo,
> -- 
> 2.39.2
> 


More information about the Intel-xe mailing list