[Intel-gfx] [PATCH v2 3/9] drm/i915/xelpg: Call Xe_LPG workaround functions based on IP version

Andi Shyti andi.shyti at linux.intel.com
Tue Jul 25 09:51:56 UTC 2023


Hi Matt,

[...]

all good

[...]

> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h

Is this the right place to define this? Maybe in
i915/gt/intel_gt.h?

> @@ -431,6 +431,29 @@ static inline struct intel_gt *to_gt(struct drm_i915_private *i915)
>  #define IS_GRAPHICS_VER(i915, from, until) \
>  	(GRAPHICS_VER(i915) >= (from) && GRAPHICS_VER(i915) <= (until))
>  
> +#define __IS_MEDIA_GT(gt) ((gt)->type == GT_MEDIA)
> +#define __IS_GFX_GT(gt) (!__IS_MEDIA_GT(gt))
> +#define __GT_VER_FULL(gt) (__IS_MEDIA_GT(gt) ? \
> +			   MEDIA_VER_FULL((gt)->i915) : \
> +			   GRAPHICS_VER_FULL((gt)->i915))

I think you can remove the '__' they can be widely used all
around the gt/ code.

> +/*
> + * Check that a GT contains IP of the specified type and within the specified
> + * IP range.  E.g.,
> + *
> + *    IS_GT_IP_RANGE(GFX, IP_VER(12, 70), IP_VER(12, 71))
> + *    IS_GT_IP_RANGE(MEDIA, IP_VER(13, 00), IP_VER(18, 02))
> + *
> + * Note that media version checks with this macro will only work on platforms
> + * with standalone media design (i.e., media version 13 and higher).
> + */
> +#define IS_GT_IP_RANGE(type, gt, from, until) ( \
> +	BUILD_BUG_ON_ZERO(from < IP_VER(2, 0)) + \
> +	BUILD_BUG_ON_ZERO(until < from) + \
> +	(__IS_##type##_GT(gt) && \
> +	 __GT_VER_FULL(gt) >= (from) && \
> +	 __GT_VER_FULL(gt) <= (until)))

This helper deservers its own patch :) Can we split it from the
rest?

Thanks,
Andi

>  #define MEDIA_VER(i915)			(RUNTIME_INFO(i915)->media.ip.ver)
>  #define MEDIA_VER_FULL(i915)		IP_VER(RUNTIME_INFO(i915)->media.ip.ver, \
>  					       RUNTIME_INFO(i915)->media.ip.rel)
> -- 
> 2.41.0


More information about the Intel-gfx mailing list