Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: matthew.d.roper@intel.com
Subject: [PATCH] drm/xe/mtl: Add Wa_22018931422
Date: Tue, 14 Jan 2025 11:02:43 -0800	[thread overview]
Message-ID: <20250114190242.2026743-2-matthew.d.roper@intel.com> (raw)

Although Wa_22018931422 still isn't fully documented in the hardware
database, it's been implemented in i915 for over a year and has been
successful at fixing MCR lock timeout issues.  Bring the same workaround
over to the Xe driver.

Since the official documentation for this workaround still isn't fully
complete, there isn't clear guidance on exactly which platform(s)
are/aren't impacted, but our belief is that this should be applied to
the graphics and media IPs used by MTL and ARL platforms.  Offline
discussion with the hardware teams indicated that this should not be
relevant to any Xe2 or later platforms.

Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/4059
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/xe/xe_gt_mcr.c     | 27 ++++++++++++++++++++++++++-
 drivers/gpu/drm/xe/xe_gt_types.h   |  6 ++++++
 drivers/gpu/drm/xe/xe_wa_oob.rules |  2 ++
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_gt_mcr.c b/drivers/gpu/drm/xe/xe_gt_mcr.c
index a1676b787fdc..f2699ac9a4f6 100644
--- a/drivers/gpu/drm/xe/xe_gt_mcr.c
+++ b/drivers/gpu/drm/xe/xe_gt_mcr.c
@@ -5,8 +5,11 @@
 
 #include "xe_gt_mcr.h"
 
+#include <generated/xe_wa_oob.h>
+
 #include "regs/xe_gt_regs.h"
 #include "xe_assert.h"
+#include "xe_force_wake.h"
 #include "xe_gt.h"
 #include "xe_gt_printk.h"
 #include "xe_gt_topology.h"
@@ -14,6 +17,7 @@
 #include "xe_guc_hwconfig.h"
 #include "xe_mmio.h"
 #include "xe_sriov.h"
+#include "xe_wa.h"
 
 /**
  * DOC: GT Multicast/Replicated (MCR) Register Support
@@ -607,9 +611,27 @@ static void mcr_lock(struct xe_gt *gt) __acquires(&gt->mcr_lock)
 	 * shares the same steering control register. The semaphore is obtained
 	 * when a read to the relevant register returns 1.
 	 */
-	if (GRAPHICS_VERx100(xe) >= 1270)
+	if (GRAPHICS_VERx100(xe) >= 1270) {
+		/*
+		 * The steering control and semaphore registers are inside an
+		 * "always on" power domain with respect to RC6.  However there
+		 * are some issues if higher-level platform sleep states are
+		 * entering/exiting at the same time these registers are
+		 * accessed.  Grabbing GT forcewake and holding it over the
+		 * entire lock/steer/unlock cycle ensures that those sleep
+		 * states have been fully exited before we access these
+		 * registers.  This wakeref will be released in the unlock
+		 * routine.
+		 */
+		if (XE_WA(gt, 22018931422)) {
+			gt->mcr_fw = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
+			xe_gt_WARN(gt, !gt->mcr_fw,
+				   "Could not grab forcewake during MCR steering\n");
+		}
+
 		ret = xe_mmio_wait32(&gt->mmio, STEER_SEMAPHORE, 0x1, 0x1, 10, NULL,
 				     true);
+	}
 
 	drm_WARN_ON_ONCE(&xe->drm, ret == -ETIMEDOUT);
 }
@@ -620,6 +642,9 @@ static void mcr_unlock(struct xe_gt *gt) __releases(&gt->mcr_lock)
 	if (GRAPHICS_VERx100(gt_to_xe(gt)) >= 1270)
 		xe_mmio_write32(&gt->mmio, STEER_SEMAPHORE, 0x1);
 
+	if (XE_WA(gt, 22018931422))
+		xe_force_wake_put(gt_to_fw(gt), gt->mcr_fw);
+
 	spin_unlock(&gt->mcr_lock);
 }
 
diff --git a/drivers/gpu/drm/xe/xe_gt_types.h b/drivers/gpu/drm/xe/xe_gt_types.h
index 6e66bf0e8b3f..2e0c138599de 100644
--- a/drivers/gpu/drm/xe/xe_gt_types.h
+++ b/drivers/gpu/drm/xe/xe_gt_types.h
@@ -389,6 +389,12 @@ struct xe_gt {
 	 */
 	spinlock_t mcr_lock;
 
+	/**
+	 * @mcr_fw: Forcewake reference during MCR steering (only used when
+	 *    Wa_22018931422 is in effect).
+	 */
+	unsigned int mcr_fw;
+
 	/**
 	 * @global_invl_lock: protects the register for the duration
 	 *    of a global invalidation of l2 cache
diff --git a/drivers/gpu/drm/xe/xe_wa_oob.rules b/drivers/gpu/drm/xe/xe_wa_oob.rules
index 40438c3d9b72..92a922bad630 100644
--- a/drivers/gpu/drm/xe/xe_wa_oob.rules
+++ b/drivers/gpu/drm/xe/xe_wa_oob.rules
@@ -42,3 +42,5 @@
 no_media_l3	MEDIA_VERSION(3000)
 14022866841	GRAPHICS_VERSION(3000), GRAPHICS_STEP(A0, B0)
 		MEDIA_VERSION(3000), MEDIA_STEP(A0, B0)
+22018931422	GRAPHICS_VERSION_RANGE(1270, 1274)
+		MEDIA_VERSION(1300)
-- 
2.47.1


             reply	other threads:[~2025-01-14 19:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-14 19:02 Matt Roper [this message]
2025-01-14 19:50 ` [PATCH] drm/xe/mtl: Add Wa_22018931422 Cavitt, Jonathan
2025-01-14 20:32 ` Mishra, Pallavi
2025-01-14 20:55 ` ✓ CI.Patch_applied: success for " Patchwork
2025-01-14 20:55 ` ✓ CI.checkpatch: " Patchwork
2025-01-14 20:56 ` ✓ CI.KUnit: " Patchwork
2025-01-14 21:14 ` ✓ CI.Build: " Patchwork
2025-01-14 21:17 ` ✓ CI.Hooks: " Patchwork
2025-01-14 21:18 ` ✓ CI.checksparse: " Patchwork
2025-01-15 18:19 ` ✓ CI.Patch_applied: success for drm/xe/mtl: Add Wa_22018931422 (rev2) Patchwork
2025-01-15 18:19 ` ✓ CI.checkpatch: " Patchwork
2025-01-15 18:20 ` ✓ CI.KUnit: " Patchwork
2025-01-15 18:38 ` ✓ CI.Build: " Patchwork
2025-01-15 18:41 ` ✓ CI.Hooks: " Patchwork
2025-01-15 18:42 ` ✓ CI.checksparse: " Patchwork
2025-01-15 19:07 ` ✓ Xe.CI.BAT: " Patchwork
2025-01-15 23:56 ` ✗ Xe.CI.Full: 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=20250114190242.2026743-2-matthew.d.roper@intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=intel-xe@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