From: sashiko-bot@kernel.org
To: "Stuart Summers" <stuart.summers@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/xe: Work around media 52-bit limitation on CRI
Date: Thu, 03 Dec 2026 19:31:42 +0000 [thread overview]
Message-ID: <sashiko-outbox-248514@kernel.org> (raw)
In-Reply-To: <20261203190926.249488-6-stuart.summers@intel.com>
Thank you for your contribution! Sashiko AI review found 6 potential
issues to consider:
- [High] drm/xe: xe_sysctrl_media_defeature() never sends media disable
command
- [High] drm/xe: DIRECT_MAP_PHYSMEM_END breaks modular builds on
unexported symbols
- [Medium] drm/xe: sysctrl_media_drop() leaves xe->info.gt_count stale
- [Medium] drm/xe: xe_sysctrl_media_defeature() permanently disables WA
on any error
- [Low] drm/xe: unused xe_force_wake.h include added in xe_sysctrl.c
- [Low] drm/xe: unconditional xe_info() in
sysctrl_media_defeature_send()
--
commit 0799470412771e8575e374d3b80f09789379d8d6
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 to work around its 46-bit GPA
limitation and clamps the DMA mask to 46 bits when media is enabled. It also
adds a System Controller mailbox command to defeature media when disabled or
disable media address translation when enabled.
> diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
> index 7afd20d1d2983..7184cd25bfea7 100644
> --- a/drivers/gpu/drm/xe/xe_pci.c
> +++ b/drivers/gpu/drm/xe/xe_pci.c
[ ... ]
> @@ -789,6 +792,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;
[Severity: High]
Does referencing DIRECT_MAP_PHYSMEM_END here break modular builds
(CONFIG_DRM_XE=m)?
On x86_64 with CONFIG_RANDOMIZE_MEMORY=y, DIRECT_MAP_PHYSMEM_END expands
to direct_map_physmem_end in arch/x86/mm/kaslr.c, which is not exported
to modules, failing modpost (and arm64 KASAN and LoongArch similarly
reference unexported symbols).
Additionally, on x86_64 with CONFIG_X86_5LEVEL=y and CONFIG_ZONE_DEVICE=y,
direct_map_physmem_end stays at (1ULL << 52) - 1 regardless of installed
RAM, so cri_media_addressable() disables media whenever the IOMMU is off
or in identity mode.
[ ... ]
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl.c b/drivers/gpu/drm/xe/xe_sysctrl.c
> index d362e8156fca2..2095355ae6745 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"
[Severity: Low]
xe_force_wake.h appears to be unused in xe_sysctrl.c; can this include be
dropped?
[ ... ]
> +/* 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;
> +}
[Severity: Low]
Will this xe_info() spam dmesg on every runtime PM resume?
xe_pm_runtime_resume() calls xe_sysctrl_media_defeature() on every resume,
so with media enabled and ATS active this prints at info level on each
wakeup. Using xe_dbg() here (or logging once at probe in
xe_sysctrl_media_probe()) would avoid flooding the kernel log.
[ ... ]
> +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);
[Severity: High]
Can the !media_allowed branch ever run here?
In xe_pci.c, alloc_media_gt() returns NULL whenever
!xe_device_media_allowed(xe), so root tile->media_gt is always NULL when
media_allowed is false. As a result, XE_SYSCTRL_MEDIA_DEFEATURE_DISABLE
is never sent and the media IP stays powered on.
Checking physical media presence (such as xe->info.media_verx100) instead
of tile->media_gt would allow sending the disable command.
> + if (ret)
> + xe->sc.has_media_feature_disable = false;
> +
> + return ret;
> +}
[Severity: Medium]
Should a failure here permanently clear has_media_feature_disable after
probe?
If a transient mailbox error occurs during xe_device_resume() or
xe_pm_runtime_resume() while media_gt is active, clearing the flag causes
all later resumes to skip XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE and bring
up media with ATS still enabled.
In xe_sysctrl_media_probe(), clearing the flag before the fallback
XE_SYSCTRL_MEDIA_DEFEATURE_DISABLE call also prevents future resumes from
re-sending media disable even if that fallback succeeds.
[ ... ]
> +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;
> +}
[Severity: Medium]
Does sysctrl_media_drop() leave xe->info.gt_count out of sync with the
remaining GTs?
xe_info_init() already counts tile->media_gt into xe->info.gt_count before
xe_sysctrl_media_probe() runs. Clearing tile->media_gt without
decrementing gt_count leaves query_gt_list() exposing a trailing
zero-filled phantom GT entry in DRM_XE_DEVICE_QUERY_GT_LIST.
GuC G2G setup (guc_g2g_start()) also relies on gt_count matching the
active GTs.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203190926.249488-4-stuart.summers@intel.com?part=2
next prev parent reply other threads:[~2026-12-03 19:31 UTC|newest]
Thread overview: 7+ 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 19:09 ` [PATCH 2/2] drm/xe: Work around media 52-bit limitation on CRI Stuart Summers
2026-12-03 19:31 ` sashiko-bot [this message]
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
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=sashiko-outbox-248514@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=stuart.summers@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