Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: matthew.d.roper@intel.com
Subject: [Intel-gfx] [PATCH 4/8] drm/i915: Eliminate IS_MTL_MEDIA_STEP
Date: Tue, 18 Jul 2023 15:27:58 -0700	[thread overview]
Message-ID: <20230718222753.1075713-14-matthew.d.roper@intel.com> (raw)
In-Reply-To: <20230718222753.1075713-10-matthew.d.roper@intel.com>

Stepping-specific media behavior shouldn't be tied to MTL as a platform,
but rather specifically to the Xe_LPM+ IP.  Future non-MTL platforms may
re-use this IP and will need to follow the exact same logic and apply
the same workarounds.  IS_MTL_MEDIA_STEP() is dropped in favor of a new
macro IS_MEDIA_IPVER_STEP() that checks the media IP version associated
with a specific IP and also ensures that we're operating on the media
GT, not the primary GT.

This new macro will return false if the GT is NULL (so it's safe to pass
i915->media_gt as a parameter, even though that will be NULL on
platforms without standalone media).  We don't expect this macro to used
to match media versions earlier than 13 (when media became a standalone
GT), so a build error will be raised if this macro is used to match on a
pre-13 version of media.  That restriction can be adjusted in the future
if we find a use for this macro on earlier platforms.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_rc6.c |  3 +--
 drivers/gpu/drm/i915/i915_drv.h     | 10 ++++++----
 drivers/gpu/drm/i915/i915_perf.c    | 15 ++++-----------
 3 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_rc6.c b/drivers/gpu/drm/i915/gt/intel_rc6.c
index 58bb1c55294c..91c68c0ec32d 100644
--- a/drivers/gpu/drm/i915/gt/intel_rc6.c
+++ b/drivers/gpu/drm/i915/gt/intel_rc6.c
@@ -526,8 +526,7 @@ static bool rc6_supported(struct intel_rc6 *rc6)
 		return false;
 	}
 
-	if (IS_MTL_MEDIA_STEP(gt->i915, STEP_A0, STEP_B0) &&
-	    gt->type == GT_MEDIA) {
+	if (IS_MEDIA_IPVER_STEP(gt, IP_VER(13, 0), STEP_A0, STEP_B0)) {
 		drm_notice(&i915->drm,
 			   "Media RC6 disabled on A step\n");
 		return false;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index d03710c923c8..10741177b654 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -698,14 +698,16 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
 	  GRAPHICS_VER_FULL(__gt->i915) == ipver && \
 	  IS_GRAPHICS_STEP(__gt->i915, since, until)))
 
+#define IS_MEDIA_IPVER_STEP(__gt, ipver, since, until) \
+	(BUILD_BUG_ON_ZERO(ipver < IP_VER(13, 0)) + \
+	 (__gt && __gt->type == GT_MEDIA && \
+	  MEDIA_VER_FULL(__gt->i915) == ipver && \
+	  IS_MEDIA_STEP(__gt->i915, since, until)))
+
 #define IS_MTL_DISPLAY_STEP(__i915, since, until) \
 	(IS_METEORLAKE(__i915) && \
 	 IS_DISPLAY_STEP(__i915, since, until))
 
-#define IS_MTL_MEDIA_STEP(__i915, since, until) \
-	(IS_METEORLAKE(__i915) && \
-	 IS_MEDIA_STEP(__i915, since, until))
-
 /*
  * DG2 hardware steppings are a bit unusual.  The hardware design was forked to
  * create three variants (G10, G11, and G12) which each have distinct
diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 49c6f1ff1128..ff95f2cdf2b0 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -4223,7 +4223,7 @@ static int read_properties_unlocked(struct i915_perf *perf,
 	 * C6 disable in BIOS. Fail if Media C6 is enabled on steppings where OAM
 	 * does not work as expected.
 	 */
-	if (IS_MTL_MEDIA_STEP(props->engine->i915, STEP_A0, STEP_C0) &&
+	if (IS_MEDIA_IPVER_STEP(props->engine->gt, IP_VER(13, 0), STEP_A0, STEP_C0) &&
 	    props->engine->oa_group->type == TYPE_OAM &&
 	    intel_check_bios_c6_setup(&props->engine->gt->rc6)) {
 		drm_dbg(&perf->i915->drm,
@@ -5332,16 +5332,9 @@ int i915_perf_ioctl_version(struct drm_i915_private *i915)
 	 * C6 disable in BIOS. If Media C6 is enabled in BIOS, return version 6
 	 * to indicate that OA media is not supported.
 	 */
-	if (IS_MTL_MEDIA_STEP(i915, STEP_A0, STEP_C0)) {
-		struct intel_gt *gt;
-		int i;
-
-		for_each_gt(gt, i915, i) {
-			if (gt->type == GT_MEDIA &&
-			    intel_check_bios_c6_setup(&gt->rc6))
-				return 6;
-		}
-	}
+	if (IS_MEDIA_IPVER_STEP(i915->media_gt, IP_VER(13, 0), STEP_A0, STEP_C0) &&
+	    intel_check_bios_c6_setup(&i915->media_gt->rc6))
+		return 6;
 
 	return 7;
 }
-- 
2.41.0


  parent reply	other threads:[~2023-07-18 22:28 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-18 22:27 [Intel-gfx] [PATCH 0/8] Reduce MTL-specific platform checks Matt Roper
2023-07-18 22:27 ` [Intel-gfx] [PATCH 1/8] drm/i915: Consolidate condition for Wa_22011802037 Matt Roper
2023-07-19 17:22   ` Gustavo Sousa
2023-07-18 22:27 ` [Intel-gfx] [PATCH 2/8] drm/i915/xelpg: Call Xe_LPG workaround functions based on IP version Matt Roper
2023-07-19 18:30   ` Gustavo Sousa
2023-07-18 22:27 ` [Intel-gfx] [PATCH 3/8] drm/i915: Eliminate IS_MTL_GRAPHICS_STEP Matt Roper
2023-07-19  8:01   ` Tvrtko Ursulin
2023-07-19 15:28     ` Matt Roper
2023-07-19 22:54       ` Matt Roper
2023-07-20  9:36         ` Tvrtko Ursulin
2023-07-20 13:10           ` Andrzej Hajda
2023-07-25  0:12             ` Matt Roper
2023-07-20  9:23       ` Tvrtko Ursulin
2023-07-18 22:27 ` Matt Roper [this message]
2023-07-18 22:27 ` [Intel-gfx] [PATCH 5/8] drm/i915: Eliminate IS_MTL_DISPLAY_STEP Matt Roper
2023-07-19 19:22   ` Gustavo Sousa
2023-07-18 22:28 ` [Intel-gfx] [PATCH 6/8] drm/i915/mtl: Eliminate subplatforms Matt Roper
2023-07-19 18:13   ` Garg, Nemesa
2023-07-19 19:27   ` Gustavo Sousa
2023-07-18 22:28 ` [Intel-gfx] [PATCH 7/8] drm/i915/display: Eliminate IS_METEORLAKE checks Matt Roper
2023-07-19 19:39   ` Gustavo Sousa
2023-07-19 19:43     ` Gustavo Sousa
2023-07-18 22:28 ` [Intel-gfx] [PATCH 8/8] drm/i915: Replace several IS_METEORLAKE with proper IP version checks Matt Roper
2023-07-19  7:57   ` Tvrtko Ursulin
2023-07-19 15:22     ` Matt Roper
2023-07-20  9:19       ` Tvrtko Ursulin
2023-07-18 23:37 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Reduce MTL-specific platform checks Patchwork
2023-07-18 23:37 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-07-19  0:00 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-07-19  1:53 ` [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=20230718222753.1075713-14-matthew.d.roper@intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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