Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/17] Work around media 52-bit limitation on CRI
@ 2026-11-21 18:23 Stuart Summers
  2026-11-21 18:23 ` [PATCH 01/17] drm/xe/sysctrl: Use preallocated mailbox staging buffers Stuart Summers
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: Stuart Summers @ 2026-11-21 18:23 UTC (permalink / raw)
  Cc: rodrigo.vivi, riana.tauro, anoop.c.vijay, matthew.d.roper,
	fei.yang, intel-xe, Stuart Summers

Note this is somewhat of an RFC right now to get early feedback. I'm
planning a follow up to clean some of this up shortly.

This is a combination of two series I have on the list now, [1] and [2].
I've already gotten some feedback from Rodrigo and Sashiko on both of
these I'm planning to incorporate. Apologies those updates didn't make
it in to this series yet. I'm also planning on reviewing at least [1]
separately since this likely needs more discussion anyway and isn't
strictly related/required to the current series.

The main two patches I'm interested in getting feedback in the meantime
are:
  drm/xe: Add enable_media module parameter
  drm/xe: Work around media 52-bit limitation on CRI

The latter is the crux of the workaround here. The first sets up
the module parameter which will be used to disable media by default.

The reason to include a module parameter here is we have some customers
who are planning many CRI devices on a single host. The request from
those customers is to have a way to configure all of the cards on
that host at one time rather than having to loop through each device
separately (i.e. module parameter instead of configfs). We do already
have a configfs that allows media to be disabled
(gt_types_allowed = 'primary'), but this is both meant for developer
debug, not production configuration, and it requires that per-device
configuration.

The workaround details are provided in that last patch in the series
so I won't duplicate all of that here, but at a high level, media
is now disabled by default and in order to maintain performance for
compute when media is enabled on a system that supports 52-bit
addressing, PCIe level address translation is supported, but an
internal configuration of address translation for the media GAM
is disabled. Again, the details of how this is done are in that last
patch.

Again, I'm not planning on merging these as-is, but just to clarify,
[1] is attempting to separate the primary and media GT. This is mostly
for debug but also used to refactor for that last patch. Likely in
the repost I'll just drop this for now and review it completely
separately, skipping this refactor unless it's deemed particularly
interesting.

[2] is adding a few fixes and refactors in preparation for the actual
workaround so I'll be keeping these in the repost. Two of the three
patches there have been reviewed (with some feedback) already. The
third I'm planning to drop after feedback from Rodrigo.

v2:
 - Again, no plan to merge as-is. To facilitate some testing of
   different GFSP versions, temporarily downgrade the error handling
   for the media defeature command. See that last patch for details.

[1] https://patchwork.freedesktop.org/series/178247/
[2] https://patchwork.freedesktop.org/series/177792/

Stuart Summers (17):
  drm/xe/sysctrl: Use preallocated mailbox staging buffers
  drm/xe: Process device OOB workarounds during early info init
  drm/xe/sysctrl: Restore the SoC remapper on every runtime resume
  drm/xe: Add enable_media module parameter
  drm/xe: Detect each GMD_ID IP in a loop
  drm/xe: Tolerate a missing graphics IP in xe_info_init()
  drm/xe: Verify IP presence against GU_CNTL
  drm/xe: Guard per-tile primary GT accesses
  drm/xe: Stop assuming the root tile has a primary GT
  drm/xe: Do not claim flat CCS without a graphics IP
  drm/xe: Run page table updates on the media GT when there is no
    primary
  drm/xe: Document that gt_types_allowed=media now probes
  drm/xe: Fall back to CPU copies when the tile cannot blit
  drm/xe: Require a fully visible VRAM BAR without a primary GT
  drm/xe: Allow probe without a primary GT
  drm/xe: Work around media 52-bit limitation on CRI
  drm/xe: Don't error on failed media defeature

 drivers/gpu/drm/xe/regs/xe_regs.h             |   2 +
 drivers/gpu/drm/xe/xe_bo.c                    |  43 +++-
 drivers/gpu/drm/xe/xe_configfs.c              |  10 +-
 drivers/gpu/drm/xe/xe_defaults.h              |   1 +
 drivers/gpu/drm/xe/xe_device.c                |  27 +-
 drivers/gpu/drm/xe/xe_device.h                |  17 ++
 drivers/gpu/drm/xe/xe_device_types.h          |   2 +
 drivers/gpu/drm/xe/xe_device_wa_oob.rules     |   1 +
 drivers/gpu/drm/xe/xe_exec_queue.c            |   5 +-
 drivers/gpu/drm/xe/xe_gt.c                    |  11 +-
 drivers/gpu/drm/xe/xe_memirq.c                |   3 +-
 drivers/gpu/drm/xe/xe_migrate.c               |  45 +++-
 drivers/gpu/drm/xe/xe_migrate.h               |   2 +
 drivers/gpu/drm/xe/xe_module.c                |   7 +
 drivers/gpu/drm/xe/xe_module.h                |   1 +
 drivers/gpu/drm/xe/xe_oa.c                    |  24 +-
 drivers/gpu/drm/xe/xe_pagefault.c             |   4 +-
 drivers/gpu/drm/xe/xe_pci.c                   | 241 ++++++++++++++----
 drivers/gpu/drm/xe/xe_pm.c                    |  13 +-
 drivers/gpu/drm/xe/xe_query.c                 |   3 +-
 drivers/gpu/drm/xe/xe_ras.c                   |  18 +-
 drivers/gpu/drm/xe/xe_sysctrl.c               | 195 +++++++++++++-
 drivers/gpu/drm/xe/xe_sysctrl.h               |   2 +
 drivers/gpu/drm/xe/xe_sysctrl_debugfs.c       |   6 +-
 drivers/gpu/drm/xe/xe_sysctrl_event.c         |   2 +-
 drivers/gpu/drm/xe/xe_sysctrl_mailbox.c       |  81 +++---
 drivers/gpu/drm/xe/xe_sysctrl_mailbox.h       |   3 +-
 drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h |  34 +++
 drivers/gpu/drm/xe/xe_sysctrl_types.h         |  17 ++
 drivers/gpu/drm/xe/xe_tile.h                  |  32 +++
 drivers/gpu/drm/xe/xe_tlb_inval.c             |  20 +-
 drivers/gpu/drm/xe/xe_vm.c                    |   2 +-
 drivers/gpu/drm/xe/xe_vram.c                  |  15 ++
 33 files changed, 710 insertions(+), 179 deletions(-)

-- 
2.43.0


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

* [PATCH 01/17] drm/xe/sysctrl: Use preallocated mailbox staging buffers
  2026-11-21 18:23 [PATCH 00/17] Work around media 52-bit limitation on CRI Stuart Summers
@ 2026-11-21 18:23 ` Stuart Summers
  2026-11-21 18:23 ` [PATCH 02/17] drm/xe: Process device OOB workarounds during early info init Stuart Summers
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Stuart Summers @ 2026-11-21 18:23 UTC (permalink / raw)
  Cc: rodrigo.vivi, riana.tauro, anoop.c.vijay, matthew.d.roper,
	fei.yang, intel-xe, Stuart Summers

Every mailbox command stages its request and response through a buffer
allocated with GFP_KERNEL. Both are bounded by the maximum mailbox
message size and the command mutex already serialises every sender, so
embed them in struct xe_sysctrl and drop the per-command allocation.

This removes the only failure mode from sysctrl_prepare_command(), so
return the command size directly, and allows commands to be sent from
contexts where a GFP_KERNEL allocation is not possible - such as the
runtime resume path, which gains a sender later in this series.

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/xe/xe_sysctrl_mailbox.c | 56 +++++++++----------------
 drivers/gpu/drm/xe/xe_sysctrl_types.h   | 11 +++++
 2 files changed, 31 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c b/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
index f1a231dfec1e..2af73c62d32d 100644
--- a/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
+++ b/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
@@ -6,7 +6,6 @@
 #include <linux/bitfield.h>
 #include <linux/cleanup.h>
 #include <linux/minmax.h>
-#include <linux/slab.h>
 #include <linux/sprintf.h>
 #include <linux/string.h>
 
@@ -103,36 +102,27 @@ static void sysctrl_clear_response(struct xe_sysctrl *sc)
 	xe_mmio_rmw32(sc->mmio, SYSCTRL_MB_CTRL, SYSCTRL_MB_CTRL_RUN_BUSY_OUT, 0);
 }
 
-static int sysctrl_prepare_command(struct xe_device *xe,
-				   u8 group_id, u8 command,
-				   const void *data_in, size_t data_in_len,
-				   u8 **mbox_cmd, size_t *cmd_size)
+static size_t sysctrl_prepare_command(struct xe_sysctrl *sc,
+				      u8 group_id, u8 command,
+				      const void *data_in, size_t data_in_len)
 {
 	struct xe_sysctrl_mailbox_msg_hdr *hdr;
-	size_t size;
-	u8 *buffer;
+	struct xe_device *xe = sc_to_xe(sc);
+
+	lockdep_assert_held(&sc->cmd_lock);
 
 	xe_assert(xe, command <= SYSCTRL_HDR_COMMAND_MAX);
 
 	xe_assert(xe, data_in_len <= XE_SYSCTRL_MB_MAX_MESSAGE_SIZE - sizeof(*hdr));
 
-	size = sizeof(*hdr) + data_in_len;
-
-	buffer = kmalloc(size, GFP_KERNEL);
-	if (!buffer)
-		return -ENOMEM;
-
-	hdr = (struct xe_sysctrl_mailbox_msg_hdr *)buffer;
+	hdr = (struct xe_sysctrl_mailbox_msg_hdr *)sc->cmd_buf;
 	hdr->data = REG_FIELD_PREP(SYSCTRL_HDR_GROUP_ID_MASK, group_id) |
 		    REG_FIELD_PREP(SYSCTRL_HDR_COMMAND_MASK, command);
 
 	if (data_in && data_in_len)
-		memcpy(buffer + sizeof(*hdr), data_in, data_in_len);
-
-	*mbox_cmd = buffer;
-	*cmd_size = size;
+		memcpy(sc->cmd_buf + sizeof(*hdr), data_in, data_in_len);
 
-	return 0;
+	return sizeof(*hdr) + data_in_len;
 }
 
 static int sysctrl_send_frames(struct xe_sysctrl *sc,
@@ -231,14 +221,17 @@ static int sysctrl_receive_frames(struct xe_sysctrl *sc,
 	struct xe_sysctrl_mailbox_msg_hdr *hdr;
 	struct xe_device *xe = sc_to_xe(sc);
 	size_t remain = sizeof(*hdr) + data_out_len;
-	u8 *buffer __free(kfree) = kzalloc(remain, GFP_KERNEL);
+	u8 *buffer = sc->resp_buf;
 	size_t frame_size;
 	bool done = false;
 	int ret = 0;
 	u8 *out;
 
-	if (!buffer)
-		return -ENOMEM;
+	lockdep_assert_held(&sc->cmd_lock);
+
+	xe_assert(xe, data_out_len <= XE_SYSCTRL_MB_MAX_MESSAGE_SIZE - sizeof(*hdr));
+
+	memset(buffer, 0, remain);
 
 	out = buffer;
 	while (!done && remain) {
@@ -360,8 +353,7 @@ int xe_sysctrl_send_command(struct xe_sysctrl *sc,
 {
 	struct xe_device *xe = sc_to_xe(sc);
 	u8 group_id, command_code;
-	u8 *mbox_cmd = NULL;
-	size_t cmd_size = 0;
+	size_t cmd_size;
 	unsigned int timeout_ms;
 	int ret;
 
@@ -380,25 +372,17 @@ int xe_sysctrl_send_command(struct xe_sysctrl *sc,
 
 	might_sleep();
 
-	ret = sysctrl_prepare_command(xe, group_id, command_code,
-				      cmd->data_in, cmd->data_in_len,
-				      &mbox_cmd, &cmd_size);
-	if (ret) {
-		xe_log_err(xe, SYSCTRL, ret, "Failed to prepare command %#x.%#x\n",
-			   group_id, command_code);
-		return ret;
-	}
-
 	guard(mutex)(&sc->cmd_lock);
 
-	ret = sysctrl_send_command(sc, mbox_cmd, cmd_size,
+	cmd_size = sysctrl_prepare_command(sc, group_id, command_code,
+					   cmd->data_in, cmd->data_in_len);
+
+	ret = sysctrl_send_command(sc, sc->cmd_buf, cmd_size,
 				   cmd->data_out, cmd->data_out_len, rdata_len,
 				   timeout_ms);
 	if (ret)
 		xe_log_err(xe, SYSCTRL, ret, "Mailbox command failed to send %#x.%#x\n",
 			   group_id, command_code);
 
-	kfree(mbox_cmd);
-
 	return ret;
 }
diff --git a/drivers/gpu/drm/xe/xe_sysctrl_types.h b/drivers/gpu/drm/xe/xe_sysctrl_types.h
index f12455f2886d..605bdc62e0bf 100644
--- a/drivers/gpu/drm/xe/xe_sysctrl_types.h
+++ b/drivers/gpu/drm/xe/xe_sysctrl_types.h
@@ -58,6 +58,17 @@ struct xe_sysctrl {
 	/** @cmd_lock: Mutex protecting mailbox command operations */
 	struct mutex cmd_lock;
 
+	/**
+	 * @cmd_buf: Request staging buffer, sized to the maximum mailbox
+	 * message. Preallocated because commands are sent from the runtime
+	 * resume path, which may be entered from reclaim. Protected by
+	 * @cmd_lock.
+	 */
+	u8 cmd_buf[XE_SYSCTRL_MB_MAX_MESSAGE_SIZE];
+
+	/** @resp_buf: Response staging buffer, see @cmd_buf */
+	u8 resp_buf[XE_SYSCTRL_MB_MAX_MESSAGE_SIZE];
+
 	/** @work: Pending events worker */
 	struct work_struct work;
 
-- 
2.43.0


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

* [PATCH 02/17] drm/xe: Process device OOB workarounds during early info init
  2026-11-21 18:23 [PATCH 00/17] Work around media 52-bit limitation on CRI Stuart Summers
  2026-11-21 18:23 ` [PATCH 01/17] drm/xe/sysctrl: Use preallocated mailbox staging buffers Stuart Summers
@ 2026-11-21 18:23 ` Stuart Summers
  2026-11-21 18:23 ` [PATCH 03/17] drm/xe/sysctrl: Restore the SoC remapper on every runtime resume Stuart Summers
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Stuart Summers @ 2026-11-21 18:23 UTC (permalink / raw)
  Cc: rodrigo.vivi, riana.tauro, anoop.c.vijay, matthew.d.roper,
	fei.yang, intel-xe, Stuart Summers

Device OOB workarounds only match on platform, subplatform and platform
step, all of which are known once xe_info_init_early() has copied them
out of the device descriptor. Processing them there instead of in
xe_device_probe_early() makes XE_DEVICE_WA() usable for the rest of
early probe, which runs before xe_device_probe_early().

While moving the call, check the return value of xe_wa_device_init(),
which the old call site silently dropped.

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/xe/xe_device.c |  3 ---
 drivers/gpu/drm/xe/xe_pci.c    | 14 ++++++++++++++
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index f5a581d39c96..b053a788d59c 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -715,9 +715,6 @@ int xe_device_probe_early(struct xe_device *xe)
 {
 	int err;
 
-	xe_wa_device_init(xe);
-	xe_wa_process_device_oob(xe);
-
 	err = xe_mmio_probe_early(xe);
 	if (err)
 		return err;
diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
index 619653c68f2c..fb2a5f3311c8 100644
--- a/drivers/gpu/drm/xe/xe_pci.c
+++ b/drivers/gpu/drm/xe/xe_pci.c
@@ -15,6 +15,8 @@
 #include <drm/drm_drv.h>
 #include <drm/intel/pciids.h>
 
+#include <generated/xe_device_wa_oob.h>
+
 #include "display/xe_display.h"
 #include "regs/xe_gt_regs.h"
 #include "regs/xe_regs.h"
@@ -40,6 +42,7 @@
 #include "xe_tile.h"
 #include "xe_tile_printk.h"
 #include "xe_wedge.h"
+#include "xe_wa.h"
 
 enum toggle_d3cold {
 	D3COLD_DISABLE,
@@ -795,6 +798,17 @@ static int xe_info_init_early(struct xe_device *xe,
 	xe->info.subplatform = subplatform_desc ?
 		subplatform_desc->subplatform : XE_SUBPLATFORM_NONE;
 
+	/*
+	 * Device OOB workarounds only match on platform, subplatform and
+	 * platform step, which are all known by now, so process them here and
+	 * make XE_DEVICE_WA() usable for the remainder of early probe.
+	 */
+	err = xe_wa_device_init(xe);
+	if (err)
+		return err;
+
+	xe_wa_process_device_oob(xe);
+
 	xe->info.dma_mask_size = desc->dma_mask_size;
 	xe->info.va_bits = desc->va_bits;
 	xe->info.vm_max_level = desc->vm_max_level;
-- 
2.43.0


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

* [PATCH 03/17] drm/xe/sysctrl: Restore the SoC remapper on every runtime resume
  2026-11-21 18:23 [PATCH 00/17] Work around media 52-bit limitation on CRI Stuart Summers
  2026-11-21 18:23 ` [PATCH 01/17] drm/xe/sysctrl: Use preallocated mailbox staging buffers Stuart Summers
  2026-11-21 18:23 ` [PATCH 02/17] drm/xe: Process device OOB workarounds during early info init Stuart Summers
@ 2026-11-21 18:23 ` Stuart Summers
  2026-11-21 18:23 ` [PATCH 04/17] drm/xe: Add enable_media module parameter Stuart Summers
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Stuart Summers @ 2026-11-21 18:23 UTC (permalink / raw)
  Cc: rodrigo.vivi, riana.tauro, anoop.c.vijay, matthew.d.roper,
	fei.yang, intel-xe, Stuart Summers

The SoC remapper configuration is lost whenever the device loses power,
and @d3cold.allowed only records the state xe asked the PCI core for.
The platform can still drop power behind our back when the bridge above
us runtime suspends, which leaves the remapper unprogrammed and any
later System Controller access pointed at nothing.

Restore it on every runtime resume instead.

Fixes: 02eca6edcb32 ("drm/xe/xe_sysctrl: Add System Controller power management support")
Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/xe/xe_pm.c      | 9 +++++++--
 drivers/gpu/drm/xe/xe_sysctrl.c | 6 ++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
index f73f68bd449b..d25dbec6472e 100644
--- a/drivers/gpu/drm/xe/xe_pm.c
+++ b/drivers/gpu/drm/xe/xe_pm.c
@@ -654,8 +654,13 @@ int xe_pm_runtime_resume(struct xe_device *xe)
 
 	xe_i2c_pm_resume(xe, xe->d3cold.allowed);
 
-	if (xe->d3cold.allowed)
-		xe_sysctrl_pm_resume(xe);
+	/*
+	 * Done unconditionally: @d3cold.allowed is only the state xe asked the
+	 * PCI core for, the platform can still drop power when the bridge
+	 * above us runtime suspends, taking the SoC remapper configuration
+	 * with it.
+	 */
+	xe_sysctrl_pm_resume(xe);
 
 	xe_display_pm_runtime_resume_early(xe);
 
diff --git a/drivers/gpu/drm/xe/xe_sysctrl.c b/drivers/gpu/drm/xe/xe_sysctrl.c
index d362e8156fca..405d339d6a7d 100644
--- a/drivers/gpu/drm/xe/xe_sysctrl.c
+++ b/drivers/gpu/drm/xe/xe_sysctrl.c
@@ -129,8 +129,10 @@ void xe_sysctrl_irq_handler(struct xe_device *xe, u32 master_ctl)
  * xe_sysctrl_pm_resume() - System Controller resume handler
  * @xe: xe device instance
  *
- * Invoked during system resume (S3/S4 to S0) and runtime resume from D3cold.
- * Restores SoC remapper configuration.
+ * Invoked during system resume (S3/S4 to S0) and on every runtime resume.
+ * Restores SoC remapper configuration, which is lost whenever the device
+ * loses power - including when the platform drops power behind our back
+ * because the bridge above us runtime suspended.
  */
 void xe_sysctrl_pm_resume(struct xe_device *xe)
 {
-- 
2.43.0


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

* [PATCH 04/17] drm/xe: Add enable_media module parameter
  2026-11-21 18:23 [PATCH 00/17] Work around media 52-bit limitation on CRI Stuart Summers
                   ` (2 preceding siblings ...)
  2026-11-21 18:23 ` [PATCH 03/17] drm/xe/sysctrl: Restore the SoC remapper on every runtime resume Stuart Summers
@ 2026-11-21 18:23 ` Stuart Summers
  2026-11-21 18:23 ` [PATCH 05/17] drm/xe: Detect each GMD_ID IP in a loop Stuart Summers
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Stuart Summers @ 2026-11-21 18:23 UTC (permalink / raw)
  Cc: rodrigo.vivi, riana.tauro, anoop.c.vijay, matthew.d.roper,
	fei.yang, intel-xe, Stuart Summers

The gt_types_allowed configfs attribute is intended for debug only,
so provide a supported way to disable the media GT in production.
The modparam takes precedence over configfs so a single knob is enough
to guarantee the media GT is left alone.

The parameter is tri-state so that -1 can leave the decision to the
driver, which currently enables media wherever it is present.

Both inputs are writable while the driver runs, so latch the result into
xe->info.media_allowed during early probe and read it back through
xe_device_media_allowed(). That keeps the decision fixed for the
lifetime of the device and makes it available outside xe_pci.c.

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/xe/xe_configfs.c     |  3 +++
 drivers/gpu/drm/xe/xe_defaults.h     |  1 +
 drivers/gpu/drm/xe/xe_device.c       | 14 ++++++++++++++
 drivers/gpu/drm/xe/xe_device.h       |  1 +
 drivers/gpu/drm/xe/xe_device_types.h |  2 ++
 drivers/gpu/drm/xe/xe_module.c       |  7 +++++++
 drivers/gpu/drm/xe/xe_module.h       |  1 +
 drivers/gpu/drm/xe/xe_pci.c          | 21 ++++++++++++++++++---
 8 files changed, 47 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_configfs.c
index 2ddd707a6dbd..43950f499a89 100644
--- a/drivers/gpu/drm/xe/xe_configfs.c
+++ b/drivers/gpu/drm/xe/xe_configfs.c
@@ -96,6 +96,9 @@
  * will always return one GT type per line. "primary" and "media" are the
  * GT type names supported by this interface.
  *
+ * Note that the ``enable_media=0`` module parameter takes precedence over
+ * this attribute: it disables the media GT even if "media" is listed here.
+ *
  * This attribute can only be set before binding to the device.
  *
  * Examples:
diff --git a/drivers/gpu/drm/xe/xe_defaults.h b/drivers/gpu/drm/xe/xe_defaults.h
index 0884224ef7c7..8d69df72fe4e 100644
--- a/drivers/gpu/drm/xe/xe_defaults.h
+++ b/drivers/gpu/drm/xe/xe_defaults.h
@@ -13,6 +13,7 @@
 #define XE_DEFAULT_GUC_LOG_LEVEL		1
 #endif
 
+#define XE_DEFAULT_ENABLE_MEDIA			-1
 #define XE_DEFAULT_PROBE_DISPLAY		IS_ENABLED(CONFIG_DRM_XE_DISPLAY)
 #define XE_DEFAULT_VRAM_BAR_SIZE		0
 #define XE_DEFAULT_FORCE_PROBE			CONFIG_DRM_XE_FORCE_PROBE
diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index b053a788d59c..e179d298cbba 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -377,6 +377,20 @@ bool xe_device_is_admin_only(const struct xe_device *xe)
 }
 #endif
 
+/**
+ * xe_device_media_allowed() - Check whether the media IP may be used.
+ * @xe: the &xe_device to check
+ *
+ * Returns the decision latched during early probe, see
+ * @xe_device.info.media_allowed.
+ *
+ * Return: true if media may be used, false otherwise.
+ */
+bool xe_device_media_allowed(struct xe_device *xe)
+{
+	return xe->info.media_allowed;
+}
+
 /* Number of allocated struct xe_device */
 static atomic_t xe_device_count;
 
diff --git a/drivers/gpu/drm/xe/xe_device.h b/drivers/gpu/drm/xe/xe_device.h
index 7a7632e2d56b..b8b24216ee6a 100644
--- a/drivers/gpu/drm/xe/xe_device.h
+++ b/drivers/gpu/drm/xe/xe_device.h
@@ -279,6 +279,7 @@ static inline bool xe_device_is_admin_only(const struct xe_device *xe)
 }
 #endif
 
+bool xe_device_media_allowed(struct xe_device *xe);
 void xe_device_exit(void);
 
 /*
diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
index 8f2a31949073..cfb2639b014e 100644
--- a/drivers/gpu/drm/xe/xe_device_types.h
+++ b/drivers/gpu/drm/xe/xe_device_types.h
@@ -226,6 +226,8 @@ struct xe_device {
 		u8 has_pt_mirror:1;
 		/** @info.is_dgfx: is discrete device */
 		u8 is_dgfx:1;
+		/** @info.media_allowed: Media IP may be used */
+		u8 media_allowed:1;
 		/** @info.needs_scratch: needs scratch page for oob prefetch to work */
 		u8 needs_scratch:1;
 		/**
diff --git a/drivers/gpu/drm/xe/xe_module.c b/drivers/gpu/drm/xe/xe_module.c
index 897724cb5cfb..d6f3dd54613e 100644
--- a/drivers/gpu/drm/xe/xe_module.c
+++ b/drivers/gpu/drm/xe/xe_module.c
@@ -22,6 +22,7 @@
 #include "xe_sched_job.h"
 
 struct xe_modparam xe_modparam = {
+	.enable_media =		XE_DEFAULT_ENABLE_MEDIA,
 	.probe_display =	XE_DEFAULT_PROBE_DISPLAY,
 	.guc_log_level =	XE_DEFAULT_GUC_LOG_LEVEL,
 	.force_probe =		XE_DEFAULT_FORCE_PROBE,
@@ -38,6 +39,12 @@ module_param_named(svm_notifier_size, xe_modparam.svm_notifier_size, uint, 0600)
 MODULE_PARM_DESC(svm_notifier_size, "Set the svm notifier size in MiB, must be power of 2 "
 		 "[default=" __stringify(XE_DEFAULT_SVM_NOTIFIER_SIZE) "]");
 
+module_param_named(enable_media, xe_modparam.enable_media, int, 0444);
+MODULE_PARM_DESC(enable_media, "Enable the media GT, when present (-1=auto, 0=disable, 1=enable). "
+		 "Disabling overrides any media GT selected via the gt_types_allowed "
+		 "configfs attribute "
+		 "[default=" __stringify(XE_DEFAULT_ENABLE_MEDIA) "])");
+
 #if IS_ENABLED(CONFIG_DRM_XE_DISPLAY)
 module_param_named(probe_display, xe_modparam.probe_display, bool, 0444);
 MODULE_PARM_DESC(probe_display, "Probe display HW, otherwise it's left untouched "
diff --git a/drivers/gpu/drm/xe/xe_module.h b/drivers/gpu/drm/xe/xe_module.h
index 6272d9e41207..ffa5ca462207 100644
--- a/drivers/gpu/drm/xe/xe_module.h
+++ b/drivers/gpu/drm/xe/xe_module.h
@@ -12,6 +12,7 @@ struct work_struct;
 
 /* Module modprobe variables */
 struct xe_modparam {
+	int enable_media;
 	bool probe_display;
 	int force_vram_bar_size;
 	int guc_log_level;
diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
index fb2a5f3311c8..7a5c4939a0ac 100644
--- a/drivers/gpu/drm/xe/xe_pci.c
+++ b/drivers/gpu/drm/xe/xe_pci.c
@@ -641,7 +641,7 @@ static int read_gmdid(struct xe_device *xe, enum xe_gmdid_type type, u32 *ver, u
 		int err;
 
 		/* Don't try to read media ver if media GT is not allowed */
-		if (type == GMDID_MEDIA && !xe_configfs_media_gt_allowed(to_pci_dev(xe->drm.dev))) {
+		if (type == GMDID_MEDIA && !xe_device_media_allowed(xe)) {
 			*ver = *revid = 0;
 			return 0;
 		}
@@ -778,6 +778,18 @@ static int xe_probe_info_early(struct xe_device *xe,
 	return 0;
 }
 
+/*
+ * Whether the user wants media at all.  The default (-1) leaves the decision
+ * to the driver.
+ */
+static bool media_wanted(struct xe_device *xe)
+{
+	if (xe_modparam.enable_media < 0)
+		return true;
+
+	return xe_modparam.enable_media;
+}
+
 /*
  * Initialize device info content that only depends on static driver_data
  * passed to the driver at probe time from PCI ID table.
@@ -809,6 +821,9 @@ static int xe_info_init_early(struct xe_device *xe,
 
 	xe_wa_process_device_oob(xe);
 
+	xe->info.media_allowed = media_wanted(xe) &&
+		xe_configfs_media_gt_allowed(to_pci_dev(xe->drm.dev));
+
 	xe->info.dma_mask_size = desc->dma_mask_size;
 	xe->info.va_bits = desc->va_bits;
 	xe->info.vm_max_level = desc->vm_max_level;
@@ -952,8 +967,8 @@ static struct xe_gt *alloc_media_gt(struct xe_tile *tile,
 	struct xe_device *xe = tile_to_xe(tile);
 	struct xe_gt *gt;
 
-	if (!xe_configfs_media_gt_allowed(to_pci_dev(xe->drm.dev))) {
-		xe_tile_info(tile, "Media GT disabled via configfs\n");
+	if (!xe_device_media_allowed(xe)) {
+		xe_tile_info(tile, "Media GT disabled\n");
 		return NULL;
 	}
 
-- 
2.43.0


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

* [PATCH 05/17] drm/xe: Detect each GMD_ID IP in a loop
  2026-11-21 18:23 [PATCH 00/17] Work around media 52-bit limitation on CRI Stuart Summers
                   ` (3 preceding siblings ...)
  2026-11-21 18:23 ` [PATCH 04/17] drm/xe: Add enable_media module parameter Stuart Summers
@ 2026-11-21 18:23 ` Stuart Summers
  2026-11-21 18:23 ` [PATCH 06/17] drm/xe: Tolerate a missing graphics IP in xe_info_init() Stuart Summers
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Stuart Summers @ 2026-11-21 18:23 UTC (permalink / raw)
  Cc: rodrigo.vivi, riana.tauro, anoop.c.vijay, matthew.d.roper,
	fei.yang, intel-xe, Stuart Summers

handle_gmdid() open coded the graphics and media detection twice, with
the two copies subtly disagreeing: a missing media IP was tolerated,
while graphics reporting version 0 was reported as an unknown version.

Describe the per IP differences in a small table and walk it, so both
IPs are detected the same way and an absent IP of either kind simply
leaves its descriptor NULL. Deciding whether the resulting combination
is usable is left to the caller, which is unchanged in still demanding
a graphics IP.

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/xe/xe_pci.c | 70 ++++++++++++++++++++++---------------
 1 file changed, 42 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
index 7a5c4939a0ac..1fce1c993a2c 100644
--- a/drivers/gpu/drm/xe/xe_pci.c
+++ b/drivers/gpu/drm/xe/xe_pci.c
@@ -708,9 +708,21 @@ static const struct xe_ip *find_media_ip(unsigned int verx100)
 	return NULL;
 }
 
+static const struct xe_gmdid_desc {
+	const char *name;
+	const struct xe_ip *(*find_ip)(unsigned int verx100);
+} gmdid_descs[] = {
+	[GMDID_GRAPHICS] = { "graphics", find_graphics_ip },
+	[GMDID_MEDIA] = { "media", find_media_ip },
+};
+
 /*
  * Read IP version from hardware and select graphics/media IP descriptors
  * based on the result.
+ *
+ * Each IP is detected independently and any of them may legitimately be fused
+ * off or otherwise absent, in which case its descriptor is left NULL.  Deciding
+ * whether the resulting combination is usable is up to the caller.
  */
 static int handle_gmdid(struct xe_device *xe,
 			const struct xe_ip **graphics_ip,
@@ -718,36 +730,38 @@ static int handle_gmdid(struct xe_device *xe,
 			u32 *graphics_revid,
 			u32 *media_revid)
 {
-	u32 ver;
-	int ret;
-
-	*graphics_ip = NULL;
-	*media_ip = NULL;
-
-	ret = read_gmdid(xe, GMDID_GRAPHICS, &ver, graphics_revid);
-	if (ret)
-		return ret;
-
-	*graphics_ip = find_graphics_ip(ver);
-	if (!*graphics_ip) {
-		xe_log_err(xe, REGS, -EINVAL,
-			   "Hardware reports unknown graphics version %u.%02u\n",
-			   ver / 100, ver % 100);
-	}
-
-	ret = read_gmdid(xe, GMDID_MEDIA, &ver, media_revid);
-	if (ret)
-		return ret;
+	const struct xe_ip **ips[] = {
+		[GMDID_GRAPHICS] = graphics_ip,
+		[GMDID_MEDIA] = media_ip,
+	};
+	u32 *revids[] = {
+		[GMDID_GRAPHICS] = graphics_revid,
+		[GMDID_MEDIA] = media_revid,
+	};
+
+	for (enum xe_gmdid_type type = 0; type < ARRAY_SIZE(gmdid_descs); type++) {
+		const struct xe_gmdid_desc *desc = &gmdid_descs[type];
+		u32 ver;
+		int ret;
+
+		*ips[type] = NULL;
+		*revids[type] = 0;
+
+		ret = read_gmdid(xe, type, &ver, revids[type]);
+		if (ret)
+			return ret;
 
-	/* Media may legitimately be fused off / not present */
-	if (ver == 0)
-		return 0;
+		/* The IP may legitimately be fused off / not present */
+		if (!ver) {
+			*revids[type] = 0;
+			continue;
+		}
 
-	*media_ip = find_media_ip(ver);
-	if (!*media_ip) {
-		xe_log_err(xe, REGS, -EINVAL,
-			   "Hardware reports unknown media version %u.%02u\n",
-			   ver / 100, ver % 100);
+		*ips[type] = desc->find_ip(ver);
+		if (!*ips[type])
+			xe_log_err(xe, REGS, -EINVAL,
+				   "Hardware reports unknown %s version %u.%02u\n",
+				   desc->name, ver / 100, ver % 100);
 	}
 
 	return 0;
-- 
2.43.0


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

* [PATCH 06/17] drm/xe: Tolerate a missing graphics IP in xe_info_init()
  2026-11-21 18:23 [PATCH 00/17] Work around media 52-bit limitation on CRI Stuart Summers
                   ` (4 preceding siblings ...)
  2026-11-21 18:23 ` [PATCH 05/17] drm/xe: Detect each GMD_ID IP in a loop Stuart Summers
@ 2026-11-21 18:23 ` Stuart Summers
  2026-11-21 18:23 ` [PATCH 07/17] drm/xe: Verify IP presence against GU_CNTL Stuart Summers
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Stuart Summers @ 2026-11-21 18:23 UTC (permalink / raw)
  Cc: rodrigo.vivi, riana.tauro, anoop.c.vijay, matthew.d.roper,
	fei.yang, intel-xe, Stuart Summers

A device without a graphics IP is still rejected a few lines further
down, but handle_gmdid() can already hand back a NULL graphics_ip, so
stop dereferencing it unconditionally and mirror what is done for media
instead. alloc_primary_gt() gets the same treatment, since it reads the
descriptor for every field it fills in.

No functional change: the graphics IP is still required.

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/xe/xe_pci.c | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
index 1fce1c993a2c..5e0150c873e1 100644
--- a/drivers/gpu/drm/xe/xe_pci.c
+++ b/drivers/gpu/drm/xe/xe_pci.c
@@ -933,6 +933,9 @@ static struct xe_gt *alloc_primary_gt(struct xe_tile *tile,
 	struct xe_device *xe = tile_to_xe(tile);
 	struct xe_gt *gt;
 
+	if (!graphics_desc)
+		return NULL;
+
 	if (!xe_configfs_primary_gt_allowed(to_pci_dev(xe->drm.dev))) {
 		xe_tile_info(tile, "Primary GT disabled via configfs\n");
 		return NULL;
@@ -1085,9 +1088,14 @@ static int xe_info_init(struct xe_device *xe,
 	xe->info.step.graphics = probed_info->step.graphics;
 	xe->info.step.media = probed_info->step.media;
 
-	xe->info.graphics_verx100 = graphics_ip->verx100;
-	xe->info.graphics_name = graphics_ip->name;
-	graphics_desc = graphics_ip->desc;
+	if (graphics_ip) {
+		xe->info.graphics_verx100 = graphics_ip->verx100;
+		xe->info.graphics_name = graphics_ip->name;
+		graphics_desc = graphics_ip->desc;
+	} else {
+		xe->info.graphics_name = "none";
+		graphics_desc = NULL;
+	}
 
 	if (media_ip) {
 		xe->info.media_verx100 = media_ip->verx100;
@@ -1098,16 +1106,19 @@ static int xe_info_init(struct xe_device *xe,
 		media_desc = NULL;
 	}
 
-	xe->info.has_access_counter = graphics_desc->has_access_counter;
-	xe->info.has_asid = graphics_desc->has_asid;
-	xe->info.has_atomic_enable_pte_bit = graphics_desc->has_atomic_enable_pte_bit;
+	if (graphics_desc) {
+		xe->info.has_access_counter = graphics_desc->has_access_counter;
+		xe->info.has_asid = graphics_desc->has_asid;
+		xe->info.has_atomic_enable_pte_bit = graphics_desc->has_atomic_enable_pte_bit;
+		xe->info.has_range_tlb_inval = graphics_desc->has_range_tlb_inval;
+		xe->info.has_ctx_tlb_inval = graphics_desc->has_ctx_tlb_inval;
+		xe->info.has_usm = graphics_desc->has_usm;
+		xe->info.has_64bit_timestamp = graphics_desc->has_64bit_timestamp;
+	}
+
 	if (xe->info.platform != XE_PVC)
 		xe->info.has_device_atomics_on_smem = 1;
 
-	xe->info.has_range_tlb_inval = graphics_desc->has_range_tlb_inval;
-	xe->info.has_ctx_tlb_inval = graphics_desc->has_ctx_tlb_inval;
-	xe->info.has_usm = graphics_desc->has_usm;
-	xe->info.has_64bit_timestamp = graphics_desc->has_64bit_timestamp;
 	xe->info.has_mem_copy_instr = GRAPHICS_VER(xe) >= 20;
 
 	if (IS_SRIOV_VF(xe)) {
-- 
2.43.0


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

* [PATCH 07/17] drm/xe: Verify IP presence against GU_CNTL
  2026-11-21 18:23 [PATCH 00/17] Work around media 52-bit limitation on CRI Stuart Summers
                   ` (5 preceding siblings ...)
  2026-11-21 18:23 ` [PATCH 06/17] drm/xe: Tolerate a missing graphics IP in xe_info_init() Stuart Summers
@ 2026-11-21 18:23 ` Stuart Summers
  2026-11-21 18:23 ` [PATCH 08/17] drm/xe: Guard per-tile primary GT accesses Stuart Summers
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Stuart Summers @ 2026-11-21 18:23 UTC (permalink / raw)
  Cc: rodrigo.vivi, riana.tauro, anoop.c.vijay, matthew.d.roper,
	fei.yang, intel-xe, Stuart Summers

GMD_ID is the only thing consulted today to decide whether the graphics
and media IPs exist. Hardware also fuses presence bits into
GU_CNTL_PROTECTED, so check GTPresent and IMPresent as a second level of
verification and leave an IP alone when the two disagree.

Either IP can be dropped this way without failing driver load: an IP
hardware says is absent is simply not detected, which is the same state
as it reporting version 0, and probe then applies the usual rule that
at least one IP has to be left.

VFs have no access to the register, so they keep going by GMD_ID alone.

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/xe/regs/xe_regs.h |  2 ++
 drivers/gpu/drm/xe/xe_pci.c       | 28 ++++++++++++++++++++++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/regs/xe_regs.h b/drivers/gpu/drm/xe/regs/xe_regs.h
index 437485b5a0af..5f2c8d348451 100644
--- a/drivers/gpu/drm/xe/regs/xe_regs.h
+++ b/drivers/gpu/drm/xe/regs/xe_regs.h
@@ -12,6 +12,8 @@
 #define SOC_BASE				0x280000
 
 #define GU_CNTL_PROTECTED			XE_REG(0x10100C)
+#define   GT_PRESENT				REG_BIT(8)
+#define   IM_PRESENT				REG_BIT(10)
 #define   DRIVERINT_FLR_DIS			REG_BIT(31)
 
 #define GU_CNTL					XE_REG(0x101010)
diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
index 5e0150c873e1..a270d1fbce03 100644
--- a/drivers/gpu/drm/xe/xe_pci.c
+++ b/drivers/gpu/drm/xe/xe_pci.c
@@ -710,12 +710,28 @@ static const struct xe_ip *find_media_ip(unsigned int verx100)
 
 static const struct xe_gmdid_desc {
 	const char *name;
+	u32 present;
 	const struct xe_ip *(*find_ip)(unsigned int verx100);
 } gmdid_descs[] = {
-	[GMDID_GRAPHICS] = { "graphics", find_graphics_ip },
-	[GMDID_MEDIA] = { "media", find_media_ip },
+	[GMDID_GRAPHICS] = { "graphics", GT_PRESENT, find_graphics_ip },
+	[GMDID_MEDIA] = { "media", IM_PRESENT, find_media_ip },
 };
 
+/*
+ * Besides the IP version in GMD_ID, hardware reports whether an IP is present
+ * at all through the fuse backed presence bits in GU_CNTL_PROTECTED.  Use
+ * those as a second level of verification, so an IP hardware says is not there
+ * is left alone whatever GMD_ID claims.
+ */
+static bool gt_fused(struct xe_device *xe, u32 present)
+{
+	/* VFs have no access to GU_CNTL_PROTECTED, so go by GMD_ID alone */
+	if (IS_SRIOV_VF(xe))
+		return false;
+
+	return !(xe_mmio_read32(xe_root_tile_mmio(xe), GU_CNTL_PROTECTED) & present);
+}
+
 /*
  * Read IP version from hardware and select graphics/media IP descriptors
  * based on the result.
@@ -757,6 +773,14 @@ static int handle_gmdid(struct xe_device *xe,
 			continue;
 		}
 
+		if (gt_fused(xe, desc->present)) {
+			xe_log_info(xe, REGS,
+				    "Hardware reports the %s IP is not present, ignoring version %u.%02u\n",
+				    desc->name, ver / 100, ver % 100);
+			*revids[type] = 0;
+			continue;
+		}
+
 		*ips[type] = desc->find_ip(ver);
 		if (!*ips[type])
 			xe_log_err(xe, REGS, -EINVAL,
-- 
2.43.0


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

* [PATCH 08/17] drm/xe: Guard per-tile primary GT accesses
  2026-11-21 18:23 [PATCH 00/17] Work around media 52-bit limitation on CRI Stuart Summers
                   ` (6 preceding siblings ...)
  2026-11-21 18:23 ` [PATCH 07/17] drm/xe: Verify IP presence against GU_CNTL Stuart Summers
@ 2026-11-21 18:23 ` Stuart Summers
  2026-11-21 18:23 ` [PATCH 09/17] drm/xe: Stop assuming the root tile has a primary GT Stuart Summers
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Stuart Summers @ 2026-11-21 18:23 UTC (permalink / raw)
  Cc: rodrigo.vivi, riana.tauro, anoop.c.vijay, matthew.d.roper,
	fei.yang, intel-xe, Stuart Summers

A tile's primary GT is now optional, just like its media GT already was.
The TLB invalidation and memory interrupt paths walk both GTs of a tile
but only test the media one for presence, so they would dereference NULL
on a device whose graphics IP is absent.  Mirror the existing media
checks for the primary GT.

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/xe/xe_memirq.c    |  3 ++-
 drivers/gpu/drm/xe/xe_tlb_inval.c | 20 +++++++++++---------
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_memirq.c b/drivers/gpu/drm/xe/xe_memirq.c
index 3433518cc095..0ef3df10ac49 100644
--- a/drivers/gpu/drm/xe/xe_memirq.c
+++ b/drivers/gpu/drm/xe/xe_memirq.c
@@ -578,7 +578,8 @@ void xe_memirq_handler(struct xe_memirq *memirq)
 
 	/* GuC and media GuC (if present) must be checked separately */
 
-	if (memirq_received(memirq, &memirq->source, ilog2(INTR_GUC), "SRC")) {
+	if (tile->primary_gt &&
+	    memirq_received(memirq, &memirq->source, ilog2(INTR_GUC), "SRC")) {
 		map = IOSYS_MAP_INIT_OFFSET(&memirq->bo->vmap,
 					    XE_MEMIRQ_VECTOR_OFFSET(0, ilog2(INTR_GUC)));
 		memirq_dispatch_guc(memirq, &map, &tile->primary_gt->uc.guc);
diff --git a/drivers/gpu/drm/xe/xe_tlb_inval.c b/drivers/gpu/drm/xe/xe_tlb_inval.c
index 1fd39434dc0e..6ef7860c7ff3 100644
--- a/drivers/gpu/drm/xe/xe_tlb_inval.c
+++ b/drivers/gpu/drm/xe/xe_tlb_inval.c
@@ -624,15 +624,17 @@ int xe_tlb_inval_range_tilemask_submit(struct xe_device *xe, u32 asid,
 		if (!(tile_mask & BIT(id)))
 			continue;
 
-		xe_tlb_inval_fence_init(&tile->primary_gt->tlb_inval,
-					&fence[fence_id], true);
-
-		err = xe_tlb_inval_range(&tile->primary_gt->tlb_inval,
-					 &fence[fence_id], start, end,
-					 asid, NULL);
-		if (err)
-			goto wait;
-		++fence_id;
+		if (tile->primary_gt) {
+			xe_tlb_inval_fence_init(&tile->primary_gt->tlb_inval,
+						&fence[fence_id], true);
+
+			err = xe_tlb_inval_range(&tile->primary_gt->tlb_inval,
+						 &fence[fence_id], start, end,
+						 asid, NULL);
+			if (err)
+				goto wait;
+			++fence_id;
+		}
 
 		if (!tile->media_gt)
 			continue;
-- 
2.43.0


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

* [PATCH 09/17] drm/xe: Stop assuming the root tile has a primary GT
  2026-11-21 18:23 [PATCH 00/17] Work around media 52-bit limitation on CRI Stuart Summers
                   ` (7 preceding siblings ...)
  2026-11-21 18:23 ` [PATCH 08/17] drm/xe: Guard per-tile primary GT accesses Stuart Summers
@ 2026-11-21 18:23 ` Stuart Summers
  2026-11-21 18:23 ` [PATCH 10/17] drm/xe: Do not claim flat CCS without a graphics IP Stuart Summers
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Stuart Summers @ 2026-11-21 18:23 UTC (permalink / raw)
  Cc: rodrigo.vivi, riana.tauro, anoop.c.vijay, matthew.d.roper,
	fei.yang, intel-xe, Stuart Summers

A handful of device level consumers reach for xe_root_mmio_gt() to get at
state that merely happens to be hung off a GT - the GuC firmware version,
GT stats counters and the default OA unit - and dereference it without a
NULL check.  None of them touch MMIO, so none of them actually need the
primary GT; they just need some GT.

Add xe_device_any_gt(), which falls back to the root tile's media GT, and
use it in those places.  For OA, walk the GTs instead so the default unit
is the first one that exists, which keeps it OA unit 0 as the uapi
promises.

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/xe/xe_device.h    | 16 ++++++++++++++++
 drivers/gpu/drm/xe/xe_oa.c        | 24 ++++++++++++++++++++++--
 drivers/gpu/drm/xe/xe_pagefault.c |  4 ++--
 drivers/gpu/drm/xe/xe_query.c     |  3 ++-
 drivers/gpu/drm/xe/xe_vm.c        |  2 +-
 5 files changed, 43 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_device.h b/drivers/gpu/drm/xe/xe_device.h
index b8b24216ee6a..8d6324a296c6 100644
--- a/drivers/gpu/drm/xe/xe_device.h
+++ b/drivers/gpu/drm/xe/xe_device.h
@@ -111,6 +111,22 @@ static inline struct xe_gt *xe_root_mmio_gt(struct xe_device *xe)
 	return xe_device_get_root_tile(xe)->primary_gt;
 }
 
+/*
+ * Provide a GT structure for device level state that happens to be hung off a
+ * GT but is not specific to one, such as GuC firmware versions or OA units.
+ * Unlike xe_root_mmio_gt(), this never returns NULL: the root tile always has
+ * at least one GT, even when the graphics IP is absent.  It must not be used
+ * for MMIO, since the media GT needs GSI offset translation.
+ *
+ * Returns the primary GT of the root tile, or its media GT if there is none.
+ */
+static inline struct xe_gt *xe_device_any_gt(struct xe_device *xe)
+{
+	struct xe_tile *tile = xe_device_get_root_tile(xe);
+
+	return tile->primary_gt ?: tile->media_gt;
+}
+
 static inline struct xe_mmio *xe_root_tile_mmio(struct xe_device *xe)
 {
 	return &xe->tiles[0].mmio;
diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
index 664fc4e4741f..580e3d0cbb6e 100644
--- a/drivers/gpu/drm/xe/xe_oa.c
+++ b/drivers/gpu/drm/xe/xe_oa.c
@@ -2041,6 +2041,23 @@ static int xe_oa_assign_hwe(struct xe_oa *oa, struct xe_oa_open_param *param)
 	return ret;
 }
 
+/*
+ * OA unit IDs are handed out in GT iteration order, so the first unit of the
+ * first GT that has one is OA unit 0. The primary GT may be absent, in which
+ * case unit 0 lives on the media GT.
+ */
+static struct xe_oa_unit *xe_oa_first_unit(struct xe_device *xe)
+{
+	struct xe_gt *gt;
+	u8 id;
+
+	for_each_gt(gt, xe, id)
+		if (gt->oa.num_oa_units)
+			return &gt->oa.oa_unit[0];
+
+	return NULL;
+}
+
 /**
  * xe_oa_stream_open_ioctl - Opens an OA stream
  * @dev: @drm_device
@@ -2073,8 +2090,11 @@ int xe_oa_stream_open_ioctl(struct drm_device *dev, u64 data, struct drm_file *f
 		return ret;
 
 	/* If not provided, OA unit defaults to OA unit 0 as per uapi */
-	if (!param.oa_unit)
-		param.oa_unit = &xe_root_mmio_gt(oa->xe)->oa.oa_unit[0];
+	if (!param.oa_unit) {
+		param.oa_unit = xe_oa_first_unit(oa->xe);
+		if (XE_IOCTL_DBG(xe, !param.oa_unit))
+			return -ENODEV;
+	}
 
 	if (param.exec_queue_id > 0) {
 		/* An exec_queue is only needed for OAR/OAC functionality on OAG */
diff --git a/drivers/gpu/drm/xe/xe_pagefault.c b/drivers/gpu/drm/xe/xe_pagefault.c
index 98cce0f12b12..e1058d52abd9 100644
--- a/drivers/gpu/drm/xe/xe_pagefault.c
+++ b/drivers/gpu/drm/xe/xe_pagefault.c
@@ -547,7 +547,7 @@ static bool xe_pagefault_queue_pop(struct xe_pagefault_queue *pf_queue,
 			continue;
 
 		if (cache_start != XE_PAGEFAULT_CACHE_START_INVALID) {
-			xe_gt_stats_incr(xe_root_mmio_gt(xe),
+			xe_gt_stats_incr(xe_device_any_gt(xe),
 					 XE_GT_STATS_ID_PARALLEL_PAGEFAULT_COUNT,
 					 1);
 			break;
@@ -759,7 +759,7 @@ static void xe_pagefault_queue_work(struct work_struct *w)
 	}
 #undef USM_QUEUE_MAX_RUNTIME_MS
 
-	xe_gt_stats_incr(xe_root_mmio_gt(xe), XE_GT_STATS_ID_PAGEFAULT_US,
+	xe_gt_stats_incr(xe_device_any_gt(xe), XE_GT_STATS_ID_PAGEFAULT_US,
 			 xe_gt_stats_ktime_us_delta(start));
 }
 
diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
index 9cc35fc83954..de9346c1ba61 100644
--- a/drivers/gpu/drm/xe/xe_query.c
+++ b/drivers/gpu/drm/xe/xe_query.c
@@ -592,7 +592,8 @@ query_uc_fw_version(struct xe_device *xe, struct drm_xe_device_query *query)
 
 	switch (resp.uc_type) {
 	case XE_QUERY_UC_TYPE_GUC_SUBMISSION: {
-		struct xe_guc *guc = &xe->tiles[0].primary_gt->uc.guc;
+		struct xe_gt *gt = xe_device_any_gt(xe);
+		struct xe_guc *guc = &gt->uc.guc;
 
 		version = &guc->fw.versions.found[XE_UC_FW_VER_COMPATIBILITY];
 		break;
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index dd855876f571..fe7fa2ed36da 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -1706,7 +1706,7 @@ static void xe_vm_init_prove_locking(struct xe_device *xe, struct xe_vm *vm)
 	fs_reclaim_release(GFP_KERNEL);
 
 	down_read(&vm->exec_queues.lock);
-	might_lock(&xe_root_mmio_gt(xe)->uc.guc.ct.lock);
+	might_lock(&xe_device_any_gt(xe)->uc.guc.ct.lock);
 	up_read(&vm->exec_queues.lock);
 }
 
-- 
2.43.0


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

* [PATCH 10/17] drm/xe: Do not claim flat CCS without a graphics IP
  2026-11-21 18:23 [PATCH 00/17] Work around media 52-bit limitation on CRI Stuart Summers
                   ` (8 preceding siblings ...)
  2026-11-21 18:23 ` [PATCH 09/17] drm/xe: Stop assuming the root tile has a primary GT Stuart Summers
@ 2026-11-21 18:23 ` Stuart Summers
  2026-11-21 18:23 ` [PATCH 11/17] drm/xe: Run page table updates on the media GT when there is no primary Stuart Summers
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Stuart Summers @ 2026-11-21 18:23 UTC (permalink / raw)
  Cc: rodrigo.vivi, riana.tauro, anoop.c.vijay, matthew.d.roper,
	fei.yang, intel-xe, Stuart Summers

has_flat_ccs comes from the device descriptor rather than from the
graphics IP, so it survives a device whose graphics IP is absent.  It is
a graphics feature though, and probe_has_flat_ccs() reads its layout back
through the primary GT, which is not there.

Clear the flag along with the rest of the graphics feature bits.

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/xe/xe_pci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
index a270d1fbce03..b8dcb224e306 100644
--- a/drivers/gpu/drm/xe/xe_pci.c
+++ b/drivers/gpu/drm/xe/xe_pci.c
@@ -1138,6 +1138,14 @@ static int xe_info_init(struct xe_device *xe,
 		xe->info.has_ctx_tlb_inval = graphics_desc->has_ctx_tlb_inval;
 		xe->info.has_usm = graphics_desc->has_usm;
 		xe->info.has_64bit_timestamp = graphics_desc->has_64bit_timestamp;
+	} else {
+		/*
+		 * Flat CCS comes from the device descriptor rather than from
+		 * the graphics IP, but it is still a graphics feature: its
+		 * layout is read back through the primary GT, which is not
+		 * there to be read.
+		 */
+		xe->info.has_flat_ccs = 0;
 	}
 
 	if (xe->info.platform != XE_PVC)
-- 
2.43.0


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

* [PATCH 11/17] drm/xe: Run page table updates on the media GT when there is no primary
  2026-11-21 18:23 [PATCH 00/17] Work around media 52-bit limitation on CRI Stuart Summers
                   ` (9 preceding siblings ...)
  2026-11-21 18:23 ` [PATCH 10/17] drm/xe: Do not claim flat CCS without a graphics IP Stuart Summers
@ 2026-11-21 18:23 ` Stuart Summers
  2026-11-21 18:23 ` [PATCH 12/17] drm/xe: Document that gt_types_allowed=media now probes Stuart Summers
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Stuart Summers @ 2026-11-21 18:23 UTC (permalink / raw)
  Cc: rodrigo.vivi, riana.tauro, anoop.c.vijay, matthew.d.roper,
	fei.yang, intel-xe, Stuart Summers

The tile's migration context, and the bind exec queues built on top of
it, are hard wired to the primary GT and its copy engine.  On a device
with no graphics IP that GT is NULL, and xe_migrate_init() is never
called at all, so probe dies in xe_cpu_bind_init() on an uninitialised
tile->migrate.

Page table updates are plain memory writes, so any GT can issue them.
Add xe_tile_pt_gt() and xe_tile_pt_class(), which name the primary GT and
its copy engine as before but fall back to the media GT and a video
decode engine, and use them for the migration context, the bind queues
and the place xe_gt_init() decides to set migration up.

Note this only makes page table updates work.  The blit based copy and
clear paths now target a video engine rather than NULL on such a device,
which stops them oopsing, but they are still not functional there.

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/xe/xe_exec_queue.c |  5 +++--
 drivers/gpu/drm/xe/xe_gt.c         | 11 ++++++----
 drivers/gpu/drm/xe/xe_migrate.c    | 29 ++++++++++++++-------------
 drivers/gpu/drm/xe/xe_tile.h       | 32 ++++++++++++++++++++++++++++++
 4 files changed, 57 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_exec_queue.c b/drivers/gpu/drm/xe/xe_exec_queue.c
index ddd9e38aa80b..70639230bc21 100644
--- a/drivers/gpu/drm/xe/xe_exec_queue.c
+++ b/drivers/gpu/drm/xe/xe_exec_queue.c
@@ -28,6 +28,7 @@
 #include "xe_macros.h"
 #include "xe_migrate.h"
 #include "xe_pm.h"
+#include "xe_tile.h"
 #include "xe_trace.h"
 #include "xe_uc_fw.h"
 #include "xe_vm.h"
@@ -627,7 +628,7 @@ struct xe_exec_queue *xe_exec_queue_create_bind(struct xe_device *xe,
 						struct xe_vm *user_vm,
 						u32 flags, u64 extensions)
 {
-	struct xe_gt *gt = tile->primary_gt;
+	struct xe_gt *gt = xe_tile_pt_gt(tile);
 	struct xe_exec_queue *q;
 	struct xe_vm *migrate_vm;
 
@@ -645,7 +646,7 @@ struct xe_exec_queue *xe_exec_queue_create_bind(struct xe_device *xe,
 					 flags, extensions);
 	} else {
 		q = xe_exec_queue_create_class(xe, gt, migrate_vm,
-					       XE_ENGINE_CLASS_COPY, flags,
+					       xe_tile_pt_class(tile), flags,
 					       extensions);
 	}
 	xe_vm_put(migrate_vm);
diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
index fe71cb011d3a..327e4985d858 100644
--- a/drivers/gpu/drm/xe/xe_gt.c
+++ b/drivers/gpu/drm/xe/xe_gt.c
@@ -61,6 +61,7 @@
 #include "xe_sa.h"
 #include "xe_sched_job.h"
 #include "xe_sriov.h"
+#include "xe_tile.h"
 #include "xe_tlb_inval.h"
 #include "xe_tuning.h"
 #include "xe_uc.h"
@@ -657,10 +658,12 @@ static int gt_init_with_all_forcewake(struct xe_gt *gt)
 		}
 	}
 
-	if (xe_gt_is_main_type(gt)) {
-		struct xe_tile *tile = gt_to_tile(gt);
-
-		err = xe_migrate_init(tile->migrate);
+	/*
+	 * Normally the migration context runs on the primary GT, but a tile
+	 * with no graphics IP has only its media GT to run it on.
+	 */
+	if (gt == xe_tile_pt_gt(gt_to_tile(gt))) {
+		err = xe_migrate_init(gt_to_tile(gt)->migrate);
 		if (err)
 			return err;
 	}
diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
index d7a8d8ecffe6..8fc3e5d500a2 100644
--- a/drivers/gpu/drm/xe/xe_migrate.c
+++ b/drivers/gpu/drm/xe/xe_migrate.c
@@ -43,6 +43,7 @@
 #include "xe_sriov_vf_ccs.h"
 #include "xe_svm.h"
 #include "xe_sync.h"
+#include "xe_tile.h"
 #include "xe_trace_bo.h"
 #include "xe_ttm_stolen_mgr.h"
 #include "xe_validation.h"
@@ -485,7 +486,7 @@ static void xe_migrate_prepare_vm(struct xe_tile *tile, struct xe_migrate *m,
 		if (xe->info.has_usm) {
 			xe_tile_assert(tile, xe_bo_size(batch) == SZ_1M);
 
-			batch = tile->primary_gt->usm.bb_pool->bo;
+			batch = xe_tile_pt_gt(tile)->usm.bb_pool->bo;
 			m->usm_batch_base_ofs = m->batch_base_ofs + SZ_1M;
 			xe_tile_assert(tile, xe_bo_size(batch) == SZ_512K);
 
@@ -506,7 +507,7 @@ static void xe_migrate_prepare_vm(struct xe_tile *tile, struct xe_migrate *m,
 		m->batch_base_ofs = xe_migrate_vram_ofs(xe, batch_addr, false);
 
 		if (xe->info.has_usm) {
-			batch = tile->primary_gt->usm.bb_pool->bo;
+			batch = xe_tile_pt_gt(tile)->usm.bb_pool->bo;
 			batch_addr = xe_bo_addr(batch, 0, XE_PAGE_SIZE);
 			m->usm_batch_base_ofs = xe_migrate_vram_ofs(xe, batch_addr, false);
 		}
@@ -830,7 +831,7 @@ int xe_migrate_reinit(struct xe_migrate *m)
 int xe_migrate_init(struct xe_migrate *m)
 {
 	struct xe_tile *tile = m->tile;
-	struct xe_gt *primary_gt = tile->primary_gt;
+	struct xe_gt *gt = xe_tile_pt_gt(tile);
 	struct xe_device *xe = tile_to_xe(tile);
 	struct xe_vm *vm;
 	int err;
@@ -846,8 +847,8 @@ int xe_migrate_init(struct xe_migrate *m)
 		goto err_out;
 
 	if (xe->info.has_usm) {
-		struct xe_hw_engine *hwe0 = primary_gt->usm.paging_hwe0;
-		u32 logical_mask = primary_gt->usm.paging_logical_mask;
+		struct xe_hw_engine *hwe0 = gt->usm.paging_hwe0;
+		u32 logical_mask = gt->usm.paging_logical_mask;
 
 		if (!hwe0 || !logical_mask) {
 			err = -EINVAL;
@@ -864,8 +865,8 @@ int xe_migrate_init(struct xe_migrate *m)
 					    EXEC_QUEUE_FLAG_MIGRATE |
 					    EXEC_QUEUE_FLAG_LOW_LATENCY, 0);
 	} else {
-		m->q = xe_exec_queue_create_class(xe, primary_gt, vm,
-						  XE_ENGINE_CLASS_COPY,
+		m->q = xe_exec_queue_create_class(xe, gt, vm,
+						  xe_tile_pt_class(tile),
 						  EXEC_QUEUE_FLAG_KERNEL |
 						  EXEC_QUEUE_FLAG_MIGRATE, 0);
 	}
@@ -1214,7 +1215,7 @@ static u32 xe_migrate_ccs_copy(struct xe_migrate *m,
 			       u64 dst_ofs, bool dst_is_indirect, u32 dst_size,
 			       u64 ccs_ofs, bool copy_ccs)
 {
-	struct xe_gt *gt = m->tile->primary_gt;
+	struct xe_gt *gt = xe_tile_pt_gt(m->tile);
 	u32 flush_flags = 0;
 
 	if (!copy_ccs && dst_is_indirect) {
@@ -1276,7 +1277,7 @@ static struct dma_fence *__xe_migrate_copy(struct xe_migrate *m,
 					   bool copy_only_ccs,
 					   bool is_vram_resolve)
 {
-	struct xe_gt *gt = m->tile->primary_gt;
+	struct xe_gt *gt = xe_tile_pt_gt(m->tile);
 	struct xe_device *xe = gt_to_xe(gt);
 	struct dma_fence *fence = NULL;
 	u64 size = xe_bo_size(src_bo);
@@ -1574,7 +1575,7 @@ int xe_migrate_ccs_rw_copy(struct xe_tile *tile, struct xe_exec_queue *q,
 	bool dst_is_pltt = read_write == XE_SRIOV_VF_CCS_WRITE_CTX;
 	struct ttm_resource *src = new_mem;
 	struct xe_migrate *m = tile->migrate;
-	struct xe_gt *gt = tile->primary_gt;
+	struct xe_gt *gt = xe_tile_pt_gt(tile);
 	u32 batch_size, batch_size_allocated;
 	struct xe_device *xe = gt_to_xe(gt);
 	struct xe_res_cursor src_it, ccs_it;
@@ -1776,7 +1777,7 @@ struct dma_fence *xe_migrate_vram_copy_chunk(struct xe_bo *vram_bo, u64 vram_off
 {
 	struct xe_device *xe = xe_bo_device(vram_bo);
 	struct xe_tile *tile = vram_bo->tile;
-	struct xe_gt *gt = tile->primary_gt;
+	struct xe_gt *gt = xe_tile_pt_gt(tile);
 	struct xe_migrate *m = tile->migrate;
 	struct dma_fence *fence = NULL;
 	struct ttm_resource *vram = vram_bo->ttm.resource;
@@ -1992,7 +1993,7 @@ struct dma_fence *xe_migrate_clear(struct xe_migrate *m,
 	bool clear_vram = is_devmem(bo, dst);
 	bool clear_bo_data = XE_MIGRATE_CLEAR_FLAG_BO_DATA & clear_flags;
 	bool clear_ccs = XE_MIGRATE_CLEAR_FLAG_CCS_DATA & clear_flags;
-	struct xe_gt *gt = m->tile->primary_gt;
+	struct xe_gt *gt = xe_tile_pt_gt(m->tile);
 	struct xe_device *xe = gt_to_xe(gt);
 	bool clear_only_system_ccs = false;
 	struct dma_fence *fence = NULL;
@@ -2357,7 +2358,7 @@ static struct dma_fence *xe_migrate_vram(struct xe_migrate *m,
 					 struct dma_fence *deps,
 					 const enum xe_migrate_copy_dir dir)
 {
-	struct xe_gt *gt = m->tile->primary_gt;
+	struct xe_gt *gt = xe_tile_pt_gt(m->tile);
 	struct xe_device *xe = gt_to_xe(gt);
 	bool use_usm_batch = xe->info.has_usm;
 	struct dma_fence *fence = NULL;
@@ -2785,7 +2786,7 @@ int xe_migrate_debug_ccs_overlap(struct xe_migrate *m,
 				 bool write_to_ccs)
 {
 	struct xe_device *xe = tile_to_xe(m->tile);
-	struct xe_gt *gt = m->tile->primary_gt;
+	struct xe_gt *gt = xe_tile_pt_gt(m->tile);
 	struct dma_fence *fence;
 	struct xe_bb *bb;
 	struct xe_sched_job *job;
diff --git a/drivers/gpu/drm/xe/xe_tile.h b/drivers/gpu/drm/xe/xe_tile.h
index a2a2c0e936b8..f35b675f7a20 100644
--- a/drivers/gpu/drm/xe/xe_tile.h
+++ b/drivers/gpu/drm/xe/xe_tile.h
@@ -6,6 +6,7 @@
 #ifndef _XE_TILE_H_
 #define _XE_TILE_H_
 
+#include "xe_hw_engine_types.h"
 #include "xe_tile_types.h"
 
 struct xe_device;
@@ -24,6 +25,37 @@ static inline bool xe_tile_is_root(struct xe_tile *tile)
 	return tile->id == 0;
 }
 
+/**
+ * xe_tile_pt_gt() - GT used to run a tile's page table update jobs
+ * @tile: Pointer to the struct xe_tile.
+ *
+ * Page table updates, and the migration context they are submitted through,
+ * normally run on the primary GT.  A device whose graphics IP is absent has
+ * no primary GT, but its media GT can write page tables just as well.
+ *
+ * Return: The tile's primary GT, or its media GT if it has no primary GT.
+ */
+static inline struct xe_gt *xe_tile_pt_gt(struct xe_tile *tile)
+{
+	return tile->primary_gt ?: tile->media_gt;
+}
+
+/**
+ * xe_tile_pt_class() - Engine class to run a tile's page table update jobs on
+ * @tile: Pointer to the struct xe_tile.
+ *
+ * The engine class to pair with xe_tile_pt_gt(). The copy engine is the usual
+ * choice, but it lives on the primary GT; when there is none, fall back to a
+ * video decode engine on the media GT.
+ *
+ * Return: The engine class to create the tile's page table exec queue with.
+ */
+static inline enum xe_engine_class xe_tile_pt_class(struct xe_tile *tile)
+{
+	return tile->primary_gt ? XE_ENGINE_CLASS_COPY :
+				  XE_ENGINE_CLASS_VIDEO_DECODE;
+}
+
 /**
  * xe_tile_to_vr() - Return the struct xe_vram_region pointer from a
  * struct xe_tile pointer
-- 
2.43.0


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

* [PATCH 12/17] drm/xe: Document that gt_types_allowed=media now probes
  2026-11-21 18:23 [PATCH 00/17] Work around media 52-bit limitation on CRI Stuart Summers
                   ` (10 preceding siblings ...)
  2026-11-21 18:23 ` [PATCH 11/17] drm/xe: Run page table updates on the media GT when there is no primary Stuart Summers
@ 2026-11-21 18:23 ` Stuart Summers
  2026-11-21 18:23 ` [PATCH 13/17] drm/xe: Fall back to CPU copies when the tile cannot blit Stuart Summers
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Stuart Summers @ 2026-11-21 18:23 UTC (permalink / raw)
  Cc: rodrigo.vivi, riana.tauro, anoop.c.vijay, matthew.d.roper,
	fei.yang, intel-xe, Stuart Summers

The media only configuration no longer fails probe, so drop the warning
that said it would.

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/xe/xe_configfs.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_configfs.c
index 43950f499a89..91356cbbb826 100644
--- a/drivers/gpu/drm/xe/xe_configfs.c
+++ b/drivers/gpu/drm/xe/xe_configfs.c
@@ -114,15 +114,14 @@
  *	# echo 'primary' > /sys/kernel/config/xe/0000:03:00.0/gt_types_allowed
  *
  * Allow only the media GT of each tile to be initialized and used,
- * effectively disabling the primary GT.  **This configuration will cause
- * device probe failure on all current platforms, but may be allowed on
- * igpu platforms in the future**::
+ * effectively disabling the primary GT.  Note that only media workloads
+ * are usable in this configuration::
  *
  *	# echo 'media' > /sys/kernel/config/xe/0000:03:00.0/gt_types_allowed
  *
  * Disable all GTs.  Only other GPU IP (such as display) is potentially usable.
  * **This configuration will cause device probe failure on all current
- * platforms, but may be allowed on igpu platforms in the future**::
+ * platforms**::
  *
  *	# echo '' > /sys/kernel/config/xe/0000:03:00.0/gt_types_allowed
  *
-- 
2.43.0


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

* [PATCH 13/17] drm/xe: Fall back to CPU copies when the tile cannot blit
  2026-11-21 18:23 [PATCH 00/17] Work around media 52-bit limitation on CRI Stuart Summers
                   ` (11 preceding siblings ...)
  2026-11-21 18:23 ` [PATCH 12/17] drm/xe: Document that gt_types_allowed=media now probes Stuart Summers
@ 2026-11-21 18:23 ` Stuart Summers
  2026-11-21 18:23 ` [PATCH 14/17] drm/xe: Require a fully visible VRAM BAR without a primary GT Stuart Summers
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Stuart Summers @ 2026-11-21 18:23 UTC (permalink / raw)
  Cc: rodrigo.vivi, riana.tauro, anoop.c.vijay, matthew.d.roper,
	fei.yang, intel-xe, Stuart Summers

xe_migrate_copy() and xe_migrate_clear() emit blitter commands, and the
copy engine they need lives on the primary GT.  A tile without one can
still run the migration context for page table updates, but it has no way
to move data.

On an integrated device this never comes up, since every move either ends
in ttm_bo_move_null() or needs no clear.  With VRAM it does, so let
xe_bo_move() hand the work to ttm_bo_move_memcpy(), which reaches VRAM
through the BAR mapping xe already sets up in xe_ttm_io_mem_reserve(),
and which covers the clear case by way of an unpopulated source.  The
pinned save and restore paths grow the same check, falling back to the
vmap and memcpy branch they already have.

Reads come back over PCIe uncached and are correspondingly slow, so this
is only meant to keep a media only device working, not to perform.

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/xe/xe_bo.c      | 43 ++++++++++++++++++++++-----------
 drivers/gpu/drm/xe/xe_migrate.c | 16 ++++++++++++
 drivers/gpu/drm/xe/xe_migrate.h |  2 ++
 3 files changed, 47 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
index 353ac1e9a9d6..8a8a034d1edb 100644
--- a/drivers/gpu/drm/xe/xe_bo.c
+++ b/drivers/gpu/drm/xe/xe_bo.c
@@ -1277,6 +1277,19 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict,
 		xe_pm_runtime_get_noresume(xe);
 	}
 
+	/*
+	 * A tile with no copy engine cannot blit, so move the data with the
+	 * CPU instead.  For VRAM that means going over the PCIe BAR, which is
+	 * slow, but a device with no graphics IP offers no alternative.
+	 * ttm_bo_move_memcpy() covers the clear case too, by way of an
+	 * unpopulated source.
+	 */
+	if (!xe_migrate_can_blit(migrate)) {
+		ret = ttm_bo_move_memcpy(ttm_bo, ctx, new_mem);
+		xe_pm_runtime_put(xe);
+		goto out;
+	}
+
 	/*
 	 * Attach CCS BBs before submitting the copy job below so a VF
 	 * migration racing the copy sees valid, up to date attach state.
@@ -1578,17 +1591,18 @@ int xe_bo_notifier_unprepare_pinned(struct xe_bo *bo)
 static int xe_bo_evict_pinned_copy(struct xe_bo *bo, struct xe_bo *backup)
 {
 	struct xe_device *xe = xe_bo_device(bo);
+	struct xe_migrate *migrate;
 	bool unmap = false;
 	int ret = 0;
 
-	if (xe_bo_is_user(bo) || (bo->flags & XE_BO_FLAG_PINNED_LATE_RESTORE)) {
-		struct xe_migrate *migrate;
-		struct dma_fence *fence;
+	if (bo->tile)
+		migrate = bo->tile->migrate;
+	else
+		migrate = mem_type_to_migrate(xe, bo->ttm.resource->mem_type);
 
-		if (bo->tile)
-			migrate = bo->tile->migrate;
-		else
-			migrate = mem_type_to_migrate(xe, bo->ttm.resource->mem_type);
+	if ((xe_bo_is_user(bo) || (bo->flags & XE_BO_FLAG_PINNED_LATE_RESTORE)) &&
+	    xe_migrate_can_blit(migrate)) {
+		struct dma_fence *fence;
 
 		xe_assert(xe, bo->ttm.base.resv == backup->ttm.base.resv);
 		ret = dma_resv_reserve_fences(bo->ttm.base.resv, 1);
@@ -1717,6 +1731,7 @@ int xe_bo_restore_pinned(struct xe_bo *bo)
 	};
 	struct xe_device *xe = ttm_to_xe_device(bo->ttm.bdev);
 	struct xe_bo *backup = bo->backup_obj;
+	struct xe_migrate *migrate;
 	bool unmap = false;
 	int ret;
 
@@ -1731,14 +1746,14 @@ int xe_bo_restore_pinned(struct xe_bo *bo)
 			goto out_unlock_bo;
 	}
 
-	if (xe_bo_is_user(bo) || (bo->flags & XE_BO_FLAG_PINNED_LATE_RESTORE)) {
-		struct xe_migrate *migrate;
-		struct dma_fence *fence;
+	if (bo->tile)
+		migrate = bo->tile->migrate;
+	else
+		migrate = mem_type_to_migrate(xe, bo->ttm.resource->mem_type);
 
-		if (bo->tile)
-			migrate = bo->tile->migrate;
-		else
-			migrate = mem_type_to_migrate(xe, bo->ttm.resource->mem_type);
+	if ((xe_bo_is_user(bo) || (bo->flags & XE_BO_FLAG_PINNED_LATE_RESTORE)) &&
+	    xe_migrate_can_blit(migrate)) {
+		struct dma_fence *fence;
 
 		ret = dma_resv_reserve_fences(bo->ttm.base.resv, 1);
 		if (ret)
diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
index 8fc3e5d500a2..7e845cbaa082 100644
--- a/drivers/gpu/drm/xe/xe_migrate.c
+++ b/drivers/gpu/drm/xe/xe_migrate.c
@@ -2155,6 +2155,22 @@ void xe_migrate_wait(struct xe_migrate *m)
 		dma_fence_wait(m->fence, false);
 }
 
+/**
+ * xe_migrate_can_blit() - Whether a migration context can issue blits
+ * @m: The migration context
+ *
+ * xe_migrate_copy() and xe_migrate_clear() emit blitter commands, which only
+ * the copy engine understands, and the copy engine lives on the primary GT.
+ * A tile without one can still update page tables, so its migration context
+ * is usable, but callers that want to move data have to do it themselves.
+ *
+ * Return: true if blit based copy and clear are available on @m.
+ */
+bool xe_migrate_can_blit(struct xe_migrate *m)
+{
+	return m->tile->primary_gt;
+}
+
 static u32 pte_update_cmd_size(u64 size)
 {
 	u32 num_dword;
diff --git a/drivers/gpu/drm/xe/xe_migrate.h b/drivers/gpu/drm/xe/xe_migrate.h
index 2e0f8fe7024b..7b2e016628b9 100644
--- a/drivers/gpu/drm/xe/xe_migrate.h
+++ b/drivers/gpu/drm/xe/xe_migrate.h
@@ -93,6 +93,8 @@ struct xe_vm *xe_migrate_get_vm(struct xe_migrate *m);
 
 void xe_migrate_wait(struct xe_migrate *m);
 
+bool xe_migrate_can_blit(struct xe_migrate *m);
+
 #if IS_ENABLED(CONFIG_DRM_XE_DEBUG_MEM)
 int xe_migrate_debug_ccs_overlap(struct xe_migrate *m,
 				 struct xe_bo *scratch_bo,
-- 
2.43.0


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

* [PATCH 14/17] drm/xe: Require a fully visible VRAM BAR without a primary GT
  2026-11-21 18:23 [PATCH 00/17] Work around media 52-bit limitation on CRI Stuart Summers
                   ` (12 preceding siblings ...)
  2026-11-21 18:23 ` [PATCH 13/17] drm/xe: Fall back to CPU copies when the tile cannot blit Stuart Summers
@ 2026-11-21 18:23 ` Stuart Summers
  2026-11-21 18:23 ` [PATCH 15/17] drm/xe: Allow probe " Stuart Summers
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Stuart Summers @ 2026-11-21 18:23 UTC (permalink / raw)
  Cc: rodrigo.vivi, riana.tauro, anoop.c.vijay, matthew.d.roper,
	fei.yang, intel-xe, Stuart Summers

CPU copies can only reach VRAM that the BAR maps: xe_ttm_io_mem_reserve()
rejects any resource that is not entirely CPU visible.  With no primary
GT there is no copy engine to fall back on, so a small BAR would leave
most of VRAM unreachable.

Refuse to probe such a device rather than fail later on the first move.

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/xe/xe_vram.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_vram.c b/drivers/gpu/drm/xe/xe_vram.c
index 1c02889ba29b..4d399a83479e 100644
--- a/drivers/gpu/drm/xe/xe_vram.c
+++ b/drivers/gpu/drm/xe/xe_vram.c
@@ -23,6 +23,7 @@
 #include "xe_mmio.h"
 #include "xe_sriov.h"
 #include "xe_tile.h"
+#include "xe_tile_printk.h"
 #include "xe_tile_sriov_vf.h"
 #include "xe_ttm_vram_mgr.h"
 #include "xe_vram.h"
@@ -346,6 +347,20 @@ int xe_vram_probe(struct xe_device *xe)
 		if (err)
 			return err;
 
+		/*
+		 * Without a primary GT there is no copy engine, so VRAM is
+		 * moved with the CPU through the BAR.  That only works if the
+		 * BAR covers all of it.
+		 */
+		if (!tile->primary_gt &&
+		    tile->mem.vram->io_size < tile->mem.vram->usable_size) {
+			xe_tile_err(tile,
+				    "VRAM is not fully CPU visible (%pa of %pa); a resizable BAR is required without a primary GT\n",
+				    &tile->mem.vram->io_size,
+				    &tile->mem.vram->usable_size);
+			return -ENODEV;
+		}
+
 		if (total_size > lmem_bar.io_size) {
 			xe_log_info(xe, VRAM,
 				    "Total size %#llx is larger than resource %#llx\n",
-- 
2.43.0


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

* [PATCH 15/17] drm/xe: Allow probe without a primary GT
  2026-11-21 18:23 [PATCH 00/17] Work around media 52-bit limitation on CRI Stuart Summers
                   ` (13 preceding siblings ...)
  2026-11-21 18:23 ` [PATCH 14/17] drm/xe: Require a fully visible VRAM BAR without a primary GT Stuart Summers
@ 2026-11-21 18:23 ` Stuart Summers
  2026-11-21 18:23 ` [PATCH 16/17] drm/xe: Work around media 52-bit limitation on CRI Stuart Summers
  2026-11-21 18:23 ` [PATCH 17/17] drm/xe: Don't error on failed media defeature Stuart Summers
  16 siblings, 0 replies; 18+ messages in thread
From: Stuart Summers @ 2026-11-21 18:23 UTC (permalink / raw)
  Cc: rodrigo.vivi, riana.tauro, anoop.c.vijay, matthew.d.roper,
	fei.yang, intel-xe, Stuart Summers

Probe required a graphics IP and a primary GT, so the media only
combination the gt_types_allowed configfs attribute can ask for was
rejected outright.

Require instead that something is left to drive: at least one of the two
IPs has to be detected, and every tile has to end up with at least one
GT. The dgpu concern the old comment raised is covered by VRAM being a
graphics IP property, so a device without one has no VRAM to manage.

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/xe/xe_pci.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
index b8dcb224e306..31dbd5a32d65 100644
--- a/drivers/gpu/drm/xe/xe_pci.c
+++ b/drivers/gpu/drm/xe/xe_pci.c
@@ -1060,11 +1060,11 @@ static int xe_probe_ips(struct xe_device *xe,
 	}
 
 	/*
-	 * If we couldn't detect the graphics IP, that's considered a fatal
-	 * error and we should abort driver load.  Failing to detect media
-	 * IP is non-fatal; we'll just proceed without enabling media support.
+	 * Either IP on its own is enough to go on with.  Only a device where
+	 * neither could be detected is a fatal error, since there would be
+	 * nothing left to drive.
 	 */
-	if (!probed_info->graphics_ip)
+	if (!probed_info->graphics_ip && !probed_info->media_ip)
 		return -ENODEV;
 
 	return 0;
@@ -1179,21 +1179,14 @@ static int xe_info_init(struct xe_device *xe,
 		if (IS_ERR(tile->primary_gt))
 			return PTR_ERR(tile->primary_gt);
 
-		/*
-		 * It's not currently possible to probe a device with the
-		 * primary GT disabled.  With some work, this may be future in
-		 * the possible for igpu platforms (although probably not for
-		 * dgpu's since access to the primary GT's BCS engines is
-		 * required for VRAM management).
-		 */
-		if (!tile->primary_gt) {
-			drm_err(&xe->drm, "Cannot probe device with without a primary GT\n");
-			return -ENODEV;
-		}
-
 		tile->media_gt = alloc_media_gt(tile, media_desc);
 		if (IS_ERR(tile->media_gt))
 			return PTR_ERR(tile->media_gt);
+
+		if (!tile->primary_gt && !tile->media_gt) {
+			xe_tile_err(tile, "Cannot probe tile without any GT\n");
+			return -ENODEV;
+		}
 	}
 
 	/*
-- 
2.43.0


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

* [PATCH 16/17] drm/xe: Work around media 52-bit limitation on CRI
  2026-11-21 18:23 [PATCH 00/17] Work around media 52-bit limitation on CRI Stuart Summers
                   ` (14 preceding siblings ...)
  2026-11-21 18:23 ` [PATCH 15/17] drm/xe: Allow probe " Stuart Summers
@ 2026-11-21 18:23 ` Stuart Summers
  2026-11-21 18:23 ` [PATCH 17/17] drm/xe: Don't error on failed media defeature Stuart Summers
  16 siblings, 0 replies; 18+ messages in thread
From: Stuart Summers @ 2026-11-21 18:23 UTC (permalink / raw)
  Cc: rodrigo.vivi, riana.tauro, anoop.c.vijay, matthew.d.roper,
	fei.yang, intel-xe, Stuart Summers

CRI media only supports 46-bit GPA. With the IOMMU handing out IOVAs
above 46 bits this shows up as ATS translation errors and a media
GuC load failure.

The workaround for this is broken into a couple of parts:
1) Media is now disabled by default on CRI.
2) When media is enabled, implement certain workarounds to
   ensure compute performance remains optimal and media accesses
   do not result in the above mentioned translation errors.

The first part of the workaround means for the customers who are
not interested in using media, they can retain the full 52-bit GPA
range for a broader PCIe installation without worrying about any
specific limitation to support the media workloads on this device.

Additionally, to ensure power is not consumed by media in this
configuration, a new interfaces is added between the KMD and the GFSP
firmware to bring media down into a low power state.

The second part of the workaround again is broken down into a few
parts:
1) The whole device is restricted to 46-bit GPA.
2) Disable address translation in the media block alone to allow
   faster translation for compute workloads with PCIe level address
   translation enabled while ensuring host accesses beyond 46-bits
   (e.g. coming from another 52-bit supporting device) are still
   limited to 46-bits for the CRI media.

Media needs every device DMA address to stay within 46 bits. With the
IOMMU translating device DMA that is guaranteed by the IOVA allocator
honoring the clamped mask. Without it, DMA addresses are host physical
addresses, so media stays enabled only when host memory fits in 46 bits.
Beyond that the host can hand out an address media cannot reach, so
disable media.

In order to disable address translation for media, a certain register
programming which is not accessible from the host must be engaged. To
facilitate this, an additional new interface is added between the KMD
and the GFSP firmware to do this programming.

HSDES: 14028632488

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/xe/xe_device.c                |  10 +
 drivers/gpu/drm/xe/xe_device_wa_oob.rules     |   1 +
 drivers/gpu/drm/xe/xe_pci.c                   |  54 ++++-
 drivers/gpu/drm/xe/xe_pm.c                    |   4 +
 drivers/gpu/drm/xe/xe_sysctrl.c               | 185 ++++++++++++++++++
 drivers/gpu/drm/xe/xe_sysctrl.h               |   2 +
 drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h |  34 ++++
 drivers/gpu/drm/xe/xe_sysctrl_types.h         |   6 +
 8 files changed, 294 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index e179d298cbba..06caa593313a 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -994,6 +994,12 @@ int xe_device_probe(struct xe_device *xe)
 	if (err)
 		return err;
 
+	/*
+	 * Let the System Controller know how media is configured as early as
+	 * the mailbox allows, before any media GT is brought up.
+	 */
+	xe_sysctrl_media_probe(xe);
+
 	err = xe_ras_init(xe);
 	if (err)
 		return err;
@@ -1518,6 +1524,10 @@ int xe_device_resume(struct xe_device *xe, bool flr)
 
 	xe_sysctrl_pm_resume(xe);
 
+	err = xe_sysctrl_media_defeature(xe);
+	if (err)
+		return err;
+
 	xe_irq_resume(xe);
 
 	for_each_gt(gt, xe, id) {
diff --git a/drivers/gpu/drm/xe/xe_device_wa_oob.rules b/drivers/gpu/drm/xe/xe_device_wa_oob.rules
index 300207596893..14308f90938e 100644
--- a/drivers/gpu/drm/xe/xe_device_wa_oob.rules
+++ b/drivers/gpu/drm/xe/xe_device_wa_oob.rules
@@ -8,3 +8,4 @@
 14026779378	PLATFORM(CRESCENTISLAND)
 14028586678	PLATFORM(CRESCENTISLAND)
 14028434957	PLATFORM(CRESCENTISLAND)
+14028632488	PLATFORM(CRESCENTISLAND)
diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
index 31dbd5a32d65..f853d10aa825 100644
--- a/drivers/gpu/drm/xe/xe_pci.c
+++ b/drivers/gpu/drm/xe/xe_pci.c
@@ -7,6 +7,9 @@
 
 #include <kunit/static_stub.h>
 #include <linux/device/driver.h>
+#include <linux/dma-mapping.h>
+#include <linux/iommu.h>
+#include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/pm_runtime.h>
@@ -816,6 +819,44 @@ static int xe_probe_info_early(struct xe_device *xe,
 	return 0;
 }
 
+/*
+ * Number of address bits media is able to reach on CRI, where it has no
+ * address translation of its own.
+ */
+#define XE_CRI_MEDIA_ADDR_BITS	46
+
+static bool device_iommu_iova_backed(struct device *dev)
+{
+	struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
+
+	return domain && domain->type != IOMMU_DOMAIN_IDENTITY;
+}
+
+/*
+ * Decide whether media can be used on CRI.  Media there cannot translate
+ * addresses, so it is only usable if device DMA is guaranteed to stay within
+ * XE_CRI_MEDIA_ADDR_BITS.  The IOMMU guarantees that by allocating IOVAs
+ * below the device dma mask.  Without it, DMA addresses are host physical
+ * addresses, so media is only usable when the host cannot produce an address
+ * wider than media can reach.
+ */
+static bool cri_media_addressable(struct xe_device *xe)
+{
+	u64 host_max_addr = DIRECT_MAP_PHYSMEM_END;
+
+	if (device_iommu_iova_backed(xe->drm.dev))
+		return true;
+
+	if (host_max_addr <= DMA_BIT_MASK(XE_CRI_MEDIA_ADDR_BITS))
+		return true;
+
+	drm_info(&xe->drm,
+		 "IOMMU is not translating device DMA and the host can produce %u bit physical addresses, media is limited to %u\n",
+		 fls64(host_max_addr), XE_CRI_MEDIA_ADDR_BITS);
+
+	return false;
+}
+
 /*
  * Whether the user wants media at all.  The default (-1) leaves the decision
  * to the driver.
@@ -823,7 +864,7 @@ static int xe_probe_info_early(struct xe_device *xe,
 static bool media_wanted(struct xe_device *xe)
 {
 	if (xe_modparam.enable_media < 0)
-		return true;
+		return !XE_DEVICE_WA(xe, 14028632488);
 
 	return xe_modparam.enable_media;
 }
@@ -860,9 +901,18 @@ static int xe_info_init_early(struct xe_device *xe,
 	xe_wa_process_device_oob(xe);
 
 	xe->info.media_allowed = media_wanted(xe) &&
-		xe_configfs_media_gt_allowed(to_pci_dev(xe->drm.dev));
+		xe_configfs_media_gt_allowed(to_pci_dev(xe->drm.dev)) &&
+		(!XE_DEVICE_WA(xe, 14028632488) || cri_media_addressable(xe));
 
 	xe->info.dma_mask_size = desc->dma_mask_size;
+	/*
+	 * Some device media blocks cannot address beyond 46 bits. Clamp the
+	 * dma_mask_size to reflect this.
+	 */
+	if (XE_DEVICE_WA(xe, 14028632488) && xe_device_media_allowed(xe))
+		xe->info.dma_mask_size = min_t(u8, xe->info.dma_mask_size,
+					       XE_CRI_MEDIA_ADDR_BITS);
+
 	xe->info.va_bits = desc->va_bits;
 	xe->info.vm_max_level = desc->vm_max_level;
 	xe->info.vram_flags = desc->vram_flags;
diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
index d25dbec6472e..765155ac2640 100644
--- a/drivers/gpu/drm/xe/xe_pm.c
+++ b/drivers/gpu/drm/xe/xe_pm.c
@@ -662,6 +662,10 @@ int xe_pm_runtime_resume(struct xe_device *xe)
 	 */
 	xe_sysctrl_pm_resume(xe);
 
+	err = xe_sysctrl_media_defeature(xe);
+	if (err)
+		goto out;
+
 	xe_display_pm_runtime_resume_early(xe);
 
 	xe_irq_resume(xe);
diff --git a/drivers/gpu/drm/xe/xe_sysctrl.c b/drivers/gpu/drm/xe/xe_sysctrl.c
index 405d339d6a7d..a7f8c8edd012 100644
--- a/drivers/gpu/drm/xe/xe_sysctrl.c
+++ b/drivers/gpu/drm/xe/xe_sysctrl.c
@@ -5,12 +5,16 @@
 
 #include <linux/device.h>
 #include <linux/mutex.h>
+#include <linux/pci.h>
 
 #include <drm/drm_managed.h>
 
+#include <generated/xe_device_wa_oob.h>
+
 #include "regs/xe_irq_regs.h"
 #include "regs/xe_sysctrl_regs.h"
 #include "xe_device.h"
+#include "xe_force_wake.h"
 #include "xe_mmio.h"
 #include "xe_pm.h"
 #include "xe_printk.h"
@@ -19,6 +23,7 @@
 #include "xe_sysctrl_mailbox.h"
 #include "xe_sysctrl_mailbox_types.h"
 #include "xe_sysctrl_types.h"
+#include "xe_wa.h"
 
 /**
  * DOC: System Controller (sysctrl)
@@ -103,6 +108,7 @@ int xe_sysctrl_init(struct xe_device *xe)
 
 	xe->soc_remapper.set_sysctrl_region(xe, SYSCTRL_MAILBOX_INDEX);
 	INIT_WORK(&sc->work, xe_sysctrl_work);
+	sc->has_media_feature_disable = true;
 
 	return devm_add_action_or_reset(xe->drm.dev, sysctrl_fini, xe);
 }
@@ -251,3 +257,182 @@ int xe_sysctrl_sdk_api_version(struct xe_device *xe, u16 *version)
 
 	return 0;
 }
+
+static int sysctrl_media_defeature(struct xe_device *xe, u8 feature)
+{
+	struct xe_sysctrl_media_defeature_req req = { .feature = feature };
+	struct xe_sysctrl_media_defeature_resp resp = {};
+	struct xe_sysctrl_mailbox_command cmd = {};
+	size_t out_len = 0;
+	int ret;
+
+	xe_sysctrl_create_command(&cmd, XE_SYSCTRL_GROUP_RUNTIME,
+				  XE_SYSCTRL_CMD_MEDIA_DEFEATURE,
+				  &req, sizeof(req), &resp, sizeof(resp));
+
+	ret = xe_sysctrl_send_command(&xe->sc, &cmd, &out_len);
+	if (ret)
+		return ret;
+
+	if (out_len != sizeof(resp)) {
+		xe_err(xe, "sysctrl: unexpected media defeature response length %zu (expected %zu)\n",
+		       out_len, sizeof(resp));
+		return -EPROTO;
+	}
+
+	return 0;
+}
+
+/* Check whether the ATS Enable bit is set in the PCI ATS Control register */
+static bool sysctrl_ats_enabled(struct xe_device *xe)
+{
+	struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
+	int ats_cap;
+	u16 ctrl;
+
+	ats_cap = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ATS);
+	if (!ats_cap)
+		return false;
+
+	if (pci_read_config_word(pdev, ats_cap + PCI_ATS_CTRL, &ctrl))
+		return false;
+
+	return ctrl & PCI_ATS_CTRL_ENABLE;
+}
+
+/* Send the media defeature command and report the outcome */
+static int sysctrl_media_defeature_send(struct xe_device *xe, u8 feature)
+{
+	bool media_allowed = feature == XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE;
+	int ret;
+
+	ret = sysctrl_media_defeature(xe, feature);
+	if (ret) {
+		xe_err(xe, "sysctrl: failed to defeature media (0x%02x): %pe\n",
+		       feature, ERR_PTR(ret));
+		return ret;
+	}
+
+	xe_info(xe, "sysctrl: media %s, %s defeatured\n",
+		media_allowed ? "enabled" : "disabled",
+		media_allowed ? "address translation" : "media");
+
+	return 0;
+}
+
+/*
+ * The System Controller reaches into media while processing the request, so
+ * hold the media GT forcewake for its duration.
+ */
+static int sysctrl_media_ats_defeature_send(struct xe_device *xe, struct xe_gt *media_gt)
+{
+	int ret = 0;
+
+	xe_with_force_wake(fw_ref, gt_to_fw(media_gt), XE_FW_GT) {
+		if (!xe_force_wake_ref_has_domain(fw_ref.domains, XE_FW_GT))
+			xe_err(xe, "sysctrl: failed to wake media GT, defeaturing media ATS anyway\n");
+
+		ret = sysctrl_media_defeature_send(xe, XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE);
+	}
+
+	return ret;
+}
+
+/* Whether this platform needs the media defeature workaround at all */
+static bool sysctrl_media_defeature_needed(struct xe_device *xe)
+{
+	return XE_DEVICE_WA(xe, 14028632488) &&
+	       xe->info.has_soc_remapper_sysctrl &&
+	       xe->info.has_sysctrl &&
+	       xe->sc.has_media_feature_disable;
+}
+
+/**
+ * xe_sysctrl_media_defeature() - Tell System Controller how media is configured
+ * @xe: xe device instance
+ *
+ * The driver and the System Controller must agree on the media configuration
+ * before media is used. When media is enabled, address translation for media
+ * is not supported and must be defeatured. When media has been disabled by the
+ * user, via either the enable_media modparam or the gt_types_allowed configfs
+ * attribute, media itself is defeatured.
+ *
+ * This is restricted to platforms that need this workaround.
+ *
+ * Once a request has failed, the System Controller is assumed not to support
+ * it and it is not sent again; this returns 0 from then on.
+ *
+ * Return: 0 on success, error code on failure
+ */
+int xe_sysctrl_media_defeature(struct xe_device *xe)
+{
+	bool media_allowed = xe_device_media_allowed(xe);
+	struct xe_gt *media_gt;
+	u8 feature;
+	int ret;
+
+	if (!sysctrl_media_defeature_needed(xe))
+		return 0;
+
+	feature = media_allowed ? XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE :
+				  XE_SYSCTRL_MEDIA_DEFEATURE_DISABLE;
+
+	media_gt = xe_device_get_root_tile(xe)->media_gt;
+
+	if (media_gt && feature == XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE &&
+	    sysctrl_ats_enabled(xe))
+		ret = sysctrl_media_ats_defeature_send(xe, media_gt);
+	else
+		ret = sysctrl_media_defeature_send(xe, feature);
+
+	if (ret)
+		xe->sc.has_media_feature_disable = false;
+
+	return ret;
+}
+
+/*
+ * Drop media from the device.  Only safe during probe, before the media GT is
+ * brought up.  The dma_mask_size cap derived from the early media decision is
+ * left in place, which is harmless since it is only more restrictive than
+ * needed.
+ */
+static void sysctrl_media_drop(struct xe_device *xe)
+{
+	struct xe_tile *tile;
+	u8 id;
+
+	xe->info.media_allowed = false;
+
+	for_each_tile(tile, xe, id)
+		tile->media_gt = NULL;
+}
+
+/**
+ * xe_sysctrl_media_probe() - Configure media with the System Controller at probe
+ * @xe: xe device instance
+ *
+ * Same as xe_sysctrl_media_defeature(), but media cannot be used while the
+ * System Controller does not know how it is configured, so on failure media is
+ * dropped and probe continues without it rather than failing driver load.
+ *
+ * Must be called from the same place xe_sysctrl_media_defeature() would be
+ * called during probe.
+ */
+void xe_sysctrl_media_probe(struct xe_device *xe)
+{
+	if (!xe_sysctrl_media_defeature(xe))
+		return;
+
+	/*
+	 * Media is going away, so ask the System Controller to defeature it
+	 * too.  Nothing more can be done if even that fails, but the driver
+	 * does not touch media from here on either way.
+	 */
+	if (xe_device_media_allowed(xe))
+		sysctrl_media_defeature_send(xe, XE_SYSCTRL_MEDIA_DEFEATURE_DISABLE);
+
+	sysctrl_media_drop(xe);
+
+	xe_info(xe, "sysctrl: media configuration failed, continuing without media\n");
+}
diff --git a/drivers/gpu/drm/xe/xe_sysctrl.h b/drivers/gpu/drm/xe/xe_sysctrl.h
index c0b6d4330c88..e1d4181942e0 100644
--- a/drivers/gpu/drm/xe/xe_sysctrl.h
+++ b/drivers/gpu/drm/xe/xe_sysctrl.h
@@ -18,6 +18,8 @@ static inline struct xe_device *sc_to_xe(struct xe_sysctrl *sc)
 
 void xe_sysctrl_event(struct xe_sysctrl *sc);
 int xe_sysctrl_init(struct xe_device *xe);
+int xe_sysctrl_media_defeature(struct xe_device *xe);
+void xe_sysctrl_media_probe(struct xe_device *xe);
 void xe_sysctrl_irq_handler(struct xe_device *xe, u32 master_ctl);
 void xe_sysctrl_pm_resume(struct xe_device *xe);
 bool xe_sysctrl_is_oobmsm_fw_ready(struct xe_device *xe);
diff --git a/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h b/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h
index cdacceebca06..74cf02c2d630 100644
--- a/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h
+++ b/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h
@@ -15,11 +15,13 @@
  *
  * @XE_SYSCTRL_GROUP_GFSP: GFSP group
  * @XE_SYSCTRL_GROUP_DIAG: Diag group
+ * @XE_SYSCTRL_GROUP_RUNTIME: Runtime group
  * @XE_SYSCTRL_GROUP_CORE: Core group
  */
 enum xe_sysctrl_group {
 	XE_SYSCTRL_GROUP_GFSP			= 0x01,
 	XE_SYSCTRL_GROUP_DIAG			= 0x02,
+	XE_SYSCTRL_GROUP_RUNTIME		= 0x31,
 	XE_SYSCTRL_GROUP_CORE			= 0xFF,
 };
 
@@ -94,6 +96,38 @@ struct xe_sysctrl_diag_ras_err_inj_req {
 	u32 params;
 } __packed;
 
+/**
+ * enum xe_sysctrl_runtime_cmd - Commands supported by Runtime group
+ *
+ * @XE_SYSCTRL_CMD_MEDIA_DEFEATURE: Disable feature in media
+ */
+enum xe_sysctrl_runtime_cmd {
+	XE_SYSCTRL_CMD_MEDIA_DEFEATURE		= 0x11,
+};
+
+#define XE_SYSCTRL_MEDIA_DEFEATURE_DISABLE	0x01
+#define XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE	0x02
+
+/**
+ * struct xe_sysctrl_media_defeature_req - Media defeature request
+ *
+ * @feature: Media feature to defeature, one of
+ *	XE_SYSCTRL_MEDIA_DEFEATURE_DISABLE or
+ *	XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE
+ */
+struct xe_sysctrl_media_defeature_req {
+	u8 feature;
+} __packed;
+
+/**
+ * struct xe_sysctrl_media_defeature_resp - Media defeature response
+ *
+ * @flags: Firmware status flags
+ */
+struct xe_sysctrl_media_defeature_resp {
+	u32 flags;
+} __packed;
+
 /**
  * struct xe_sysctrl_app_status_req - Get application status request
  *
diff --git a/drivers/gpu/drm/xe/xe_sysctrl_types.h b/drivers/gpu/drm/xe/xe_sysctrl_types.h
index 605bdc62e0bf..0cf265df1aa7 100644
--- a/drivers/gpu/drm/xe/xe_sysctrl_types.h
+++ b/drivers/gpu/drm/xe/xe_sysctrl_types.h
@@ -75,6 +75,12 @@ struct xe_sysctrl {
 	/** @event_lock: Mutex protecting pending events */
 	struct mutex event_lock;
 
+	/**
+	 * @has_media_feature_disable: The System Controller accepts media
+	 * defeature requests.
+	 */
+	bool has_media_feature_disable;
+
 	/** @debugfs: Debugfs entries */
 	struct {
 		/** @debugfs.root: Root debugfs directory */
-- 
2.43.0


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

* [PATCH 17/17] drm/xe: Don't error on failed media defeature
  2026-11-21 18:23 [PATCH 00/17] Work around media 52-bit limitation on CRI Stuart Summers
                   ` (15 preceding siblings ...)
  2026-11-21 18:23 ` [PATCH 16/17] drm/xe: Work around media 52-bit limitation on CRI Stuart Summers
@ 2026-11-21 18:23 ` Stuart Summers
  16 siblings, 0 replies; 18+ messages in thread
From: Stuart Summers @ 2026-11-21 18:23 UTC (permalink / raw)
  Cc: rodrigo.vivi, riana.tauro, anoop.c.vijay, matthew.d.roper,
	fei.yang, intel-xe, Stuart Summers

Right now there isn't an easy way to get the version of the
GFSP firmware that will be replying to this command. For testing
purposes, don't print an error to avoid flagging CI for some
early testing.

Note this patch is not intended to be merged...

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/xe/xe_ras.c             | 18 +++++++++---------
 drivers/gpu/drm/xe/xe_sysctrl.c         | 10 +++++-----
 drivers/gpu/drm/xe/xe_sysctrl_debugfs.c |  6 +++---
 drivers/gpu/drm/xe/xe_sysctrl_event.c   |  2 +-
 drivers/gpu/drm/xe/xe_sysctrl_mailbox.c | 25 +++++++++++++++----------
 drivers/gpu/drm/xe/xe_sysctrl_mailbox.h |  3 ++-
 6 files changed, 35 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
index 0fb891d00b36..ac7898bfa456 100644
--- a/drivers/gpu/drm/xe/xe_ras.c
+++ b/drivers/gpu/drm/xe/xe_ras.c
@@ -282,7 +282,7 @@ static int send_page_offline_cmd(struct xe_device *xe, u64 page_address,
 	xe_sysctrl_create_command(&command, XE_SYSCTRL_GROUP_GFSP, XE_SYSCTRL_CMD_PAGE_OFFLINE,
 				  &request, sizeof(request), &response, sizeof(response));
 
-	ret = xe_sysctrl_send_command(&xe->sc, &command, &rlen);
+	ret = xe_sysctrl_send_command(&xe->sc, &command, &rlen, true);
 	if (ret) {
 		xe_log_err(xe, SYSCTRL, ret, "failed to send page offline command\n");
 		return ret;
@@ -435,7 +435,7 @@ static void process_offline_pages(struct xe_device *xe, u32 cmd, void *req, size
 		if (list_req)
 			list_req->index = count;
 
-		ret = xe_sysctrl_send_command(&xe->sc, &command, &rlen);
+		ret = xe_sysctrl_send_command(&xe->sc, &command, &rlen, true);
 		if (ret) {
 			xe_log_err(xe, SYSCTRL, ret, "failed to get page offline data, cmd=%#x\n",
 				   cmd);
@@ -792,7 +792,7 @@ int xe_ras_get_counter_response(struct xe_device *xe, const struct xe_ras_error_
 	xe_sysctrl_create_command(&command, XE_SYSCTRL_GROUP_GFSP, XE_SYSCTRL_CMD_GET_COUNTER,
 				  &request, sizeof(request), response, sizeof(*response));
 
-	ret = xe_sysctrl_send_command(&xe->sc, &command, &rlen);
+	ret = xe_sysctrl_send_command(&xe->sc, &command, &rlen, true);
 	if (ret) {
 		xe_err(xe, "sysctrl: failed to get counter %d\n", ret);
 		return ret;
@@ -860,7 +860,7 @@ enum xe_ras_recovery_action xe_ras_process_errors(struct xe_device *xe)
 	do {
 		memset(&response, 0, sizeof(response));
 
-		ret = xe_sysctrl_send_command(&xe->sc, &command, &rlen);
+		ret = xe_sysctrl_send_command(&xe->sc, &command, &rlen, true);
 		if (ret) {
 			xe_err(xe, "sysctrl: failed to get soc error %d\n", ret);
 			goto err;
@@ -983,7 +983,7 @@ int xe_ras_clear_counter(struct xe_device *xe, u8 severity, u8 component)
 				  &request, sizeof(request), &response, sizeof(response));
 
 	guard(xe_pm_runtime)(xe);
-	ret = xe_sysctrl_send_command(&xe->sc, &command, &rlen);
+	ret = xe_sysctrl_send_command(&xe->sc, &command, &rlen, true);
 	if (ret) {
 		xe_err(xe, "sysctrl: failed to clear counter %d\n", ret);
 		return ret;
@@ -1042,7 +1042,7 @@ int xe_ras_get_threshold(struct xe_device *xe, u8 severity, u8 component, u32 *t
 				  &request, sizeof(request), &response, sizeof(response));
 
 	guard(xe_pm_runtime)(xe);
-	ret = xe_sysctrl_send_command(&xe->sc, &command, &len);
+	ret = xe_sysctrl_send_command(&xe->sc, &command, &len, true);
 	if (ret) {
 		xe_err(xe, "sysctrl: failed to get threshold %d\n", ret);
 		return ret;
@@ -1095,7 +1095,7 @@ int xe_ras_set_threshold(struct xe_device *xe, u8 severity, u8 component, u32 th
 				  &request, sizeof(request), &response, sizeof(response));
 
 	guard(xe_pm_runtime)(xe);
-	ret = xe_sysctrl_send_command(&xe->sc, &command, &len);
+	ret = xe_sysctrl_send_command(&xe->sc, &command, &len, true);
 	if (ret) {
 		xe_err(xe, "sysctrl: failed to set threshold %d\n", ret);
 		return ret;
@@ -1137,7 +1137,7 @@ static ssize_t gpu_health_show(struct device *dev, struct device_attribute *attr
 	xe_sysctrl_create_command(&command, XE_SYSCTRL_GROUP_GFSP, XE_SYSCTRL_CMD_GET_HEALTH,
 				  &request, sizeof(request), &response, sizeof(response));
 	guard(xe_pm_runtime)(xe);
-	ret = xe_sysctrl_send_command(&xe->sc, &command, &rlen);
+	ret = xe_sysctrl_send_command(&xe->sc, &command, &rlen, true);
 	if (ret) {
 		xe_err(xe, "sysctrl: failed to get health %d\n", ret);
 		return ret;
@@ -1182,7 +1182,7 @@ static ssize_t gpu_health_store(struct device *dev, struct device_attribute *att
 	xe_sysctrl_create_command(&command, XE_SYSCTRL_GROUP_GFSP, XE_SYSCTRL_CMD_SET_HEALTH,
 				  &request, sizeof(request), &response, sizeof(response));
 	guard(xe_pm_runtime)(xe);
-	ret = xe_sysctrl_send_command(&xe->sc, &command, &rlen);
+	ret = xe_sysctrl_send_command(&xe->sc, &command, &rlen, true);
 	if (ret) {
 		xe_err(xe, "sysctrl: failed to set health %d\n", ret);
 		return ret;
diff --git a/drivers/gpu/drm/xe/xe_sysctrl.c b/drivers/gpu/drm/xe/xe_sysctrl.c
index a7f8c8edd012..66b4e519d29c 100644
--- a/drivers/gpu/drm/xe/xe_sysctrl.c
+++ b/drivers/gpu/drm/xe/xe_sysctrl.c
@@ -166,7 +166,7 @@ xe_sysctrl_check_app_status(struct xe_device *xe, enum xe_sysctrl_app_id app_id)
 	xe_sysctrl_create_command(&cmd, XE_SYSCTRL_GROUP_CORE, XE_SYSCTRL_CMD_GET_APP_STATUS_BY_ID,
 				  &req, sizeof(req), &resp, sizeof(resp));
 
-	ret = xe_sysctrl_send_command(&xe->sc, &cmd, &out_len);
+	ret = xe_sysctrl_send_command(&xe->sc, &cmd, &out_len, true);
 	if (ret)
 		return XE_SYSCTRL_FIRMWARE_COMM_FAILURE;
 
@@ -243,7 +243,7 @@ int xe_sysctrl_sdk_api_version(struct xe_device *xe, u16 *version)
 	xe_sysctrl_create_command(&cmd, XE_SYSCTRL_GROUP_CORE, XE_SYSCTRL_CMD_SDK_API_VERSION,
 				  0, 0, &resp, sizeof(resp));
 
-	ret = xe_sysctrl_send_command(&xe->sc, &cmd, &out_len);
+	ret = xe_sysctrl_send_command(&xe->sc, &cmd, &out_len, true);
 	if (ret)
 		return ret;
 
@@ -270,7 +270,7 @@ static int sysctrl_media_defeature(struct xe_device *xe, u8 feature)
 				  XE_SYSCTRL_CMD_MEDIA_DEFEATURE,
 				  &req, sizeof(req), &resp, sizeof(resp));
 
-	ret = xe_sysctrl_send_command(&xe->sc, &cmd, &out_len);
+	ret = xe_sysctrl_send_command(&xe->sc, &cmd, &out_len, false);
 	if (ret)
 		return ret;
 
@@ -308,8 +308,8 @@ static int sysctrl_media_defeature_send(struct xe_device *xe, u8 feature)
 
 	ret = sysctrl_media_defeature(xe, feature);
 	if (ret) {
-		xe_err(xe, "sysctrl: failed to defeature media (0x%02x): %pe\n",
-		       feature, ERR_PTR(ret));
+		xe_info(xe, "sysctrl: failed to defeature media (0x%02x): %pe\n",
+			feature, ERR_PTR(ret));
 		return ret;
 	}
 
diff --git a/drivers/gpu/drm/xe/xe_sysctrl_debugfs.c b/drivers/gpu/drm/xe/xe_sysctrl_debugfs.c
index e0db099ef0ad..510c48ebd0ba 100644
--- a/drivers/gpu/drm/xe/xe_sysctrl_debugfs.c
+++ b/drivers/gpu/drm/xe/xe_sysctrl_debugfs.c
@@ -85,7 +85,7 @@ static ssize_t xe_sysctrl_loopback_write(struct file *file, const char __user *u
 
 	scoped_guard(mutex, &entry->lock) {
 		guard(xe_pm_runtime)(xe);
-		entry->status = xe_sysctrl_send_command(entry->sc, &cmd, &out_len);
+		entry->status = xe_sysctrl_send_command(entry->sc, &cmd, &out_len, true);
 		entry->response_len = entry->status ? 0 : out_len;
 		status = entry->status;
 	}
@@ -227,7 +227,7 @@ static ssize_t xe_sysctrl_ras_error_inject_write(struct file *file, const char _
 
 	scoped_guard(mutex, &entry->lock) {
 		guard(xe_pm_runtime)(xe);
-		status = xe_sysctrl_send_command(entry->sc, &cmd, &out_len);
+		status = xe_sysctrl_send_command(entry->sc, &cmd, &out_len, true);
 		entry->status = status;
 	}
 
@@ -420,7 +420,7 @@ static ssize_t xe_sysctrl_mailbox_write(struct file *file, const char __user *ub
 		cmd.timeout_ms = timeout_ms;
 
 		guard(xe_pm_runtime)(xe);
-		status = xe_sysctrl_send_command(entry->sc, &cmd, &out_len);
+		status = xe_sysctrl_send_command(entry->sc, &cmd, &out_len, true);
 		entry->status = status;
 		entry->response_len = status ? 0 : out_len;
 	}
diff --git a/drivers/gpu/drm/xe/xe_sysctrl_event.c b/drivers/gpu/drm/xe/xe_sysctrl_event.c
index 3239c110a66a..9ef34e0c48f9 100644
--- a/drivers/gpu/drm/xe/xe_sysctrl_event.c
+++ b/drivers/gpu/drm/xe/xe_sysctrl_event.c
@@ -24,7 +24,7 @@ static void get_pending_event(struct xe_sysctrl *sc, struct xe_sysctrl_mailbox_c
 	do {
 		memset(response, 0, sizeof(*response));
 
-		ret = xe_sysctrl_send_command(sc, command, &len);
+		ret = xe_sysctrl_send_command(sc, command, &len, true);
 		if (ret) {
 			xe_log_err(xe, SYSCTRL, ret, "Failed to get pending event\n");
 			return;
diff --git a/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c b/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
index 2af73c62d32d..0da7831c7157 100644
--- a/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
+++ b/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
@@ -216,7 +216,8 @@ static int sysctrl_process_frame(struct xe_sysctrl *sc,
 static int sysctrl_receive_frames(struct xe_sysctrl *sc,
 				  const struct xe_sysctrl_mailbox_msg_hdr *req,
 				  void *data_out, size_t data_out_len,
-				  size_t *rdata_len, unsigned int timeout_ms)
+				  size_t *rdata_len, unsigned int timeout_ms,
+				  bool print_on_error)
 {
 	struct xe_sysctrl_mailbox_msg_hdr *hdr;
 	struct xe_device *xe = sc_to_xe(sc);
@@ -248,16 +249,17 @@ static int sysctrl_receive_frames(struct xe_sysctrl *sc,
 
 	hdr = (struct xe_sysctrl_mailbox_msg_hdr *)buffer;
 
-	if (!XE_SYSCTRL_HDR_IS_RESPONSE(hdr) ||
-	    XE_SYSCTRL_HDR_GROUP_ID(hdr) != XE_SYSCTRL_HDR_GROUP_ID(req) ||
-	    XE_SYSCTRL_HDR_COMMAND(hdr) != XE_SYSCTRL_HDR_COMMAND(req)) {
+	if ((!XE_SYSCTRL_HDR_IS_RESPONSE(hdr) ||
+	     XE_SYSCTRL_HDR_GROUP_ID(hdr) != XE_SYSCTRL_HDR_GROUP_ID(req) ||
+	     XE_SYSCTRL_HDR_COMMAND(hdr) != XE_SYSCTRL_HDR_COMMAND(req)) &&
+	    print_on_error) {
 		xe_log_err(xe, SYSCTRL, -EPROTO,
 			   "Response header mismatch: %#x != %#x\n",
 			   hdr->data, req->data);
 		return -EPROTO;
 	}
 
-	if (XE_SYSCTRL_HDR_RESULT(hdr) != 0) {
+	if (XE_SYSCTRL_HDR_RESULT(hdr) != 0 && print_on_error) {
 		xe_log_err(xe, SYSCTRL, -EIO, "Firmware error: %#04x %#x.%#x\n",
 			   XE_SYSCTRL_HDR_RESULT(hdr),
 			   XE_SYSCTRL_HDR_GROUP_ID(req), XE_SYSCTRL_HDR_COMMAND(req));
@@ -273,7 +275,8 @@ static int sysctrl_receive_frames(struct xe_sysctrl *sc,
 static int sysctrl_send_command(struct xe_sysctrl *sc,
 				const u8 *mbox_cmd, size_t cmd_size,
 				void *data_out, size_t data_out_len,
-				size_t *rdata_len, unsigned int timeout_ms)
+				size_t *rdata_len, unsigned int timeout_ms,
+				bool print_on_error)
 {
 	const struct xe_sysctrl_mailbox_msg_hdr *hdr;
 	size_t received;
@@ -289,7 +292,8 @@ static int sysctrl_send_command(struct xe_sysctrl *sc,
 	hdr = (const struct xe_sysctrl_mailbox_msg_hdr *)mbox_cmd;
 
 	ret = sysctrl_receive_frames(sc, hdr, data_out, data_out_len,
-				     &received, timeout_ms);
+				     &received, timeout_ms,
+				     print_on_error);
 	if (ret)
 		return ret;
 
@@ -349,7 +353,8 @@ void xe_sysctrl_create_command(struct xe_sysctrl_mailbox_command *command, u8 gr
  */
 int xe_sysctrl_send_command(struct xe_sysctrl *sc,
 			    struct xe_sysctrl_mailbox_command *cmd,
-			    size_t *rdata_len)
+			    size_t *rdata_len,
+			    bool print_on_error)
 {
 	struct xe_device *xe = sc_to_xe(sc);
 	u8 group_id, command_code;
@@ -379,8 +384,8 @@ int xe_sysctrl_send_command(struct xe_sysctrl *sc,
 
 	ret = sysctrl_send_command(sc, sc->cmd_buf, cmd_size,
 				   cmd->data_out, cmd->data_out_len, rdata_len,
-				   timeout_ms);
-	if (ret)
+				   timeout_ms, print_on_error);
+	if (ret && print_on_error)
 		xe_log_err(xe, SYSCTRL, ret, "Mailbox command failed to send %#x.%#x\n",
 			   group_id, command_code);
 
diff --git a/drivers/gpu/drm/xe/xe_sysctrl_mailbox.h b/drivers/gpu/drm/xe/xe_sysctrl_mailbox.h
index 5a3dd14e3a11..165155aba297 100644
--- a/drivers/gpu/drm/xe/xe_sysctrl_mailbox.h
+++ b/drivers/gpu/drm/xe/xe_sysctrl_mailbox.h
@@ -28,6 +28,7 @@ void xe_sysctrl_create_command(struct xe_sysctrl_mailbox_command *command, u8 gr
 			       size_t response_len);
 int xe_sysctrl_send_command(struct xe_sysctrl *sc,
 			    struct xe_sysctrl_mailbox_command *cmd,
-			    size_t *rdata_len);
+			    size_t *rdata_len,
+			    bool print_on_error);
 
 #endif
-- 
2.43.0


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

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

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-21 18:23 [PATCH 00/17] Work around media 52-bit limitation on CRI Stuart Summers
2026-11-21 18:23 ` [PATCH 01/17] drm/xe/sysctrl: Use preallocated mailbox staging buffers Stuart Summers
2026-11-21 18:23 ` [PATCH 02/17] drm/xe: Process device OOB workarounds during early info init Stuart Summers
2026-11-21 18:23 ` [PATCH 03/17] drm/xe/sysctrl: Restore the SoC remapper on every runtime resume Stuart Summers
2026-11-21 18:23 ` [PATCH 04/17] drm/xe: Add enable_media module parameter Stuart Summers
2026-11-21 18:23 ` [PATCH 05/17] drm/xe: Detect each GMD_ID IP in a loop Stuart Summers
2026-11-21 18:23 ` [PATCH 06/17] drm/xe: Tolerate a missing graphics IP in xe_info_init() Stuart Summers
2026-11-21 18:23 ` [PATCH 07/17] drm/xe: Verify IP presence against GU_CNTL Stuart Summers
2026-11-21 18:23 ` [PATCH 08/17] drm/xe: Guard per-tile primary GT accesses Stuart Summers
2026-11-21 18:23 ` [PATCH 09/17] drm/xe: Stop assuming the root tile has a primary GT Stuart Summers
2026-11-21 18:23 ` [PATCH 10/17] drm/xe: Do not claim flat CCS without a graphics IP Stuart Summers
2026-11-21 18:23 ` [PATCH 11/17] drm/xe: Run page table updates on the media GT when there is no primary Stuart Summers
2026-11-21 18:23 ` [PATCH 12/17] drm/xe: Document that gt_types_allowed=media now probes Stuart Summers
2026-11-21 18:23 ` [PATCH 13/17] drm/xe: Fall back to CPU copies when the tile cannot blit Stuart Summers
2026-11-21 18:23 ` [PATCH 14/17] drm/xe: Require a fully visible VRAM BAR without a primary GT Stuart Summers
2026-11-21 18:23 ` [PATCH 15/17] drm/xe: Allow probe " Stuart Summers
2026-11-21 18:23 ` [PATCH 16/17] drm/xe: Work around media 52-bit limitation on CRI Stuart Summers
2026-11-21 18:23 ` [PATCH 17/17] drm/xe: Don't error on failed media defeature Stuart Summers

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