From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Stuart Summers <stuart.summers@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
<thomas.hellstrom@linux.intel.com>,
<alan.previn.teres.alexis@intel.com>, <fei.yang@intel.com>,
<anoop.c.vijay@intel.com>, <riana.tauro@intel.com>,
<matthew.d.roper@intel.com>
Subject: Re: [PATCH 2/2] drm/xe: Work around media 52-bit limitation on CRI
Date: Thu, 3 Dec 2026 16:37:35 -0500 [thread overview]
Message-ID: <axHhH1hMoVc-1kqJ@intel.com> (raw)
In-Reply-To: <20261203190926.249488-6-stuart.summers@intel.com>
On Thu, Dec 03, 2026 at 07:09:27PM +0000, Stuart Summers wrote:
> CRI media only supports 46-bit GPA. With the IOMMU handing out IOVAs
> above 46 bits this shows up as ATS translation errors and a media
> GuC load failure.
>
> The workaround for this is broken into a couple of parts:
> 1) Media is now disabled by default on CRI.
> 2) When media is enabled, implement certain workarounds to
> ensure compute performance remains optimal and media accesses
> do not result in the above mentioned translation errors.
>
> The first part of the workaround means for the customers who are
> not interested in using media, they can retain the full 52-bit GPA
> range for a broader PCIe installation without worrying about any
> specific limitation to support the media workloads on this device.
>
> Additionally, to ensure power is not consumed by media in this
> configuration, a new interfaces is added between the KMD and the GFSP
> firmware to bring media down into a low power state.
>
> The second part of the workaround again is broken down into a few
> parts:
> 1) The whole device is restricted to 46-bit GPA.
> 2) Disable address translation in the media block alone to allow
> faster translation for compute workloads with PCIe level address
> translation enabled while ensuring host accesses beyond 46-bits
> (e.g. coming from another 52-bit supporting device) are still
> limited to 46-bits for the CRI media.
>
> Media needs every device DMA address to stay within 46 bits. With the
> IOMMU translating device DMA that is guaranteed by the IOVA allocator
> honoring the clamped mask. Without it, DMA addresses are host physical
> addresses, so media stays enabled only when host memory fits in 46 bits.
> Beyond that the host can hand out an address media cannot reach, so
> disable media.
>
> In order to disable address translation for media, a certain register
> programming which is not accessible from the host must be engaged. To
> facilitate this, an additional new interface is added between the KMD
> and the GFSP firmware to do this programming.
>
> HSDES: 14028632488
>
> Signed-off-by: Stuart Summers <stuart.summers@intel.com>
> ---
> drivers/gpu/drm/xe/xe_device.c | 10 ++
> drivers/gpu/drm/xe/xe_device_wa_oob.rules | 1 +
> drivers/gpu/drm/xe/xe_pci.c | 54 +++++-
> drivers/gpu/drm/xe/xe_pm.c | 4 +
> drivers/gpu/drm/xe/xe_sysctrl.c | 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 +
> 8 files changed, 275 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index 1d9a2655a57b..a9a59d169e73 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_defeature(xe);
> + if (err)
> + return err;
> +
> xe_irq_resume(xe);
>
> for_each_gt(gt, xe, id) {
> diff --git a/drivers/gpu/drm/xe/xe_device_wa_oob.rules b/drivers/gpu/drm/xe/xe_device_wa_oob.rules
> index 300207596893..14308f90938e 100644
> --- a/drivers/gpu/drm/xe/xe_device_wa_oob.rules
> +++ b/drivers/gpu/drm/xe/xe_device_wa_oob.rules
> @@ -8,3 +8,4 @@
> 14026779378 PLATFORM(CRESCENTISLAND)
> 14028586678 PLATFORM(CRESCENTISLAND)
> 14028434957 PLATFORM(CRESCENTISLAND)
> +14028632488 PLATFORM(CRESCENTISLAND)
> diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
> index e1c31c96327d..090153996783 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,44 @@ static int xe_probe_info_early(struct xe_device *xe,
> return 0;
> }
>
> +/*
> + * Number of address bits media is able to reach on CRI, where it has no
> + * address translation of its own.
> + */
> +#define XE_CRI_MEDIA_ADDR_BITS 46
> +
> +static bool device_iommu_iova_backed(struct device *dev)
> +{
> + struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
> +
> + return domain && domain->type != IOMMU_DOMAIN_IDENTITY;
> +}
> +
> +/*
> + * Decide whether media can be used on CRI. Media there cannot translate
> + * addresses, so it is only usable if device DMA is guaranteed to stay within
> + * XE_CRI_MEDIA_ADDR_BITS. The IOMMU guarantees that by allocating IOVAs
> + * below the device dma mask. Without it, DMA addresses are host physical
> + * addresses, so media is only usable when the host cannot produce an address
> + * wider than media can reach.
> + */
> +static bool cri_media_addressable(struct xe_device *xe)
> +{
> + u64 host_max_addr = DIRECT_MAP_PHYSMEM_END;
> +
> + if (device_iommu_iova_backed(xe->drm.dev))
> + return true;
> +
> + if (host_max_addr <= DMA_BIT_MASK(XE_CRI_MEDIA_ADDR_BITS))
> + return true;
> +
> + drm_info(&xe->drm,
> + "IOMMU is not translating device DMA and the host can produce %u bit physical addresses, media is limited to %u\n",
> + fls64(host_max_addr), XE_CRI_MEDIA_ADDR_BITS);
> +
> + return false;
> +}
> +
> /*
> * Whether the user wants media at all. The default (-1) leaves the decision
> * to the driver.
> @@ -798,7 +839,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 +871,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..04976dfd7ce2 100644
> --- a/drivers/gpu/drm/xe/xe_pm.c
> +++ b/drivers/gpu/drm/xe/xe_pm.c
> @@ -668,6 +668,10 @@ int xe_pm_runtime_resume(struct xe_device *xe)
> if (xe->d3cold.allowed)
> xe_sysctrl_pm_resume(xe);
>
> + err = xe_sysctrl_media_defeature(xe);
> + if (err)
> + goto out;
do we really need this on every rpm resume? even on D3hot when
we are sure we didn't lose power?
Shouldn't we move this to d3cold allowed block?
> +
> 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..2095355ae674 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl.c
> +++ b/drivers/gpu/drm/xe/xe_sysctrl.c
> @@ -5,12 +5,16 @@
>
> #include <linux/device.h>
> #include <linux/mutex.h>
> +#include <linux/pci.h>
>
> #include <drm/drm_managed.h>
>
> +#include <generated/xe_device_wa_oob.h>
> +
> #include "regs/xe_irq_regs.h"
> #include "regs/xe_sysctrl_regs.h"
> #include "xe_device.h"
> +#include "xe_force_wake.h"
> #include "xe_mmio.h"
> #include "xe_pm.h"
> #include "xe_printk.h"
> @@ -19,6 +23,7 @@
> #include "xe_sysctrl_mailbox.h"
> #include "xe_sysctrl_mailbox_types.h"
> #include "xe_sysctrl_types.h"
> +#include "xe_wa.h"
>
> /**
> * DOC: System Controller (sysctrl)
> @@ -103,6 +108,7 @@ int xe_sysctrl_init(struct xe_device *xe)
>
> xe->soc_remapper.set_sysctrl_region(xe, SYSCTRL_MAILBOX_INDEX);
> INIT_WORK(&sc->work, xe_sysctrl_work);
> + sc->has_media_feature_disable = true;
>
> return devm_add_action_or_reset(xe->drm.dev, sysctrl_fini, xe);
> }
> @@ -249,3 +255,163 @@ int xe_sysctrl_sdk_api_version(struct xe_device *xe, u16 *version)
>
> return 0;
> }
> +
> +static int sysctrl_media_defeature(struct xe_device *xe, u8 feature)
> +{
> + struct xe_sysctrl_media_defeature_req req = { .feature = feature };
> + struct xe_sysctrl_media_defeature_resp resp = {};
> + struct xe_sysctrl_mailbox_command cmd = {};
> + size_t out_len = 0;
> + int ret;
> +
> + xe_sysctrl_create_command(&cmd, XE_SYSCTRL_GROUP_RUNTIME,
> + XE_SYSCTRL_CMD_MEDIA_DEFEATURE,
> + &req, sizeof(req), &resp, sizeof(resp));
> +
> + ret = xe_sysctrl_send_command(&xe->sc, &cmd, &out_len);
> + if (ret)
> + return ret;
> +
> + if (out_len != sizeof(resp)) {
> + xe_err(xe, "sysctrl: unexpected media defeature response length %zu (expected %zu)\n",
> + out_len, sizeof(resp));
> + return -EPROTO;
> + }
> +
> + return 0;
> +}
> +
> +/* Check whether the ATS Enable bit is set in the PCI ATS Control register */
> +static bool sysctrl_ats_enabled(struct xe_device *xe)
> +{
> + struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
> + int ats_cap;
> + u16 ctrl;
> +
> + ats_cap = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ATS);
> + if (!ats_cap)
> + return false;
> +
> + if (pci_read_config_word(pdev, ats_cap + PCI_ATS_CTRL, &ctrl))
> + return false;
> +
> + return ctrl & PCI_ATS_CTRL_ENABLE;
> +}
> +
> +/* Send the media defeature command and report the outcome */
> +static int sysctrl_media_defeature_send(struct xe_device *xe, u8 feature)
> +{
> + bool media_allowed = feature == XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE;
> + int ret;
> +
> + ret = sysctrl_media_defeature(xe, feature);
> + if (ret) {
> + xe_err(xe, "sysctrl: failed to defeature media (0x%02x): %pe\n",
> + feature, ERR_PTR(ret));
> + return ret;
> + }
> +
> + xe_info(xe, "sysctrl: media %s, %s defeatured\n",
> + media_allowed ? "enabled" : "disabled",
> + media_allowed ? "address translation" : "media");
> +
> + return 0;
> +}
> +
> +/* Whether this platform needs the media defeature workaround at all */
> +static bool sysctrl_media_defeature_needed(struct xe_device *xe)
> +{
> + return XE_DEVICE_WA(xe, 14028632488) &&
> + xe->info.has_soc_remapper_sysctrl &&
> + xe->info.has_sysctrl &&
> + xe->sc.has_media_feature_disable;
> +}
> +
> +/**
> + * xe_sysctrl_media_defeature() - Tell System Controller how media is configured
> + * @xe: xe device instance
> + *
> + * The driver and the System Controller must agree on the media configuration
> + * before media is used. When media is enabled, address translation for media
> + * is not supported and must be defeatured. When media has been disabled by the
> + * user, via either the enable_media modparam or the gt_types_allowed configfs
> + * attribute, media itself is defeatured.
> + *
> + * This is restricted to platforms that need this workaround.
> + *
> + * Once a request has failed, the System Controller is assumed not to support
> + * it and it is not sent again; this returns 0 from then on.
> + *
> + * Return: 0 on success, error code on failure
> + */
> +int xe_sysctrl_media_defeature(struct xe_device *xe)
> +{
> + bool media_allowed = xe_device_media_allowed(xe);
> + u8 feature;
> + int ret = 0;
> +
> + if (!sysctrl_media_defeature_needed(xe))
> + return 0;
> +
> + feature = media_allowed ? XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE :
> + XE_SYSCTRL_MEDIA_DEFEATURE_DISABLE;
> +
> + /*
> + * If media is not present or if it is allowed but ATS is disabled,
> + * nothing to do.
> + */
> + if (xe_device_get_root_tile(xe)->media_gt)
> + if (!media_allowed || (media_allowed && sysctrl_ats_enabled(xe)))
> + ret = sysctrl_media_defeature_send(xe, feature);
When media is forced off, alloc_media_gt() returns NULL, so media_gt is
NULL here and the DISABLE is never sent.
Perhaps:
if (!media_allowed || (media_gt && sysctrl_ats_enabled(xe)))
> +
> + if (ret)
> + xe->sc.has_media_feature_disable = false;
> +
> + return ret;
> +}
> +
> +/*
> + * Drop media from the device. Only safe during probe, before the media GT is
> + * brought up. The dma_mask_size cap derived from the early media decision is
> + * left in place, which is harmless since it is only more restrictive than
> + * needed.
> + */
> +static void sysctrl_media_drop(struct xe_device *xe)
> +{
> + struct xe_tile *tile;
> + u8 id;
> +
> + xe->info.media_allowed = false;
> +
> + for_each_tile(tile, xe, id)
> + tile->media_gt = NULL;
> +}
> +
> +/**
> + * xe_sysctrl_media_probe() - Configure media with the System Controller at probe
> + * @xe: xe device instance
> + *
> + * Same as xe_sysctrl_media_defeature(), but media cannot be used while the
> + * System Controller does not know how it is configured, so on failure media is
> + * dropped and probe continues without it rather than failing driver load.
> + *
> + * Must be called from the same place xe_sysctrl_media_defeature() would be
> + * called during probe.
> + */
> +void xe_sysctrl_media_probe(struct xe_device *xe)
> +{
> + if (!xe_sysctrl_media_defeature(xe))
> + return;
> +
> + /*
> + * Media is going away, so ask the System Controller to defeature it
> + * too. Nothing more can be done if even that fails, but the driver
> + * does not touch media from here on either way.
> + */
> + if (xe_device_media_allowed(xe))
> + sysctrl_media_defeature_send(xe, XE_SYSCTRL_MEDIA_DEFEATURE_DISABLE);
> +
> + sysctrl_media_drop(xe);
> +
> + xe_info(xe, "sysctrl: media configuration failed, continuing without media\n");
> +}
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl.h b/drivers/gpu/drm/xe/xe_sysctrl.h
> index c0b6d4330c88..e1d4181942e0 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl.h
> +++ b/drivers/gpu/drm/xe/xe_sysctrl.h
> @@ -18,6 +18,8 @@ static inline struct xe_device *sc_to_xe(struct xe_sysctrl *sc)
>
> void xe_sysctrl_event(struct xe_sysctrl *sc);
> int xe_sysctrl_init(struct xe_device *xe);
> +int xe_sysctrl_media_defeature(struct xe_device *xe);
> +void xe_sysctrl_media_probe(struct xe_device *xe);
> void xe_sysctrl_irq_handler(struct xe_device *xe, u32 master_ctl);
> void xe_sysctrl_pm_resume(struct xe_device *xe);
> bool xe_sysctrl_is_oobmsm_fw_ready(struct xe_device *xe);
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h b/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h
> index 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..0cf265df1aa7 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl_types.h
> +++ b/drivers/gpu/drm/xe/xe_sysctrl_types.h
> @@ -75,6 +75,12 @@ struct xe_sysctrl {
> /** @event_lock: Mutex protecting pending events */
> struct mutex event_lock;
>
> + /**
> + * @has_media_feature_disable: The System Controller accepts media
> + * defeature requests.
> + */
> + bool has_media_feature_disable;
> +
> /** @debugfs: Debugfs entries */
> struct {
> /** @debugfs.root: Root debugfs directory */
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-12-03 21:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
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
2026-12-03 19:09 ` [PATCH 2/2] drm/xe: Work around media 52-bit limitation on CRI Stuart Summers
2026-12-03 19:31 ` sashiko-bot
2026-12-03 19:57 ` Summers, Stuart
2026-12-03 21:37 ` Rodrigo Vivi [this message]
2026-12-03 21:41 ` Summers, Stuart
2026-12-03 19:14 ` [PATCH 0/2] Work around 52-bit limitation in CRI media Summers, Stuart
2026-12-03 19:18 ` ✓ CI.KUnit: success for " Patchwork
2026-12-03 19:58 ` ✓ Xe.CI.BAT: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2026-12-03 23:28 [PATCH 0/2] " Stuart Summers
2026-12-03 23:29 ` [PATCH 2/2] drm/xe: Work around media 52-bit limitation on CRI Stuart Summers
2026-12-04 0:03 ` sashiko-bot
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=axHhH1hMoVc-1kqJ@intel.com \
--to=rodrigo.vivi@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=stuart.summers@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox