* [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
2026-12-03 23:29 ` [PATCH 2/2] drm/xe: Work around media 52-bit limitation on CRI Stuart Summers
0 siblings, 2 replies; 15+ 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] 15+ 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 1 sibling, 2 replies; 15+ 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] 15+ 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; 15+ 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] 15+ 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; 15+ 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] 15+ 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 1 sibling, 1 reply; 15+ 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] 15+ 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; 15+ 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] 15+ 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:09 ` [PATCH 1/2] drm/xe: Add enable_media module parameter Stuart Summers 0 siblings, 1 reply; 15+ 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] 15+ messages in thread
* [PATCH 1/2] drm/xe: Add enable_media module parameter 2026-12-03 19:09 [PATCH 0/2] Work around 52-bit limitation in CRI media Stuart Summers @ 2026-12-03 19:09 ` Stuart Summers 2026-12-03 19:34 ` sashiko-bot ` (2 more replies) 0 siblings, 3 replies; 15+ 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 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 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..1d9a2655a57b 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 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 6b1e48369bdd..9f890e692784 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(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..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 9a88520aae3c..e1c31c96327d 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,8 +980,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] 15+ messages in thread
* Re: [PATCH 1/2] drm/xe: Add enable_media module parameter 2026-12-03 19:09 ` [PATCH 1/2] drm/xe: Add enable_media module parameter Stuart Summers @ 2026-12-03 19:34 ` sashiko-bot 2026-12-03 20:01 ` Summers, Stuart 2026-12-03 20:52 ` Matt Roper 2026-12-03 21:33 ` Rodrigo Vivi 2 siblings, 1 reply; 15+ messages in thread From: sashiko-bot @ 2026-12-03 19:34 UTC (permalink / raw) To: Stuart Summers; +Cc: intel-xe Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [Low] drm/xe: bad kernel-doc xref and missing const in xe_device_media_allowed() - [Low] drm/xe: enable_media 0444 permission contradicts writable commit claim - [Low] drm/xe: unmatched closing parenthesis in enable_media MODULE_PARM_DESC - [Low] drm/xe: alloc_media_gt() logs Media GT disabled on platforms without media GT -- commit 9563da05b68af4398b300645f203417f22f81ae8 Author: Stuart Summers <stuart.summers@intel.com> drm/xe: Add enable_media module parameter This commit adds a tri-state enable_media module parameter to control whether the media GT is enabled, latches the combined module parameter and configfs decision into xe->info.media_allowed during early probe, and exposes it via xe_device_media_allowed(). > diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c > index 86de5f183c0a0..de1b29071bb80 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 media may be used, false otherwise. > + */ > +bool xe_device_media_allowed(struct xe_device *xe) > +{ > + return xe->info.media_allowed; > +} [Severity: Low] Should @xe_device.info.media_allowed use & instead of @ so kernel-doc generates a struct member cross-reference? Also, since xe_device_media_allowed() only reads xe->info.media_allowed, should its parameter be const struct xe_device *xe (here and in xe_device.h) to match xe_device_is_admin_only() right above it? [ ... ] > diff --git a/drivers/gpu/drm/xe/xe_module.c b/drivers/gpu/drm/xe/xe_module.c > index 897724cb5cfb8..d6f3dd54613e4 100644 > --- a/drivers/gpu/drm/xe/xe_module.c > +++ b/drivers/gpu/drm/xe/xe_module.c > @@ -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); [Severity: Low] Should enable_media be writable (0600) or is the commit message inaccurate? The commit message states that both inputs are writable while the driver runs, which is why the decision is latched into xe->info.media_allowed. However, 0444 makes /sys/module/xe/parameters/enable_media read-only, and gt_types_allowed_store() in xe_configfs.c already rejects writes with -EBUSY once the device is bound. If enable_media is meant to be runtime-writable, media_wanted() in xe_pci.c also reads xe_modparam.enable_media twice without READ_ONCE() into a local variable, which would create a data race against concurrent sysfs writes. > +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) "])"); [Severity: Low] There is a stray unmatched closing parenthesis after [default=-1] at the end of this description string. [ ... ] > diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c > index 3f61d3eec2e2c..7afd20d1d2983 100644 > --- a/drivers/gpu/drm/xe/xe_pci.c > +++ b/drivers/gpu/drm/xe/xe_pci.c > @@ -962,8 +977,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; > } [Severity: Low] Should the MEDIA_VER(xe) < 13 || !media_desc check right below this run before logging "Media GT disabled"? When xe.enable_media=0 is set on a pre-Media-13 device such as DG2, alloc_primary_gt() still adds media_desc->hw_engine_mask to primary_gt without checking xe_device_media_allowed(), and alloc_media_gt() then logs "Media GT disabled" anyway; on media-less devices it logs that message even though no media GT exists. The comments on info.media_allowed and xe_device_media_allowed() also describe the flag as governing media IP rather than standalone media GTs. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261203190926.249488-4-stuart.summers@intel.com?part=1 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] drm/xe: Add enable_media module parameter 2026-12-03 19:34 ` sashiko-bot @ 2026-12-03 20:01 ` Summers, Stuart 0 siblings, 0 replies; 15+ messages in thread From: Summers, Stuart @ 2026-12-03 20:01 UTC (permalink / raw) To: sashiko-reviews@lists.linux.dev; +Cc: intel-xe@lists.freedesktop.org On Thu, 2026-12-03 at 19:34 +0000, sashiko-bot@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 4 potential > issues to consider: > - [Low] drm/xe: bad kernel-doc xref and missing const in > xe_device_media_allowed() I'll clean this up. > - [Low] drm/xe: enable_media 0444 permission contradicts writable > commit Hm.. let me review here. I think this is correct and we just want the commit message fixed - basically this is read only after the probe (you can't enable media at runtime, only at probe time). > claim > - [Low] drm/xe: unmatched closing parenthesis in enable_media > MODULE_PARM_DESC I don't think this is a real issue but I'll double check... This is a stringify here so it's expected the quotes and parenthesis are a little back and forth here. > - [Low] drm/xe: alloc_media_gt() logs Media GT disabled on platforms > without media GT I guess it would be nice to get feedback on this one. This seems like low priority, but also.. maybe it is best to just check if the platform has media before logging a message... Thanks, Stuart > -- > > commit 9563da05b68af4398b300645f203417f22f81ae8 > Author: Stuart Summers <stuart.summers@intel.com> > > drm/xe: Add enable_media module parameter > > This commit adds a tri-state enable_media module parameter to control > whether the media GT is enabled, latches the combined module > parameter > and configfs decision into xe->info.media_allowed during early probe, > and exposes it via xe_device_media_allowed(). > > > diff --git a/drivers/gpu/drm/xe/xe_device.c > > b/drivers/gpu/drm/xe/xe_device.c > > index 86de5f183c0a0..de1b29071bb80 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 media may be used, false otherwise. > > + */ > > +bool xe_device_media_allowed(struct xe_device *xe) > > +{ > > + return xe->info.media_allowed; > > +} > > [Severity: Low] > Should @xe_device.info.media_allowed use & instead of @ so kernel-doc > generates a struct member cross-reference? Also, since > xe_device_media_allowed() only reads xe->info.media_allowed, should > its > parameter be const struct xe_device *xe (here and in xe_device.h) to > match xe_device_is_admin_only() right above it? > > [ ... ] > > > diff --git a/drivers/gpu/drm/xe/xe_module.c > > b/drivers/gpu/drm/xe/xe_module.c > > index 897724cb5cfb8..d6f3dd54613e4 100644 > > --- a/drivers/gpu/drm/xe/xe_module.c > > +++ b/drivers/gpu/drm/xe/xe_module.c > > @@ -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); > > [Severity: Low] > Should enable_media be writable (0600) or is the commit message > inaccurate? > > The commit message states that both inputs are writable while the > driver > runs, which is why the decision is latched into xe- > >info.media_allowed. > However, 0444 makes /sys/module/xe/parameters/enable_media read-only, > and > gt_types_allowed_store() in xe_configfs.c already rejects writes with > -EBUSY once the device is bound. > > If enable_media is meant to be runtime-writable, media_wanted() in > xe_pci.c also reads xe_modparam.enable_media twice without > READ_ONCE() > into a local variable, which would create a data race against > concurrent > sysfs writes. > > > +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) > > "])"); > > [Severity: Low] > There is a stray unmatched closing parenthesis after [default=-1] at > the > end of this description string. > > [ ... ] > > > diff --git a/drivers/gpu/drm/xe/xe_pci.c > > b/drivers/gpu/drm/xe/xe_pci.c > > index 3f61d3eec2e2c..7afd20d1d2983 100644 > > --- a/drivers/gpu/drm/xe/xe_pci.c > > +++ b/drivers/gpu/drm/xe/xe_pci.c > > @@ -962,8 +977,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; > > } > > [Severity: Low] > Should the MEDIA_VER(xe) < 13 || !media_desc check right below this > run > before logging "Media GT disabled"? > > When xe.enable_media=0 is set on a pre-Media-13 device such as DG2, > alloc_primary_gt() still adds media_desc->hw_engine_mask to > primary_gt > without checking xe_device_media_allowed(), and alloc_media_gt() then > logs "Media GT disabled" anyway; on media-less devices it logs that > message even though no media GT exists. The comments on > info.media_allowed and xe_device_media_allowed() also describe the > flag > as governing media IP rather than standalone media GTs. > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] drm/xe: Add enable_media module parameter 2026-12-03 19:09 ` [PATCH 1/2] drm/xe: Add enable_media module parameter Stuart Summers 2026-12-03 19:34 ` sashiko-bot @ 2026-12-03 20:52 ` Matt Roper 2026-12-03 21:24 ` Rodrigo Vivi 2026-12-03 21:33 ` Rodrigo Vivi 2 siblings, 1 reply; 15+ messages in thread From: Matt Roper @ 2026-12-03 20:52 UTC (permalink / raw) To: Stuart Summers Cc: intel-xe, thomas.hellstrom, rodrigo.vivi, alan.previn.teres.alexis, fei.yang, anoop.c.vijay, riana.tauro On Thu, Dec 03, 2026 at 07:09:26PM +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. > The modparam takes precedence over configfs so a single knob is enough > to guarantee the media GT is left alone. It's been mentioned before, but new module parameters like this simply aren't allowed anymore. Upstream maintainers like Greg KH have been posting increasingly frustrated messages for years that drivers need to stop doing stuff like this. We have various module parameters in Xe today that mostly just snuck in because the Xe driver was a massive code drop and nobody really paid much attention at the time they were going in with everything else, but I don't think we can continue ignoring the "don't add new module parameters" guidance that we've been hearing for many years now. Honestly I don't see a good reason for the module parameter here anyway. Disabling media really should be a per-device decision, not a driver-global one. "Some customers are too lazy to configure the setting on each PCI device individually in a multi-GPU system" seems like a pretty weak justification too. If we really want to eliminate the need for a simple bash loop or something, we could always add a "global" folder in configfs with settings that apply to all devices probed thereafter so give the same kind of "set only once" behavior. Matt > > 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 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..1d9a2655a57b 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 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 6b1e48369bdd..9f890e692784 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(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..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 9a88520aae3c..e1c31c96327d 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,8 +980,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 > -- Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] drm/xe: Add enable_media module parameter 2026-12-03 20:52 ` Matt Roper @ 2026-12-03 21:24 ` Rodrigo Vivi 2026-12-03 21:27 ` Summers, Stuart 2026-12-03 21:50 ` Matt Roper 0 siblings, 2 replies; 15+ messages in thread From: Rodrigo Vivi @ 2026-12-03 21:24 UTC (permalink / raw) To: Matt Roper Cc: Stuart Summers, intel-xe, thomas.hellstrom, alan.previn.teres.alexis, fei.yang, anoop.c.vijay, riana.tauro On Thu, Dec 03, 2026 at 12:52:21PM -0800, Matt Roper wrote: > On Thu, Dec 03, 2026 at 07:09:26PM +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. > > The modparam takes precedence over configfs so a single knob is enough > > to guarantee the media GT is left alone. > > It's been mentioned before, but new module parameters like this simply > aren't allowed anymore. Upstream maintainers like Greg KH have been > posting increasingly frustrated messages for years that drivers need to > stop doing stuff like this. The only written rule I could find is in Documentation/process/debugging/driver_development_debugging_guide.rst: "Module parameters are not recommended anymore", pointing to Greg's mail [1]. So not recommended, but not forbidden. And Greg's reason there is that they "will not work properly for multiple devices", since one value applies to all of them. Here that's exactly what we want: on a node with many GPUs, all of them should follow the same media rule. So in this case it is a plus, not a reason to block. [1] https://lore.kernel.org/all/2024032757-surcharge-grime-d3dd@gregkh/ > We have various module parameters in Xe > today that mostly just snuck in because the Xe driver was a massive code > drop and nobody really paid much attention at the time they were going > in with everything else, but I don't think we can continue ignoring the > "don't add new module parameters" guidance that we've been hearing for > many years now. > > Honestly I don't see a good reason for the module parameter here anyway. > Disabling media really should be a per-device decision, not a > driver-global one. "Some customers are too lazy to configure the > setting on each PCI device individually in a multi-GPU system" seems > like a pretty weak justification too. If we really want to eliminate > the need for a simple bash loop or something, we could always add a > "global" folder in configfs with settings that apply to all devices > probed thereafter so give the same kind of "set only once" behavior. It's not only laziness. Configfs only exists after xe is loaded, and by then the devices are already probed, unless we block autoprobe and bind each device by hand. A global configfs folder has the same problem. A modprobe.d line is the simple way to have it set before the first probe on every node. Well, in general, I agree that we should really try our best to avoid new params in general. Not only because of the overall recommendation, but also because of the exponential validation. But this is a true case where we absolutely need a knob and the module param is the best alternative of all. Thanks, Rodrigo. > > > Matt > > > > > 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 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..1d9a2655a57b 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 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 6b1e48369bdd..9f890e692784 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(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..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 9a88520aae3c..e1c31c96327d 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,8 +980,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 > > > > -- > Matt Roper > Graphics Software Engineer > Linux GPU Platform Enablement > Intel Corporation ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] drm/xe: Add enable_media module parameter 2026-12-03 21:24 ` Rodrigo Vivi @ 2026-12-03 21:27 ` Summers, Stuart 2026-12-03 21:50 ` Matt Roper 1 sibling, 0 replies; 15+ messages in thread From: Summers, Stuart @ 2026-12-03 21:27 UTC (permalink / raw) To: Vivi, Rodrigo, Roper, Matthew D Cc: intel-xe@lists.freedesktop.org, Tauro, Riana, Teres Alexis, Alan Previn, Yang, Fei, thomas.hellstrom@linux.intel.com, Vijay, Anoop C On Thu, 2026-12-03 at 16:24 -0500, Rodrigo Vivi wrote: > On Thu, Dec 03, 2026 at 12:52:21PM -0800, Matt Roper wrote: > > On Thu, Dec 03, 2026 at 07:09:26PM +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. > > > The modparam takes precedence over configfs so a single knob is > > > enough > > > to guarantee the media GT is left alone. > > > > It's been mentioned before, but new module parameters like this > > simply > > aren't allowed anymore. Upstream maintainers like Greg KH have > > been > > posting increasingly frustrated messages for years that drivers > > need to > > stop doing stuff like this. > > The only written rule I could find is in > Documentation/process/debugging/driver_development_debugging_guide.rs > t: > "Module parameters are not recommended anymore", pointing to Greg's > mail [1]. So not recommended, but not forbidden. > > And Greg's reason there is that they "will not work properly for > multiple devices", since one value applies to all of them. Here > that's > exactly what we want: on a node with many GPUs, all of them should > follow the same media rule. So in this case it is a plus, not a > reason > to block. > > [1] > https://lore.kernel.org/all/2024032757-surcharge-grime-d3dd@gregkh/ > > > We have various module parameters in Xe > > today that mostly just snuck in because the Xe driver was a massive > > code > > drop and nobody really paid much attention at the time they were > > going > > in with everything else, but I don't think we can continue ignoring > > the > > "don't add new module parameters" guidance that we've been hearing > > for > > many years now. > > > > Honestly I don't see a good reason for the module parameter here > > anyway. > > Disabling media really should be a per-device decision, not a > > driver-global one. "Some customers are too lazy to configure the > > setting on each PCI device individually in a multi-GPU system" > > seems > > like a pretty weak justification too. If we really want to > > eliminate > > the need for a simple bash loop or something, we could always add a > > "global" folder in configfs with settings that apply to all devices > > probed thereafter so give the same kind of "set only once" > > behavior. > > It's not only laziness. Configfs only exists after xe is loaded, and Also the plan here is to make the media gt configfs a debug-only configuration, meaning if the customers aren't loading with the proper debug kconfig, it won't show up and they'll have no way to configure it. The module parameter here is meant to be a way a customer with a large set of GPUs on a single CPU host platform can configure every system there the same way since this is really intended to be a monolithic configuration anyway. Thanks, Stuart > by > then the devices are already probed, unless we block autoprobe and > bind > each device by hand. A global configfs folder has the same problem. A > modprobe.d line is the simple way to have it set before the first > probe > on every node. > > Well, in general, I agree that we should really try our best to avoid > new params in general. Not only because of the overall > recommendation, > but also because of the exponential validation. > > But this is a true case where we absolutely need a knob and the > module param is the best alternative of all. > > Thanks, > Rodrigo. > > > > > > > Matt > > > > > > > > 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 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_D > > > ISPLAY) > > > #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..1d9a2655a57b 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 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 6b1e48369bdd..9f890e692784 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(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..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 9a88520aae3c..e1c31c96327d 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,8 +980,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 > > > > > > > -- > > Matt Roper > > Graphics Software Engineer > > Linux GPU Platform Enablement > > Intel Corporation ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] drm/xe: Add enable_media module parameter 2026-12-03 21:24 ` Rodrigo Vivi 2026-12-03 21:27 ` Summers, Stuart @ 2026-12-03 21:50 ` Matt Roper 1 sibling, 0 replies; 15+ messages in thread From: Matt Roper @ 2026-12-03 21:50 UTC (permalink / raw) To: Rodrigo Vivi Cc: Stuart Summers, intel-xe, thomas.hellstrom, alan.previn.teres.alexis, fei.yang, anoop.c.vijay, riana.tauro On Thu, Dec 03, 2026 at 04:24:33PM -0500, Rodrigo Vivi wrote: > On Thu, Dec 03, 2026 at 12:52:21PM -0800, Matt Roper wrote: > > On Thu, Dec 03, 2026 at 07:09:26PM +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. > > > The modparam takes precedence over configfs so a single knob is enough > > > to guarantee the media GT is left alone. > > > > It's been mentioned before, but new module parameters like this simply > > aren't allowed anymore. Upstream maintainers like Greg KH have been > > posting increasingly frustrated messages for years that drivers need to > > stop doing stuff like this. > > The only written rule I could find is in > Documentation/process/debugging/driver_development_debugging_guide.rst: > "Module parameters are not recommended anymore", pointing to Greg's > mail [1]. So not recommended, but not forbidden. I've seen a number of mailing list messages from him over the years saying no to things like this. And I feel like the tone of his messages are getting more and more frustrated as time goes on and people keep doing this anyway. Personally I don't think we should disregard that, but if our Xe maintainers feel comfortable defending this move to Greg or other general maintainers who may object, that's your call to make. > > And Greg's reason there is that they "will not work properly for > multiple devices", since one value applies to all of them. Here that's > exactly what we want: on a node with many GPUs, all of them should > follow the same media rule. So in this case it is a plus, not a reason I disagree; that's not what we want in general. It might be true for some specific subset of datacenter users with multi-CRI systems who want them all configured the same way due to a platform-specific hardware workaround, but this module parameter isn't a CRI module parameter, but rather a general knob that changes driver behavior for all current and future devices of any type. And we're advertising it as an "official" (non-debug) knob intended for end users, so it's very likely that people will wind up trying to use this on heterogenous environments like PTL.igpu + BMG.dgpu too. There's no reason why disabling media on one GPU should be expected to automatically disable it on the other GPU in an environment like that too. We're really doing this because it's easy to deal with a specific hardware workaround, not because it's globally correct in other contexts. > to block. > > [1] https://lore.kernel.org/all/2024032757-surcharge-grime-d3dd@gregkh/ > > > We have various module parameters in Xe > > today that mostly just snuck in because the Xe driver was a massive code > > drop and nobody really paid much attention at the time they were going > > in with everything else, but I don't think we can continue ignoring the > > "don't add new module parameters" guidance that we've been hearing for > > many years now. > > > > Honestly I don't see a good reason for the module parameter here anyway. > > Disabling media really should be a per-device decision, not a > > driver-global one. "Some customers are too lazy to configure the > > setting on each PCI device individually in a multi-GPU system" seems > > like a pretty weak justification too. If we really want to eliminate > > the need for a simple bash loop or something, we could always add a > > "global" folder in configfs with settings that apply to all devices > > probed thereafter so give the same kind of "set only once" behavior. > > It's not only laziness. Configfs only exists after xe is loaded, and by > then the devices are already probed, unless we block autoprobe and bind > each device by hand. A global configfs folder has the same problem. A > modprobe.d line is the simple way to have it set before the first probe > on every node. Yeah, but again that's the intended way to do configuration that impacts devices at probe time. We already have all the functionality we need without the module parameter so this winds up just being a shortcut to get the same result in a specific kind of setting. And if we start allowing this one, people will start expecting us to duplicate a bunch of our other configfs knobs with module parameters in the future. Matt > > Well, in general, I agree that we should really try our best to avoid > new params in general. Not only because of the overall recommendation, > but also because of the exponential validation. > > But this is a true case where we absolutely need a knob and the > module param is the best alternative of all. > > Thanks, > Rodrigo. > > > > > > > Matt > > > > > > > > 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 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..1d9a2655a57b 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 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 6b1e48369bdd..9f890e692784 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(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..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 9a88520aae3c..e1c31c96327d 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,8 +980,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 > > > > > > > -- > > Matt Roper > > Graphics Software Engineer > > Linux GPU Platform Enablement > > Intel Corporation -- Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] drm/xe: Add enable_media module parameter 2026-12-03 19:09 ` [PATCH 1/2] drm/xe: Add enable_media module parameter Stuart Summers 2026-12-03 19:34 ` sashiko-bot 2026-12-03 20:52 ` Matt Roper @ 2026-12-03 21:33 ` Rodrigo Vivi 2026-12-03 21:39 ` Summers, Stuart 2 siblings, 1 reply; 15+ messages in thread From: Rodrigo Vivi @ 2026-12-03 21:33 UTC (permalink / raw) To: Stuart Summers Cc: intel-xe, thomas.hellstrom, alan.previn.teres.alexis, fei.yang, anoop.c.vijay, riana.tauro, matthew.d.roper On Thu, Dec 03, 2026 at 07:09:26PM +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. > 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 The modparam is 0444, so only configfs is writable here. > 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 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..1d9a2655a57b 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 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 6b1e48369bdd..9f890e692784 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(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..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) "])"); Extra ')' here. > + > #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..e1c31c96327d 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,8 +980,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 [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] drm/xe: Add enable_media module parameter 2026-12-03 21:33 ` Rodrigo Vivi @ 2026-12-03 21:39 ` Summers, Stuart 0 siblings, 0 replies; 15+ messages in thread From: Summers, Stuart @ 2026-12-03 21:39 UTC (permalink / raw) To: Vivi, Rodrigo Cc: intel-xe@lists.freedesktop.org, Tauro, Riana, Teres Alexis, Alan Previn, Yang, Fei, Roper, Matthew D, thomas.hellstrom@linux.intel.com, Vijay, Anoop C On Thu, 2026-12-03 at 16:33 -0500, Rodrigo Vivi wrote: > On Thu, Dec 03, 2026 at 07:09:26PM +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. > > 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 > > The modparam is 0444, so only configfs is writable here. Yeah this was my mistake I'll clean it. > > > 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 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_DIS > > PLAY) > > #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..1d9a2655a57b 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 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 6b1e48369bdd..9f890e692784 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(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..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) > > "])"); > > Extra ')' here. Will fix thanks! -Stuart > > > + > > #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..e1c31c96327d 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,8 +980,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 [flat|nested] 15+ messages in thread
end of thread, other threads:[~2026-12-04 0:03 UTC | newest] Thread overview: 15+ 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 -- 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:09 ` [PATCH 1/2] drm/xe: Add enable_media module parameter Stuart Summers 2026-12-03 19:34 ` sashiko-bot 2026-12-03 20:01 ` Summers, Stuart 2026-12-03 20:52 ` Matt Roper 2026-12-03 21:24 ` Rodrigo Vivi 2026-12-03 21:27 ` Summers, Stuart 2026-12-03 21:50 ` Matt Roper 2026-12-03 21:33 ` Rodrigo Vivi 2026-12-03 21:39 ` Summers, Stuart
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox