* [PATCH 0/2] Work around 52-bit limitation in CRI media
@ 2026-12-03 23:28 Stuart Summers
2026-12-03 23:28 ` [PATCH 1/2] drm/xe: Add enable_media module parameter Stuart Summers
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Stuart Summers @ 2026-12-03 23:28 UTC (permalink / raw)
Cc: intel-xe, thomas.hellstrom, rodrigo.vivi,
alan.previn.teres.alexis, fei.yang, anoop.c.vijay, riana.tauro,
matthew.d.roper, Stuart Summers
Individual commits have the detail of the workaround. Essentially
we are now disabling media by default to give a more consistent
user experience for CRI given that media can only be used in
specific configurations. To enable, there is certain criteria
that must be met, but essentially this means host addresses above
46 bits must be translated down to within 46 bits before being
sent into the media IP. If the KMD cannot guarantee this, media
is disabled.
I had submitted a version of this series already which had
some extra preliminiary patches (which have now been merged)
and some patches I was using for debug. For some reason patchworks
isn't working for me. This series just takes the most critical
patches for the workaround. The for-debug patches from that
other series I'll submit and review separately.
I tested this on a Xeon based CRI that was seeing the original
issue and confirmed this is no longer present with the workaround
and the appropriate changes in the IFWI.
v2: Addressed the review feedback from Rodrigo and Sashiko.
I decided to go with an upleveled macro for the architecture
physical limit.
Using the GMD ID instead of the media_gt structure to
determine media presence now.
Moved a few of the logs from xe_info to xe_dbg. I had
them mistakenly as info for debugging, but no need to
spam here.
I didn't remove the module parameter for now. I know
there is still some ongoing discussion there. I'd like
to conclude on that before making any changes.
Retested all the basic cases here on a 52-bit system
that was previously hitting the issue and it isn't
reproducible.
Stuart Summers (2):
drm/xe: Add enable_media module parameter
drm/xe: Work around media 52-bit limitation on CRI
drivers/gpu/drm/xe/xe_configfs.c | 3 +
drivers/gpu/drm/xe/xe_defaults.h | 1 +
drivers/gpu/drm/xe/xe_device.c | 24 +++
drivers/gpu/drm/xe/xe_device.h | 1 +
drivers/gpu/drm/xe/xe_device_types.h | 2 +
drivers/gpu/drm/xe/xe_device_wa_oob.rules | 1 +
drivers/gpu/drm/xe/xe_module.c | 7 +
drivers/gpu/drm/xe/xe_module.h | 1 +
drivers/gpu/drm/xe/xe_pci.c | 85 ++++++++-
drivers/gpu/drm/xe/xe_pm.c | 7 +-
drivers/gpu/drm/xe/xe_sysctrl.c | 164 ++++++++++++++++++
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 +
14 files changed, 332 insertions(+), 6 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 1/2] drm/xe: Add enable_media module parameter 2026-12-03 23:28 [PATCH 0/2] Work around 52-bit limitation in CRI media Stuart Summers @ 2026-12-03 23:28 ` Stuart Summers 2026-12-03 23:32 ` Summers, Stuart 2026-12-03 23:58 ` sashiko-bot 2026-12-03 23:29 ` [PATCH 2/2] drm/xe: Work around media 52-bit limitation on CRI Stuart Summers 2026-12-04 0:52 ` ✗ CI.checkpatch: warning for Work around 52-bit limitation in CRI media (rev2) Patchwork 2 siblings, 2 replies; 9+ messages in thread From: Stuart Summers @ 2026-12-03 23:28 UTC (permalink / raw) Cc: intel-xe, thomas.hellstrom, rodrigo.vivi, alan.previn.teres.alexis, fei.yang, anoop.c.vijay, riana.tauro, matthew.d.roper, 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. Disabling media through 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. It only applies to platforms with a standalone media GT. The decision is made once during early probe from the modparam and configfs, and latched into xe->info.media_allowed, read back through xe_device_media_allowed(). That keeps it fixed for the lifetime of the device and makes it available outside xe_pci.c. Signed-off-by: Stuart Summers <stuart.summers@intel.com> Assisted-by: LLM --- 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 | 25 ++++++++++++++++++++----- 8 files changed, 49 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_configfs.c index 3a05e1cd9dda..7f1a809b0999 100644 --- a/drivers/gpu/drm/xe/xe_configfs.c +++ b/drivers/gpu/drm/xe/xe_configfs.c @@ -220,6 +220,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 30710e3aff2a..de89342f737e 100644 --- a/drivers/gpu/drm/xe/xe_device.c +++ b/drivers/gpu/drm/xe/xe_device.c @@ -379,6 +379,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 the media GT may be used, false otherwise. + */ +bool xe_device_media_allowed(const 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 6b1e48369bdd..19b8914cd047 100644 --- a/drivers/gpu/drm/xe/xe_device.h +++ b/drivers/gpu/drm/xe/xe_device.h @@ -282,6 +282,7 @@ static inline bool xe_device_is_admin_only(const struct xe_device *xe) } #endif +bool xe_device_media_allowed(const 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 62ca5c645179..19d235ae32e8 100644 --- a/drivers/gpu/drm/xe/xe_device_types.h +++ b/drivers/gpu/drm/xe/xe_device_types.h @@ -231,6 +231,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..029443ec252a 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 standalone 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 9a88520aae3c..2771e1a60e47 100644 --- a/drivers/gpu/drm/xe/xe_pci.c +++ b/drivers/gpu/drm/xe/xe_pci.c @@ -654,7 +654,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; } @@ -791,6 +791,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. @@ -817,6 +829,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; @@ -965,13 +980,13 @@ 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 (MEDIA_VER(xe) < 13 || !media_desc) return NULL; - } - if (MEDIA_VER(xe) < 13 || !media_desc) + if (!xe_device_media_allowed(xe)) { + xe_tile_info(tile, "Media GT disabled\n"); return NULL; + } gt = xe_gt_alloc(tile); if (IS_ERR(gt)) -- 2.43.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] drm/xe: Add enable_media module parameter 2026-12-03 23:28 ` [PATCH 1/2] drm/xe: Add enable_media module parameter Stuart Summers @ 2026-12-03 23:32 ` Summers, Stuart 2026-12-03 23:58 ` sashiko-bot 1 sibling, 0 replies; 9+ messages in thread From: Summers, Stuart @ 2026-12-03 23:32 UTC (permalink / raw) To: Summers, Stuart Cc: intel-xe@lists.freedesktop.org, Yang, Fei, Vivi, Rodrigo, Roper, Matthew D, Vijay, Anoop C, Tauro, Riana, thomas.hellstrom@linux.intel.com, Teres Alexis, Alan Previn On Thu, 2026-12-03 at 23:28 +0000, Stuart Summers wrote: > The gt_types_allowed configfs attribute is intended for debug only, > so provide a supported way to disable the media GT in production. > Disabling media through 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. It only > applies to platforms with a standalone media GT. > > The decision is made once during early probe from the modparam and > configfs, and latched into xe->info.media_allowed, read back through > xe_device_media_allowed(). That keeps it fixed for the lifetime of > the device and makes it available outside xe_pci.c. > > Signed-off-by: Stuart Summers <stuart.summers@intel.com> > Assisted-by: LLM This was added by mistake :( I'll make sure to drop these Assisted-by lines in the next rev. Thanks, Stuart > --- > 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 | 25 ++++++++++++++++++++----- > 8 files changed, 49 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/xe/xe_configfs.c > b/drivers/gpu/drm/xe/xe_configfs.c > index 3a05e1cd9dda..7f1a809b0999 100644 > --- a/drivers/gpu/drm/xe/xe_configfs.c > +++ b/drivers/gpu/drm/xe/xe_configfs.c > @@ -220,6 +220,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_DISPL > AY) > #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 30710e3aff2a..de89342f737e 100644 > --- a/drivers/gpu/drm/xe/xe_device.c > +++ b/drivers/gpu/drm/xe/xe_device.c > @@ -379,6 +379,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 the media GT may be used, false otherwise. > + */ > +bool xe_device_media_allowed(const 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 6b1e48369bdd..19b8914cd047 100644 > --- a/drivers/gpu/drm/xe/xe_device.h > +++ b/drivers/gpu/drm/xe/xe_device.h > @@ -282,6 +282,7 @@ static inline bool xe_device_is_admin_only(const > struct xe_device *xe) > } > #endif > > +bool xe_device_media_allowed(const 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 62ca5c645179..19d235ae32e8 100644 > --- a/drivers/gpu/drm/xe/xe_device_types.h > +++ b/drivers/gpu/drm/xe/xe_device_types.h > @@ -231,6 +231,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..029443ec252a 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 standalone 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 9a88520aae3c..2771e1a60e47 100644 > --- a/drivers/gpu/drm/xe/xe_pci.c > +++ b/drivers/gpu/drm/xe/xe_pci.c > @@ -654,7 +654,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; > } > @@ -791,6 +791,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. > @@ -817,6 +829,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; > @@ -965,13 +980,13 @@ 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 (MEDIA_VER(xe) < 13 || !media_desc) > return NULL; > - } > > - if (MEDIA_VER(xe) < 13 || !media_desc) > + if (!xe_device_media_allowed(xe)) { > + xe_tile_info(tile, "Media GT disabled\n"); > return NULL; > + } > > gt = xe_gt_alloc(tile); > if (IS_ERR(gt)) ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] drm/xe: Add enable_media module parameter 2026-12-03 23:28 ` [PATCH 1/2] drm/xe: Add enable_media module parameter Stuart Summers 2026-12-03 23:32 ` Summers, Stuart @ 2026-12-03 23:58 ` sashiko-bot 1 sibling, 0 replies; 9+ messages in thread From: sashiko-bot @ 2026-12-03 23:58 UTC (permalink / raw) To: Stuart Summers; +Cc: intel-xe Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] drm/xe: alloc_media_gt() suppresses Media GT disabled log on SR-IOV VFs -- commit 70b923e02e002693479f5778516b2b12abe532d5 Author: Stuart Summers <stuart.summers@intel.com> drm/xe: Add enable_media module parameter This commit adds a tri-state enable_media module parameter and latches the combined modparam and configfs decision into xe->info.media_allowed during early probe. > diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c > index 3f61d3eec2e2c..4e464ba3bbee8 100644 > --- a/drivers/gpu/drm/xe/xe_pci.c > +++ b/drivers/gpu/drm/xe/xe_pci.c > @@ -652,7 +652,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; > } [ ... ] > @@ -962,13 +977,13 @@ 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 (MEDIA_VER(xe) < 13 || !media_desc) > return NULL; > - } > > - if (MEDIA_VER(xe) < 13 || !media_desc) > + if (!xe_device_media_allowed(xe)) { > + xe_tile_info(tile, "Media GT disabled\n"); > return NULL; > + } > > gt = xe_gt_alloc(tile); > if (IS_ERR(gt)) [Severity: Low] Does reordering these checks suppress the "Media GT disabled" log message on SR-IOV VFs? When media is disallowed on a VF, read_gmdid() returns *ver = 0 for GMDID_MEDIA, leaving MEDIA_VER(xe) == 0 and media_desc == NULL. alloc_media_gt() then returns early before xe_tile_info(), so VF logs can no longer distinguish disabled media from hardware without a media GT. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261203232859.321380-4-stuart.summers@intel.com?part=1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/2] drm/xe: Work around media 52-bit limitation on CRI 2026-12-03 23:28 [PATCH 0/2] Work around 52-bit limitation in CRI media Stuart Summers 2026-12-03 23:28 ` [PATCH 1/2] drm/xe: Add enable_media module parameter Stuart Summers @ 2026-12-03 23:29 ` Stuart Summers 2026-12-04 0:03 ` sashiko-bot 2026-12-04 0:52 ` ✗ CI.checkpatch: warning for Work around 52-bit limitation in CRI media (rev2) Patchwork 2 siblings, 1 reply; 9+ messages in thread From: Stuart Summers @ 2026-12-03 23:29 UTC (permalink / raw) Cc: intel-xe, thomas.hellstrom, rodrigo.vivi, alan.previn.teres.alexis, fei.yang, anoop.c.vijay, riana.tauro, matthew.d.roper, 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 the architectural host physical address limit fits in 46 bits (e.g. x86-64 with 4-level paging). 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. Media disable persists until a secondary bus reset, so it is only sent at probe. Address translation disable is lost on power loss, so it is sent again on resume from D3cold and system suspend. HSDES: 14028632488 Signed-off-by: Stuart Summers <stuart.summers@intel.com> Assisted-by: LLM --- 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 | 64 ++++++- drivers/gpu/drm/xe/xe_pm.c | 7 +- drivers/gpu/drm/xe/xe_sysctrl.c | 164 ++++++++++++++++++ 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, 285 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c index de89342f737e..1ef4908a7d69 100644 --- a/drivers/gpu/drm/xe/xe_device.c +++ b/drivers/gpu/drm/xe/xe_device.c @@ -1017,6 +1017,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; @@ -1560,6 +1566,10 @@ int xe_device_resume(struct xe_device *xe, bool flr) xe_sysctrl_pm_resume(xe); + err = xe_sysctrl_media_resume(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 2771e1a60e47..d68f1050ee3d 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> @@ -791,6 +794,54 @@ 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; +} + +/* Highest architectural physical address the host can produce */ +static u64 host_max_phys_addr(void) +{ +#ifdef MAX_PHYSMEM_BITS + return DMA_BIT_MASK(MAX_PHYSMEM_BITS); +#else + return (phys_addr_t)-1; +#endif +} + +/* + * 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 = host_max_phys_addr(); + + 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. @@ -798,7 +849,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; } @@ -830,9 +881,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 51e020fbf9a6..1573fdd97b68 100644 --- a/drivers/gpu/drm/xe/xe_pm.c +++ b/drivers/gpu/drm/xe/xe_pm.c @@ -665,9 +665,14 @@ int xe_pm_runtime_resume(struct xe_device *xe) xe_i2c_pm_resume(xe, xe->d3cold.allowed); - if (xe->d3cold.allowed) + if (xe->d3cold.allowed) { xe_sysctrl_pm_resume(xe); + err = xe_sysctrl_media_resume(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 d362e8156fca..2fc4e35f3e25 100644 --- a/drivers/gpu/drm/xe/xe_sysctrl.c +++ b/drivers/gpu/drm/xe/xe_sysctrl.c @@ -5,9 +5,12 @@ #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" @@ -19,6 +22,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 +107,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); } @@ -249,3 +254,162 @@ 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, logging any failure */ +static int sysctrl_media_defeature_send(struct xe_device *xe, u8 feature) +{ + 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)); + else + xe_dbg(xe, "sysctrl: media defeature 0x%02x done\n", feature); + + 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_resume() - Restore media address translation defeature + * @xe: xe device instance + * + * The media address translation defeature does not survive a power loss, so + * it must be requested again on resume from D3cold or system suspend whenever + * media is in use and ATS is enabled. The media defeature sent at probe when + * media is not in use persists until a secondary bus reset, which cannot + * happen while the driver is bound, so it is not resent here. + * + * Return: 0 on success, error code on failure + */ +int xe_sysctrl_media_resume(struct xe_device *xe) +{ + if (!sysctrl_media_defeature_needed(xe) || + !xe_device_media_allowed(xe) || !sysctrl_ats_enabled(xe)) + return 0; + + return sysctrl_media_defeature_send(xe, XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE); +} + +/* + * Drop media from the device. Only safe during probe, before the media GT is + * fully 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) { + if (!tile->media_gt) + continue; + + tile->media_gt = NULL; + xe->info.gt_count--; + } +} + +/** + * xe_sysctrl_media_probe() - Configure media with the System Controller at probe + * @xe: xe device instance + * + * The driver and the System Controller must agree on the media configuration + * before media is used. When media is in use and ATS is enabled, address + * translation for media is not supported and must be defeatured. When media + * has been disabled, via either the enable_media modparam or the + * gt_types_allowed configfs attribute, media itself is defeatured so it does + * not consume power. + * + * Media cannot be used while the System Controller does not know how it is + * configured, so if address translation cannot be defeatured, media is + * defeatured and dropped instead and probe continues without it. If that + * fails too, the System Controller is assumed not to support these requests + * and none are sent again. + * + * This is restricted to platforms that need this workaround and must be called + * before any media GT is brought up. + */ +void xe_sysctrl_media_probe(struct xe_device *xe) +{ + bool media_allowed = xe_device_media_allowed(xe); + int ret; + + if (!sysctrl_media_defeature_needed(xe) || !xe->info.media_verx100) + return; + + if (media_allowed) { + if (!sysctrl_ats_enabled(xe)) + return; + + if (!sysctrl_media_defeature_send(xe, XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE)) { + xe_dbg(xe, "sysctrl: media address translation defeatured\n"); + return; + } + } + + ret = sysctrl_media_defeature_send(xe, XE_SYSCTRL_MEDIA_DEFEATURE_DISABLE); + if (ret) + xe->sc.has_media_feature_disable = false; + else + xe_dbg(xe, "sysctrl: media defeatured\n"); + + if (media_allowed) { + sysctrl_media_drop(xe); + xe_err(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..f751986f7f84 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); +void xe_sysctrl_media_probe(struct xe_device *xe); +int xe_sysctrl_media_resume(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 50b1d9abaf1f..85ad92ffb2b1 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, }; @@ -96,6 +98,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..1b44308b18b7 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. Cleared only if they all fail at probe. + */ + bool has_media_feature_disable; + /** @debugfs: Debugfs entries */ struct { /** @debugfs.root: Root debugfs directory */ -- 2.43.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] drm/xe: Work around media 52-bit limitation on CRI 2026-12-03 23:29 ` [PATCH 2/2] drm/xe: Work around media 52-bit limitation on CRI Stuart Summers @ 2026-12-04 0:03 ` sashiko-bot 0 siblings, 0 replies; 9+ messages in thread From: sashiko-bot @ 2026-12-04 0:03 UTC (permalink / raw) To: Stuart Summers; +Cc: intel-xe Thank you for your contribution! Sashiko AI review found 6 potential issues to consider: - [Medium] drm/xe: xe_sysctrl_media_resume() skips media disable on reset or power loss - [Medium] drm/xe: xe_sysctrl_media_resume() omits media_verx100 check for absent media - [Medium] drm/xe: host_max_phys_addr() misuses MAX_PHYSMEM_BITS for 46-bit DMA check - [Medium] drm/xe: sticky media defeature in xe_sysctrl_media_probe() breaks reload - [Medium] drm/xe: xe_sysctrl_media_probe() skips media ATS disable for SR-IOV VFs - [Medium] drm/xe: sysctrl_media_defeature() ignores resp.flags firmware status -- commit 7d17b36bd7bfeabd2f18b1bba4f21be143424af7 Author: Stuart Summers <stuart.summers@intel.com> drm/xe: Work around media 52-bit limitation on CRI This commit disables media by default on CRI, clamps the device DMA mask to 46 bits when media is enabled on systems whose DMA stays within 46 bits, and adds System Controller mailbox commands to power down media or disable media address translation at probe and resume. > diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c > index 4e464ba3bbee8..12fd78137beab 100644 > --- a/drivers/gpu/drm/xe/xe_pci.c > +++ b/drivers/gpu/drm/xe/xe_pci.c [ ... ] > @@ -789,6 +792,54 @@ 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; > +} > + > +/* Highest architectural physical address the host can produce */ > +static u64 host_max_phys_addr(void) > +{ > +#ifdef MAX_PHYSMEM_BITS > + return DMA_BIT_MASK(MAX_PHYSMEM_BITS); > +#else > + return (phys_addr_t)-1; > +#endif > +} > + > +/* > + * 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 = host_max_phys_addr(); > + > + 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; > +} [Severity: Medium] Is MAX_PHYSMEM_BITS a safe proxy for the highest DMA address the host can produce without a translating IOMMU? On x86-64 with 4-level paging, MAX_PHYSMEM_BITS is 46 (the direct-map RAM ceiling) even when boot_cpu_data.x86_phys_bits is 48 or 52, AMD SME places the encryption bit above bit 46, or dev->dma_range_map applies an offset. When cri_media_addressable() falsely returns true, xe_info_init_early() clamps the device DMA mask to 46 bits. On a 4-level paging AMD SME host without IOMMU translation, force_dma_unencrypted() then returns true and bounces system-RAM BOs through SWIOTLB, which breaks xe_tt_map_sg() because xe passes DMA_ATTR_SKIP_CPU_SYNC. Peer MMIO BARs above 46 bits also fail dma_capable() in dma_direct_map_phys(). Conversely, when CONFIG_SPARSEMEM is disabled (such as 32-bit PAE with CONFIG_FLATMEM), MAX_PHYSMEM_BITS is undefined and host_max_phys_addr() falls back to (phys_addr_t)-1, spuriously disabling media. Checking actual physical and DMA bounds (such as iomem_resource.end, SME encryption, and dev->dma_range_map) would avoid both issues. > diff --git a/drivers/gpu/drm/xe/xe_sysctrl.c b/drivers/gpu/drm/xe/xe_sysctrl.c > index d362e8156fca2..2fc4e35f3e25d 100644 > --- a/drivers/gpu/drm/xe/xe_sysctrl.c > +++ b/drivers/gpu/drm/xe/xe_sysctrl.c [ ... ] > @@ -249,3 +254,162 @@ 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; > +} [Severity: Medium] Should sysctrl_media_defeature() validate resp.flags before returning 0? struct xe_sysctrl_media_defeature_resp defines u32 flags as firmware status flags, and sysctrl_receive_frames() only checks the transport header result (XE_SYSCTRL_HDR_RESULT(hdr) == 0), leaving payload status fields to callers as xe_sysctrl_check_app_status() and xe_ras.c do. If firmware reports a command-level failure in resp.flags, xe_sysctrl_media_probe() skips sysctrl_media_drop() and brings up the media GT with ATS still enabled. [ ... ] > +/* 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; > +} [Severity: Medium] Should sysctrl_media_defeature_needed() (or xe_sysctrl_media_resume()) also check xe->info.media_verx100? xe_info_init_early() sets xe->info.media_allowed before handle_gmdid() probes hardware, and xe_info_init() leaves media_allowed true when media is fused off (media_verx100 == 0). xe_sysctrl_media_probe() returns early on !xe->info.media_verx100 without checking firmware support or clearing has_media_feature_disable. On a CRI SKU with fused-off media, enable_media=1, and ATS enabled, xe_sysctrl_media_resume() will still send XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE on resume, and any firmware error will abort xe_pm_runtime_resume() or xe_device_resume(). > +/** > + * xe_sysctrl_media_resume() - Restore media address translation defeature > + * @xe: xe device instance > + * > + * The media address translation defeature does not survive a power loss, so > + * it must be requested again on resume from D3cold or system suspend whenever > + * media is in use and ATS is enabled. The media defeature sent at probe when > + * media is not in use persists until a secondary bus reset, which cannot > + * happen while the driver is bound, so it is not resent here. > + * > + * Return: 0 on success, error code on failure > + */ > +int xe_sysctrl_media_resume(struct xe_device *xe) > +{ > + if (!sysctrl_media_defeature_needed(xe) || > + !xe_device_media_allowed(xe) || !sysctrl_ats_enabled(xe)) > + return 0; > + > + return sysctrl_media_defeature_send(xe, XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE); > +} [Severity: Medium] Can a secondary bus reset or full power loss happen while the driver stays bound, leaving media powered on after resume? PCI core executes secondary bus resets without unbinding the driver (pci_reset_function() -> pci_reset_bus_function() -> xe_pci_reset_done() -> xe_device_resume(xe, true)), and runtime D3cold, S3 suspend, and S4 hibernation also remove power and resume via xe_pm_runtime_resume() or xe_device_resume() instead of re-running xe_sysctrl_media_probe(). Because xe_sysctrl_media_resume() returns early whenever !xe_device_media_allowed(xe), XE_SYSCTRL_MEDIA_DEFEATURE_DISABLE is never re-sent in the default CRI configuration, leaving unused media powered on. [ ... ] > +void xe_sysctrl_media_probe(struct xe_device *xe) > +{ > + bool media_allowed = xe_device_media_allowed(xe); > + int ret; > + > + if (!sysctrl_media_defeature_needed(xe) || !xe->info.media_verx100) > + return; > + > + if (media_allowed) { > + if (!sysctrl_ats_enabled(xe)) > + return; > + > + if (!sysctrl_media_defeature_send(xe, XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE)) { > + xe_dbg(xe, "sysctrl: media address translation defeatured\n"); > + return; > + } > + } [Severity: Medium] Can SR-IOV VFs enable ATS while PCI_ATS_CTRL_ENABLE is clear on the PF, bypassing media ATS disable? When the PF is attached to an identity IOMMU domain (for example iommu=pt in Intel VT-d legacy mode or ARM SMMUv3) on a 4-level paging host with enable_media=1, pci_prepare_ats() programs ats_stu on the PF while leaving PCI_ATS_CTRL_ENABLE clear, so sysctrl_ats_enabled() returns false in both xe_sysctrl_media_probe() and xe_sysctrl_media_resume(). VFs created later and attached to translating domains (such as VFIO) enable ATS via pci_enable_ats(), which only requires the PF's ats_stu to match. Since xe_info_init() clears has_sysctrl on VFs, they cannot send XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE themselves and hit ATS translation errors and media GuC load failures. > + ret = sysctrl_media_defeature_send(xe, XE_SYSCTRL_MEDIA_DEFEATURE_DISABLE); > + if (ret) > + xe->sc.has_media_feature_disable = false; > + else > + xe_dbg(xe, "sysctrl: media defeatured\n"); [Severity: Medium] Does sending XE_SYSCTRL_MEDIA_DEFEATURE_DISABLE by default break reloading the driver or rebinding via configfs with media enabled? Neither xe_pci_remove() nor xe_driver_flr_fini() performs a secondary bus reset and there is no re-enable command, so media stays defeatured across unload or unbind. Reloading with enable_media=1 (or rebinding with gt_types_allowed=primary,media) then either fails probe on media GT forcewake in xe_gt_init_early() if GMD_ID still reports media, or silently probes without media if GMD_ID reads 0 while leaving dma_mask_size clamped to 46 bits. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261203232859.321380-4-stuart.summers@intel.com?part=2 ^ permalink raw reply [flat|nested] 9+ messages in thread
* ✗ CI.checkpatch: warning for Work around 52-bit limitation in CRI media (rev2) 2026-12-03 23:28 [PATCH 0/2] Work around 52-bit limitation in CRI media Stuart Summers 2026-12-03 23:28 ` [PATCH 1/2] drm/xe: Add enable_media module parameter Stuart Summers 2026-12-03 23:29 ` [PATCH 2/2] drm/xe: Work around media 52-bit limitation on CRI Stuart Summers @ 2026-12-04 0:52 ` Patchwork 2 siblings, 0 replies; 9+ messages in thread From: Patchwork @ 2026-12-04 0:52 UTC (permalink / raw) To: Summers, Stuart; +Cc: intel-xe == Series Details == Series: Work around 52-bit limitation in CRI media (rev2) URL : https://patchwork.freedesktop.org/series/180461/ State : warning == Summary == + KERNEL=/kernel + git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt Cloning into 'mt'... warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/ + git -C mt rev-list -n1 origin/master 3009867cd31863246e4afc138520a7a8bd37bb11 + cd /kernel + git config --global --add safe.directory /kernel + git log -n1 commit 6ccfab152ec785c373aac6c2c0e873c438f6e5da Author: Stuart Summers <stuart.summers@intel.com> Date: Thu Dec 3 23:29:00 2026 +0000 drm/xe: Work around media 52-bit limitation on CRI 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 the architectural host physical address limit fits in 46 bits (e.g. x86-64 with 4-level paging). 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. Media disable persists until a secondary bus reset, so it is only sent at probe. Address translation disable is lost on power loss, so it is sent again on resume from D3cold and system suspend. HSDES: 14028632488 Signed-off-by: Stuart Summers <stuart.summers@intel.com> Assisted-by: LLM + /mt/dim checkpatch f9b8124c80c95744f0510148991dab1a3befffab drm-intel 72f3a0566495 drm/xe: Add enable_media module parameter -:21: WARNING:BAD_SIGN_OFF: Non-standard signature: Assisted-by: #21: Assisted-by: LLM -:21: ERROR:BAD_SIGN_OFF: Unrecognized email address: 'LLM' #21: Assisted-by: LLM total: 1 errors, 1 warnings, 0 checks, 129 lines checked 6ccfab152ec7 drm/xe: Work around media 52-bit limitation on CRI -:54: WARNING:BAD_SIGN_OFF: Non-standard signature: Assisted-by: #54: Assisted-by: LLM -:54: ERROR:BAD_SIGN_OFF: Unrecognized email address: 'LLM' #54: Assisted-by: LLM total: 1 errors, 1 warnings, 0 checks, 390 lines checked ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 0/2] Work around 52-bit limitation in CRI media @ 2026-12-03 19:09 Stuart Summers 2026-12-03 19:14 ` Summers, Stuart 0 siblings, 1 reply; 9+ messages in thread From: Stuart Summers @ 2026-12-03 19:09 UTC (permalink / raw) Cc: intel-xe, thomas.hellstrom, rodrigo.vivi, alan.previn.teres.alexis, fei.yang, anoop.c.vijay, riana.tauro, matthew.d.roper, Stuart Summers Individual commits have the detail of the workaround. Essentially we are now disabling media by default to give a more consistent user experience for CRI given that media can only be used in specific configurations. To enable, there is certain criteria that must be met, but essentially this means host addresses above 46 bits must be translated down to within 46 bits before being sent into the media IP. If the KMD cannot guarantee this, media is disabled. I had submitted a version of this series already which had some extra preliminiary patches (which have now been merged) and some patches I was using for debug. For some reason patchworks isn't working for me. This series just takes the most critical patches for the workaround. The for-debug patches from that other series I'll submit and review separately. I tested this on a Xeon based CRI that was seeing the original issue and confirmed this is no longer present with the workaround and the appropriate changes in the IFWI. Stuart Summers (2): drm/xe: Add enable_media module parameter drm/xe: Work around media 52-bit limitation on CRI drivers/gpu/drm/xe/xe_configfs.c | 3 + drivers/gpu/drm/xe/xe_defaults.h | 1 + drivers/gpu/drm/xe/xe_device.c | 24 +++ drivers/gpu/drm/xe/xe_device.h | 1 + drivers/gpu/drm/xe/xe_device_types.h | 2 + drivers/gpu/drm/xe/xe_device_wa_oob.rules | 1 + drivers/gpu/drm/xe/xe_module.c | 7 + drivers/gpu/drm/xe/xe_module.h | 1 + drivers/gpu/drm/xe/xe_pci.c | 71 +++++++- drivers/gpu/drm/xe/xe_pm.c | 4 + drivers/gpu/drm/xe/xe_sysctrl.c | 166 ++++++++++++++++++ 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 + 14 files changed, 320 insertions(+), 3 deletions(-) -- 2.43.0 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/2] Work around 52-bit limitation in CRI media 2026-12-03 19:09 [PATCH 0/2] Work around 52-bit limitation in CRI media Stuart Summers @ 2026-12-03 19:14 ` Summers, Stuart 0 siblings, 0 replies; 9+ messages in thread From: Summers, Stuart @ 2026-12-03 19:14 UTC (permalink / raw) To: Summers, Stuart Cc: intel-xe@lists.freedesktop.org, Yang, Fei, Vivi, Rodrigo, Roper, Matthew D, Vijay, Anoop C, Tauro, Riana, thomas.hellstrom@linux.intel.com, Teres Alexis, Alan Previn On Thu, 2026-12-03 at 19:09 +0000, Stuart Summers wrote: > Individual commits have the detail of the workaround. Essentially > we are now disabling media by default to give a more consistent > user experience for CRI given that media can only be used in > specific configurations. To enable, there is certain criteria > that must be met, but essentially this means host addresses above > 46 bits must be translated down to within 46 bits before being > sent into the media IP. If the KMD cannot guarantee this, media > is disabled. > > I had submitted a version of this series already which had > some extra preliminiary patches (which have now been merged) > and some patches I was using for debug. For some reason patchworks > isn't working for me. This series just takes the most critical > patches for the workaround. The for-debug patches from that > other series I'll submit and review separately. > > I tested this on a Xeon based CRI that was seeing the original > issue and confirmed this is no longer present with the workaround > and the appropriate changes in the IFWI. Ok patchworks is finally loading for me... https://patchwork.freedesktop.org/series/179173/ - this was my original series for this just to get testing in https://patchwork.freedesktop.org/series/180110/ - these were some preliminary refactoring patches needed for this Thanks, Stuart > > Stuart Summers (2): > drm/xe: Add enable_media module parameter > drm/xe: Work around media 52-bit limitation on CRI > > drivers/gpu/drm/xe/xe_configfs.c | 3 + > drivers/gpu/drm/xe/xe_defaults.h | 1 + > drivers/gpu/drm/xe/xe_device.c | 24 +++ > drivers/gpu/drm/xe/xe_device.h | 1 + > drivers/gpu/drm/xe/xe_device_types.h | 2 + > drivers/gpu/drm/xe/xe_device_wa_oob.rules | 1 + > drivers/gpu/drm/xe/xe_module.c | 7 + > drivers/gpu/drm/xe/xe_module.h | 1 + > drivers/gpu/drm/xe/xe_pci.c | 71 +++++++- > drivers/gpu/drm/xe/xe_pm.c | 4 + > drivers/gpu/drm/xe/xe_sysctrl.c | 166 > ++++++++++++++++++ > 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 + > 14 files changed, 320 insertions(+), 3 deletions(-) > ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-12-04 0:52 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-12-03 23:28 [PATCH 0/2] Work around 52-bit limitation in CRI media Stuart Summers 2026-12-03 23:28 ` [PATCH 1/2] drm/xe: Add enable_media module parameter Stuart Summers 2026-12-03 23:32 ` Summers, Stuart 2026-12-03 23:58 ` sashiko-bot 2026-12-03 23:29 ` [PATCH 2/2] drm/xe: Work around media 52-bit limitation on CRI Stuart Summers 2026-12-04 0:03 ` sashiko-bot 2026-12-04 0:52 ` ✗ CI.checkpatch: warning for Work around 52-bit limitation in CRI media (rev2) Patchwork -- strict thread matches above, loose matches on Subject: below -- 2026-12-03 19:09 [PATCH 0/2] Work around 52-bit limitation in CRI media Stuart Summers 2026-12-03 19:14 ` Summers, Stuart
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox