[PATCH 1/2] drm/xe: Assert pat.ops function pointers

Piotr Piórkowski piotr.piorkowski at intel.com
Tue Apr 9 13:09:34 UTC 2024


Michal Wajdeczko <michal.wajdeczko at intel.com> wrote on wto [2024-kwi-09 12:51:05 +0200]:
> Make sure that pat.ops (if selected) has all required function
> pointers setup. Only .program_media may be omitted if we have
> older media version.
> 
> This should help avoid late runtime checks against individual
> function pointers.
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Piotr Piórkowski <piotr.piorkowski at intel.com>
> Cc: Matt Roper <matthew.d.roper at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_pat.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_pat.c b/drivers/gpu/drm/xe/xe_pat.c
> index 66d8e3dd8237..026e4a9fe124 100644
> --- a/drivers/gpu/drm/xe/xe_pat.c
> +++ b/drivers/gpu/drm/xe/xe_pat.c
> @@ -428,6 +428,10 @@ void xe_pat_init_early(struct xe_device *xe)
>  	/* VFs can't program nor dump PAT settings */
>  	if (IS_SRIOV_VF(xe))
>  		xe->pat.ops = NULL;
> +
> +	xe_assert(xe, !xe->pat.ops || xe->pat.ops->dump);
> +	xe_assert(xe, !xe->pat.ops || xe->pat.ops->program_graphics);
> +	xe_assert(xe, !xe->pat.ops || MEDIA_VER(xe) < 13 || xe->pat.ops->program_media);

Reviewed-by: Piotr Piórkowski <piotr.piorkowski at intel.com>

>  }
>  
>  void xe_pat_init(struct xe_gt *gt)
> -- 
> 2.43.0
> 

-- 


More information about the Intel-xe mailing list