Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe/nvl-p: Add Wa_14028564128
@ 2026-11-18 14:54 Tejas Upadhyay
  2026-11-18 15:11 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Tejas Upadhyay @ 2026-11-18 14:54 UTC (permalink / raw)
  To: intel-xe; +Cc: nitin.r.gote, matthew.d.roper, Tejas Upadhyay

Wa_14028564128 applies to 35.10

Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
---
 drivers/gpu/drm/xe/xe_pat.c        | 32 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_pat.h        | 14 +++++++++++++
 drivers/gpu/drm/xe/xe_vm.c         |  6 ++++--
 drivers/gpu/drm/xe/xe_vm_madvise.c | 11 +++++++---
 drivers/gpu/drm/xe/xe_wa_oob.rules |  1 +
 5 files changed, 59 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_pat.c b/drivers/gpu/drm/xe/xe_pat.c
index 5938fef22579..49c776da4e9f 100644
--- a/drivers/gpu/drm/xe/xe_pat.c
+++ b/drivers/gpu/drm/xe/xe_pat.c
@@ -337,6 +337,13 @@ bool xe_pat_wa_14026539277_reserved(struct xe_device *xe, u16 pat_index)
 		}
 	}
 
+	/*
+	 * Wa_14028564128 remaps PAT index 2 to a safe no-promote/UC/1-way
+	 * value, so it's no longer subject to this restriction once enabled.
+	 */
+	if (xe_pat_wa_14028564128_safe_userptr_index(xe, pat_index))
+		return false;
+
 	/*
 	 * Disallow 2-way coherency for any L3 cache policy because
 	 * XE_L3_POLICY_UC could still be promoted to a cached policy
@@ -345,6 +352,21 @@ bool xe_pat_wa_14026539277_reserved(struct xe_device *xe, u16 pat_index)
 	return has_wa && xe_pat_index_get_coh_mode(xe, pat_index) == XE_COH_2WAY;
 }
 
+bool xe_pat_wa_14028564128_safe_userptr_index(struct xe_device *xe, u16 pat_index)
+{
+	struct xe_gt *gt;
+	u8 id;
+
+	if (pat_index != 2)
+		return false;
+
+	for_each_gt(gt, xe, id)
+		if (XE_GT_WA(gt, 14028564128))
+			return true;
+
+	return false;
+}
+
 static u32 wa_14026539277_fixup_pat_value(struct xe_gt *gt, u32 value)
 {
 	if (XE_GT_WA(gt, 14026539277)) {
@@ -358,6 +380,14 @@ static u32 wa_14026539277_fixup_pat_value(struct xe_gt *gt, u32 value)
 	return value;
 }
 
+static u32 wa_14028564128_fixup_pat_value(struct xe_gt *gt, int index, u32 value)
+{
+	if (index == 2 && XE_GT_WA(gt, 14028564128))
+		value |= XE2_NO_PROMOTE;
+
+	return value;
+}
+
 static const struct xe_pat_table_entry *gt_pta_entry(struct xe_gt *gt)
 {
 	struct xe_device *xe = gt_to_xe(gt);
@@ -420,6 +450,8 @@ static void program_pat_mcr(struct xe_gt *gt, const struct xe_pat_table_entry ta
 		struct xe_reg_mcr reg_mcr = XE_REG_MCR(_PAT_INDEX(i));
 		u32 pat = wa_14026539277_fixup_pat_value(gt, table[i].value);
 
+		pat = wa_14028564128_fixup_pat_value(gt, i, pat);
+
 		xe_gt_mcr_multicast_write(gt, reg_mcr, pat);
 	}
 
diff --git a/drivers/gpu/drm/xe/xe_pat.h b/drivers/gpu/drm/xe/xe_pat.h
index 2ac6ddc66587..247dc0faa095 100644
--- a/drivers/gpu/drm/xe/xe_pat.h
+++ b/drivers/gpu/drm/xe/xe_pat.h
@@ -105,6 +105,20 @@ u16 xe_pat_index_get_l3_policy(struct xe_device *xe, u16 pat_index);
  */
 bool xe_pat_wa_14026539277_reserved(struct xe_device *xe, u16 pat_index);
 
+/**
+ * xe_pat_wa_14028564128_safe_userptr_index - Is this PAT index safe for
+ * misaligned host-pointer userptr/SVM binds due to Wa_14028564128?
+ * @xe: xe device
+ * @pat_index: The pat_index to query
+ *
+ * Wa_14028564128 reprograms PAT index 2 to the no-promote/UC/1-way policy
+ * required for misaligned host pointers; once that WA is enabled, index 2
+ * should be accepted anywhere PAT 19 or a 2-way coherent index already is.
+ *
+ * Return: a boolean indicating whether the PAT index is safe to use.
+ */
+bool xe_pat_wa_14028564128_safe_userptr_index(struct xe_device *xe, u16 pat_index);
+
 #define xe_cache_pat_idx(xe, cache_mode) ({					\
 	const struct xe_device *__xedev = (xe);					\
 	enum xe_cache_level __mode = (cache_mode);				\
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index dd855876f571..80ccaa44720c 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -3888,7 +3888,8 @@ static int vm_bind_ioctl_check_args(struct xe_device *xe, struct xe_vm *vm,
 		    XE_IOCTL_DBG(xe, xe_device_is_l2_flush_optimized(xe) &&
 				 (op == DRM_XE_VM_BIND_OP_MAP_USERPTR ||
 				  is_cpu_addr_mirror) &&
-				 (pat_index != 19 && coh_mode != XE_COH_2WAY)) ||
+				 (pat_index != 19 && coh_mode != XE_COH_2WAY &&
+				  !xe_pat_wa_14028564128_safe_userptr_index(xe, pat_index))) ||
 		    XE_IOCTL_DBG(xe, comp_en &&
 				 op == DRM_XE_VM_BIND_OP_MAP_USERPTR) ||
 		    XE_IOCTL_DBG(xe, op == DRM_XE_VM_BIND_OP_MAP_USERPTR &&
@@ -4033,7 +4034,8 @@ static int xe_vm_bind_ioctl_validate_bo(struct xe_device *xe, struct xe_bo *bo,
 		return -EINVAL;
 
 	if (XE_IOCTL_DBG(xe, bo->ttm.base.import_attach && xe_device_is_l2_flush_optimized(xe) &&
-			 (pat_index != 19 && coh_mode != XE_COH_2WAY)))
+			 (pat_index != 19 && coh_mode != XE_COH_2WAY &&
+			  !xe_pat_wa_14028564128_safe_userptr_index(xe, pat_index))))
 		return -EINVAL;
 
 	/* If a BO is protected it can only be mapped if the key is still valid */
diff --git a/drivers/gpu/drm/xe/xe_vm_madvise.c b/drivers/gpu/drm/xe/xe_vm_madvise.c
index 31245c6c96d4..66895024ada9 100644
--- a/drivers/gpu/drm/xe/xe_vm_madvise.c
+++ b/drivers/gpu/drm/xe/xe_vm_madvise.c
@@ -655,7 +655,8 @@ int xe_vm_madvise_ioctl(struct drm_device *dev, void *data, struct drm_file *fil
 		coh_mode = xe_pat_index_get_coh_mode(xe, pat_index);
 		if (XE_IOCTL_DBG(xe, madvise_range.has_svm_userptr_vmas &&
 				 xe_device_is_l2_flush_optimized(xe) &&
-				 (pat_index != 19 && coh_mode != XE_COH_2WAY))) {
+				 (pat_index != 19 && coh_mode != XE_COH_2WAY &&
+				  !xe_pat_wa_14028564128_safe_userptr_index(xe, pat_index)))) {
 			err = -EINVAL;
 			goto free_vmas;
 		}
@@ -685,10 +686,14 @@ int xe_vm_madvise_ioctl(struct drm_device *dev, void *data, struct drm_file *fil
 					continue;
 
 				if (args->type == DRM_XE_MEM_RANGE_ATTR_PAT) {
+					bool safe_pat = xe_pat_wa_14028564128_safe_userptr_index(xe,
+							pat_index);
+					bool invalid_pat = pat_index != 19 &&
+						coh_mode != XE_COH_2WAY && !safe_pat;
+
 					if (XE_IOCTL_DBG(xe, bo->ttm.base.import_attach &&
 							 xe_device_is_l2_flush_optimized(xe) &&
-							 (pat_index != 19 &&
-							  coh_mode != XE_COH_2WAY))) {
+							 invalid_pat)) {
 						err = -EINVAL;
 						goto err_fini;
 					}
diff --git a/drivers/gpu/drm/xe/xe_wa_oob.rules b/drivers/gpu/drm/xe/xe_wa_oob.rules
index 03b713f55dfb..6a48b2c716ea 100644
--- a/drivers/gpu/drm/xe/xe_wa_oob.rules
+++ b/drivers/gpu/drm/xe/xe_wa_oob.rules
@@ -74,6 +74,7 @@
 16029897822	MEDIA_VERSION(3500)
 		GRAPHICS_VERSION(3510)
 14026539277	GRAPHICS_VERSION(3510), GRAPHICS_STEP(A0, B0)
+14028564128	GRAPHICS_VERSION(3510), GRAPHICS_STEP(A0, B0)
 14027054324	GRAPHICS_VERSION(3511)
 14025941587	GRAPHICS_VERSION_RANGE(2001, 3511)
 		MEDIA_VERSION_RANGE(1301, 3503)
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-18 15:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 14:54 [PATCH] drm/xe/nvl-p: Add Wa_14028564128 Tejas Upadhyay
2026-11-18 15:11 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox