From: sashiko-bot@kernel.org
To: "Stuart Summers" <stuart.summers@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 16/16] drm/xe: Work around media 52-bit limitation on CRI
Date: Fri, 20 Nov 2026 06:11:25 +0000 [thread overview]
Message-ID: <sashiko-outbox-224540@kernel.org> (raw)
In-Reply-To: <20261120054712.377573-34-stuart.summers@intel.com>
Thank you for your contribution! Sashiko AI review found 5 potential
issues to consider:
- [High] drm/xe: unexported DIRECT_MAP_PHYSMEM_END in
cri_media_addressable()
- [Medium] drm/xe: stale gt_count and zero-GT crash in
sysctrl_media_drop()
- [Medium] drm/xe: ATS defeature sent without forcewake in
xe_sysctrl_media_defeature()
- [Medium] drm/xe: clearing has_media_feature_disable skips defeature on
later resumes
- [Low] drm/xe: unconditional xe_info() log in
sysctrl_media_defeature_send() on resume
--
commit bfba7658ba4dafcad71b1d3fc6d2e7a7e1c0e5dd
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
limit. When media is enabled, it clamps the device DMA mask to 46 bits and
adds a System Controller mailbox command to defeature either media or media
address translation on probe and resume.
> diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
> index db443828f1d56..af7cf08fcfb86 100644
> --- a/drivers/gpu/drm/xe/xe_pci.c
> +++ b/drivers/gpu/drm/xe/xe_pci.c
[ ... ]
> @@ -815,6 +818,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 using DIRECT_MAP_PHYSMEM_END here break modular builds when
CONFIG_RANDOMIZE_MEMORY is enabled on x86_64?
arch/x86/include/asm/pgtable_64_types.h defines DIRECT_MAP_PHYSMEM_END as
direct_map_physmem_end, which is defined in arch/x86/mm/kaslr.c without
EXPORT_SYMBOL, causing modpost to fail with an undefined symbol when
CONFIG_DRM_XE=m.
Also, DIRECT_MAP_PHYSMEM_END is the end of the virtual direct-map region
rather than the highest installed physical RAM address. In
kernel_randomize_memory() in arch/x86/mm/kaslr.c, direct_map_physmem_end
stays at (1ULL << MAX_PHYSMEM_BITS) - 1 whenever CONFIG_ZONE_DEVICE is
enabled (which CONFIG_DRM_XE_GPUSVM selects), so cri_media_addressable()
will reject media on 5-level paging hosts without IOMMU translation
regardless of how much RAM is installed.
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl.c b/drivers/gpu/drm/xe/xe_sysctrl.c
> index 405d339d6a7dd..a7f8c8edd0128 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl.c
> +++ b/drivers/gpu/drm/xe/xe_sysctrl.c
[ ... ]
> @@ -251,3 +257,182 @@ int xe_sysctrl_sdk_api_version(struct xe_device *xe, u16 *version)
[ ... ]
> +/* 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]
Since xe_pm_runtime_resume() and xe_device_resume() call
xe_sysctrl_media_defeature(), will this xe_info() print on every runtime
and system resume?
> +
> +/*
> + * The System Controller reaches into media while processing the request, so
> + * hold the media GT forcewake for its duration.
> + */
> +static int sysctrl_media_ats_defeature_send(struct xe_device *xe, struct xe_gt *media_gt)
> +{
> + int ret = 0;
> +
> + xe_with_force_wake(fw_ref, gt_to_fw(media_gt), XE_FW_GT) {
> + if (!xe_force_wake_ref_has_domain(fw_ref.domains, XE_FW_GT))
> + xe_err(xe, "sysctrl: failed to wake media GT, defeaturing media ATS anyway\n");
> +
> + ret = sysctrl_media_defeature_send(xe, XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE);
> + }
> +
> + return ret;
> +}
[ ... ]
> +int xe_sysctrl_media_defeature(struct xe_device *xe)
> +{
> + bool media_allowed = xe_device_media_allowed(xe);
> + struct xe_gt *media_gt;
> + u8 feature;
> + int ret;
> +
> + if (!sysctrl_media_defeature_needed(xe))
> + return 0;
> +
> + feature = media_allowed ? XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE :
> + XE_SYSCTRL_MEDIA_DEFEATURE_DISABLE;
> +
> + media_gt = xe_device_get_root_tile(xe)->media_gt;
> +
> + if (media_gt && feature == XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE &&
> + sysctrl_ats_enabled(xe))
> + ret = sysctrl_media_ats_defeature_send(xe, media_gt);
> + else
> + ret = sysctrl_media_defeature_send(xe, feature);
[Severity: Medium]
When media_allowed is true (so feature is
XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE) but sysctrl_ats_enabled(xe) is
false or media_gt is NULL, does this fall into the else branch and send
XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE without holding media GT forcewake?
> +
> + if (ret)
> + xe->sc.has_media_feature_disable = false;
> +
> + return ret;
> +}
[Severity: Medium]
If XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE fails during
xe_sysctrl_media_probe() and the fallback to
XE_SYSCTRL_MEDIA_DEFEATURE_DISABLE succeeds, does clearing
has_media_feature_disable here prevent xe_pm_runtime_resume() and
xe_device_resume() from re-applying XE_SYSCTRL_MEDIA_DEFEATURE_DISABLE on
later resumes?
Similarly, if XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE succeeded at probe so
media_gt is active, a transient mailbox failure during resume permanently
clears has_media_feature_disable, causing subsequent resumes to return 0
without disabling media ATS.
> +
> +/*
> + * 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;
> +}
[Severity: Medium]
Does clearing tile->media_gt here leave xe->info.gt_count stale and allow a
tile to continue probing with zero GTs?
xe_info_init() already computed xe->info.gt_count before xe_device_probe()
runs. When tile->media_gt is cleared without decrementing
xe->info.gt_count, query_gt_list() sizes and reports gt_list->num_gt from
xe->info.gt_count while populating entries with for_each_gt(), exposing
trailing zero-filled GT entries to userspace. In addition, if
tile->primary_gt was disabled via configfs gt_types_allowed, dropping
tile->media_gt leaves no GTs on the tile and causes a NULL pointer
dereference later in xe_device_probe() (for example in
xe_cpu_bind_init() -> xe_exec_queue_create_bind() when accessing
tile->migrate and xe_tile_pt_gt(tile)).
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261120054712.377573-18-stuart.summers@intel.com?part=16
next prev parent reply other threads:[~2026-11-20 6:11 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 5:47 [PATCH 00/16] Work around media 52-bit limitation on CRI Stuart Summers
2026-11-20 5:47 ` [PATCH 01/16] drm/xe/sysctrl: Use preallocated mailbox staging buffers Stuart Summers
2026-11-20 5:52 ` sashiko-bot
2026-11-20 5:47 ` [PATCH 02/16] drm/xe: Process device OOB workarounds during early info init Stuart Summers
2026-11-20 5:47 ` [PATCH 03/16] drm/xe/sysctrl: Restore the SoC remapper on every runtime resume Stuart Summers
2026-11-20 5:47 ` [PATCH 04/16] drm/xe: Add enable_media module parameter Stuart Summers
2026-11-20 5:47 ` [PATCH 05/16] drm/xe: Detect each GMD_ID IP in a loop Stuart Summers
2026-11-20 5:47 ` [PATCH 06/16] drm/xe: Tolerate a missing graphics IP in xe_info_init() Stuart Summers
2026-11-20 5:47 ` [PATCH 07/16] drm/xe: Verify IP presence against GU_CNTL Stuart Summers
2026-11-20 5:47 ` [PATCH 08/16] drm/xe: Guard per-tile primary GT accesses Stuart Summers
2026-11-20 5:47 ` [PATCH 09/16] drm/xe: Stop assuming the root tile has a primary GT Stuart Summers
2026-11-20 5:47 ` [PATCH 10/16] drm/xe: Do not claim flat CCS without a graphics IP Stuart Summers
2026-11-20 5:47 ` [PATCH 11/16] drm/xe: Run page table updates on the media GT when there is no primary Stuart Summers
2026-11-20 6:10 ` sashiko-bot
2026-11-20 5:47 ` [PATCH 12/16] drm/xe: Document that gt_types_allowed=media now probes Stuart Summers
2026-11-20 5:47 ` [PATCH 13/16] drm/xe: Fall back to CPU copies when the tile cannot blit Stuart Summers
2026-11-20 6:09 ` sashiko-bot
2026-11-20 5:47 ` [PATCH 14/16] drm/xe: Require a fully visible VRAM BAR without a primary GT Stuart Summers
2026-11-20 5:47 ` [PATCH 15/16] drm/xe: Allow probe " Stuart Summers
2026-11-20 6:13 ` sashiko-bot
2026-11-20 5:47 ` [PATCH 16/16] drm/xe: Work around media 52-bit limitation on CRI Stuart Summers
2026-11-20 6:11 ` sashiko-bot [this message]
2026-11-20 7:26 ` ✓ CI.KUnit: success for " Patchwork
2026-11-20 8:04 ` ✓ Xe.CI.BAT: " 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-224540@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 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.