Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Matt Roper <matthew.d.roper@intel.com>, intel-gfx@lists.freedesktop.org
Cc: matthew.d.roper@intel.com
Subject: Re: [Intel-gfx] [PATCH v2 4/9] drm/i915: Eliminate IS_MTL_GRAPHICS_STEP
Date: Tue, 01 Aug 2023 10:57:39 +0300	[thread overview]
Message-ID: <87tttjw5xo.fsf@intel.com> (raw)
In-Reply-To: <20230725001312.1907319-15-matthew.d.roper@intel.com>

On Mon, 24 Jul 2023, Matt Roper <matthew.d.roper@intel.com> wrote:
> +/*
> + * Check whether a GT contains the specific IP version and a stepping within
> + * the specified range [from, until).  The lower stepping bound is inclusive,
> + * the upper bound is exclusive (corresponding to the first hardware stepping
> + * at when the workaround is no longer needed).  E.g.,
> + *
> + *    IS_GT_IP_STEP(GFX, IP_VER(12, 70), A0, B0)
> + *    IS_GT_IP_STEP(MEDIA, IP_VER(13, 00), B1, D0)
> + *    IS_GT_IP_STEP(GFX, IP_VER(12, 71), B1, FOREVER)
> + *
> + * "FOREVER" can be passed as the upper stepping bound for workarounds that
> + * have no upper bound on steppings of the specified IP version.
> + *
> + * 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_STEP(type, gt, ipver, since, until) \
> +	(BUILD_BUG_ON_ZERO(ipver < IP_VER(2, 0)) + \
> +	 (__IS_##type##_GT(gt) && \
> +	  __GT_VER_FULL(gt) == ipver && \
> +	  __GT_STEP(gt) >= STEP_##since && \
> +	  __GT_STEP(gt) <= STEP_##until))
> +

I really dislike the type, since and until arguments here, passing in
something that becomes part of the name of another macro. That's
something we do in some of our macro spaghetti internally, but not as
part of an interface that gets called all over the place.

For function-like macros, I'd generally like to make them such that they
could be converted to regular (static inline) functions without changing
the call sites.

BR,
Jani.


>  #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)
> @@ -710,10 +736,6 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
>  #define IS_XEHPSDV_GRAPHICS_STEP(__i915, since, until) \
>  	(IS_XEHPSDV(__i915) && IS_GRAPHICS_STEP(__i915, since, until))
>  
> -#define IS_MTL_GRAPHICS_STEP(__i915, variant, since, until) \
> -	(IS_SUBPLATFORM(__i915, INTEL_METEORLAKE, INTEL_SUBPLATFORM_##variant) && \
> -	 IS_GRAPHICS_STEP(__i915, since, until))
> -
>  #define IS_MTL_DISPLAY_STEP(__i915, since, until) \
>  	(IS_METEORLAKE(__i915) && \
>  	 IS_DISPLAY_STEP(__i915, since, until))

-- 
Jani Nikula, Intel Open Source Graphics Center

  parent reply	other threads:[~2023-08-01  7:57 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-25  0:13 [Intel-gfx] [PATCH v2 0/9] Reduce MTL-specific platform checks Matt Roper
2023-07-25  0:13 ` [Intel-gfx] [PATCH v2 1/9] drm/i915: Consolidate condition for Wa_22011802037 Matt Roper
2023-07-25  9:21   ` Andi Shyti
2023-07-25 15:13     ` Matt Roper
2023-07-25  0:13 ` [Intel-gfx] [PATCH v2 2/9] drm/i915/xelpmp: Don't assume workarounds extend to future platforms Matt Roper
2023-07-25  9:32   ` Andi Shyti
2023-07-25  0:13 ` [Intel-gfx] [PATCH v2 3/9] drm/i915/xelpg: Call Xe_LPG workaround functions based on IP version Matt Roper
2023-07-25  9:51   ` Andi Shyti
2023-07-25 12:02   ` Tvrtko Ursulin
2023-07-25 15:35     ` Matt Roper
2023-07-25 15:52       ` Tvrtko Ursulin
2023-07-25 16:02         ` Matt Roper
2023-07-25  0:13 ` [Intel-gfx] [PATCH v2 4/9] drm/i915: Eliminate IS_MTL_GRAPHICS_STEP Matt Roper
2023-07-25 10:04   ` Andi Shyti
2023-07-25 15:45     ` Matt Roper
2023-07-25 12:10   ` Tvrtko Ursulin
2023-07-25 15:55     ` Matt Roper
2023-08-01  7:57   ` Jani Nikula [this message]
2023-07-25  0:13 ` [Intel-gfx] [PATCH v2 5/9] drm/i915: Eliminate IS_MTL_MEDIA_STEP Matt Roper
2023-07-25  0:13 ` [Intel-gfx] [PATCH v2 6/9] drm/i915: Eliminate IS_MTL_DISPLAY_STEP Matt Roper
2023-07-25  0:13 ` [Intel-gfx] [PATCH v2 7/9] drm/i915/mtl: Eliminate subplatforms Matt Roper
2023-07-25  0:13 ` [Intel-gfx] [PATCH v2 8/9] drm/i915/display: Eliminate IS_METEORLAKE checks Matt Roper
2023-07-27 18:38   ` Lucas De Marchi
2023-07-27 19:05     ` Matt Roper
2023-07-25  0:13 ` [Intel-gfx] [PATCH v2 9/9] drm/i915: Replace several IS_METEORLAKE with proper IP version checks Matt Roper
2023-07-25 10:10   ` Andi Shyti
2023-07-25 16:16     ` Matt Roper
2023-07-25  1:01 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Reduce MTL-specific platform checks (rev2) Patchwork
2023-07-25  1:01 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-07-25  1:19 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-07-25  9:49 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tttjw5xo.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.d.roper@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox