All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Summers, Stuart" <stuart.summers@intel.com>
To: "Summers, Stuart" <stuart.summers@intel.com>
Cc: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"Yang,  Fei" <fei.yang@intel.com>,
	"Vivi, Rodrigo" <rodrigo.vivi@intel.com>,
	"Roper, Matthew D" <matthew.d.roper@intel.com>,
	"Vijay, Anoop C" <anoop.c.vijay@intel.com>,
	"Tauro, Riana" <riana.tauro@intel.com>,
	"thomas.hellstrom@linux.intel.com"
	<thomas.hellstrom@linux.intel.com>,
	"Teres Alexis, Alan Previn" <alan.previn.teres.alexis@intel.com>
Subject: Re: [PATCH 1/2] drm/xe: Add enable_media module parameter
Date: Thu, 3 Dec 2026 23:32:09 +0000	[thread overview]
Message-ID: <c53bb43d9ac06e89aefd047ccd2539cce8fdfd2e.camel@intel.com> (raw)
In-Reply-To: <20261203232859.321380-5-stuart.summers@intel.com>

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))


  reply	other threads:[~2026-12-03 23:32 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2026-12-03 23:58   ` sashiko-bot
2026-12-04 18:03     ` Summers, Stuart
2026-12-03 23:29 ` [PATCH 2/2] drm/xe: Work around media 52-bit limitation on CRI Stuart Summers
2026-12-04  0:03   ` sashiko-bot
2026-12-04 22:06     ` Summers, Stuart
2026-12-04 14:45   ` Rodrigo Vivi
2026-12-04 20:55     ` Summers, Stuart
2026-12-04  0:52 ` ✗ CI.checkpatch: warning for Work around 52-bit limitation in CRI media (rev2) Patchwork
2026-12-04  0:54 ` ✓ CI.KUnit: success " Patchwork
2026-12-04  1:30 ` ✓ Xe.CI.BAT: " Patchwork
2026-12-05  2:50 ` ✗ Xe.CI.FULL: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2026-12-03 19:09 [PATCH 0/2] Work around 52-bit limitation in CRI media Stuart Summers
2026-12-03 19: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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c53bb43d9ac06e89aefd047ccd2539cce8fdfd2e.camel@intel.com \
    --to=stuart.summers@intel.com \
    --cc=alan.previn.teres.alexis@intel.com \
    --cc=anoop.c.vijay@intel.com \
    --cc=fei.yang@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.d.roper@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=thomas.hellstrom@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.