From: sashiko-bot@kernel.org
To: "Maarten Lankhorst" <dev@lankhorst.se>, intel-xe@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v5 2/5] drm/xe/migrate: Support copying between sysmem and stolen
Date: Mon, 16 Nov 2026 13:29:06 +0000 [thread overview]
Message-ID: <sashiko-outbox-217075@kernel.org> (raw)
In-Reply-To: <20261116131349.333818-9-dev@lankhorst.se>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/xe/migrate: missing stolen base offset in emit_pte() on
pre-1270 iGPUs
--
commit 73a1bb32ca907a5d90c3e0d2392791649e5d6ca0
Author: Maarten Lankhorst <dev@lankhorst.se>
drm/xe/migrate: Support copying between sysmem and stolen
This commit adds support for XE_PL_STOLEN buffer objects to
__xe_migrate_copy() and xe_migrate_clear(), disabling identity mapping for
stolen memory and treating stolen resources as device memory when GGTT CPU
access is not required.
> diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
> index 19c37eb315893..2e194ac6fb4f0 100644
> --- a/drivers/gpu/drm/xe/xe_migrate.c
> +++ b/drivers/gpu/drm/xe/xe_migrate.c
[ ... ]
> @@ -1206,6 +1211,24 @@ static u32 xe_migrate_ccs_copy(struct xe_migrate *m,
> return flush_flags;
> }
>
> +static bool is_devmem(struct xe_bo *bo, struct ttm_resource *res)
> +{
> + if (mem_type_is_vram(res->mem_type))
> + return true;
> +
> + /*
> + * Stolen is only device memory on newer platforms.
> + *
> + * On older platforms where stolen is mapped to GGTT,
> + * it is mapped as system memory.
> + */
> + if (res->mem_type != XE_PL_STOLEN ||
> + xe_ttm_stolen_cpu_access_needs_ggtt(xe_bo_device(bo)))
> + return false;
> +
> + return true;
> +}
> +
> static struct dma_fence *__xe_migrate_copy(struct xe_migrate *m,
> struct xe_bo *src_bo,
> struct xe_bo *dst_bo,
> @@ -1226,8 +1249,8 @@ static struct dma_fence *__xe_migrate_copy(struct xe_migrate *m,
> int err;
> bool src_is_pltt = src->mem_type == XE_PL_TT;
> bool dst_is_pltt = dst->mem_type == XE_PL_TT;
> - bool src_is_vram = mem_type_is_vram(src->mem_type);
> - bool dst_is_vram = mem_type_is_vram(dst->mem_type);
> + bool src_is_vram = is_devmem(src_bo, src);
> + bool dst_is_vram = is_devmem(dst_bo, dst);
> bool type_device = src_bo->ttm.type == ttm_bo_type_device;
> bool needs_ccs_emit = type_device && xe_migrate_needs_ccs_emit(xe);
> bool copy_ccs = xe_device_has_flat_ccs(xe) &&
> @@ -1250,11 +1273,11 @@ static struct dma_fence *__xe_migrate_copy(struct xe_migrate *m,
> if (src_bo != dst_bo && XE_WARN_ON(xe_bo_size(src_bo) != xe_bo_size(dst_bo)))
> return ERR_PTR(-EINVAL);
>
> - if (!src_is_vram)
> + if (!src_is_vram && src->mem_type != XE_PL_STOLEN)
> xe_res_first_sg(xe_bo_sg(src_bo), 0, size, &src_it);
> else
> xe_res_first(src, 0, size, &src_it);
> - if (!dst_is_vram)
> + if (!dst_is_vram && dst->mem_type != XE_PL_STOLEN)
> xe_res_first_sg(xe_bo_sg(dst_bo), 0, size, &dst_it);
> else
> xe_res_first(dst, 0, size, &dst_it);
[Severity: High]
Does emit_pte() omit vram_region_gpu_offset(res) for XE_PL_STOLEN on
integrated platforms with GRAPHICS_VERx100(xe) < 1270?
On those platforms xe_ttm_stolen_cpu_access_needs_ggtt() is true, so
is_devmem() returns false for src_is_vram, dst_is_vram, and clear_vram
while xe_res_first() still initializes the cursor with a 0-based offset
into stolen memory. In emit_pte(), vram_region_gpu_offset(res) is only
added when is_vram is true:
drivers/gpu/drm/xe/xe_migrate.c:emit_pte() {
...
addr = xe_res_dma(cur) & PAGE_MASK;
if (is_vram) {
...
addr += vram_region_gpu_offset(res);
devmem = true;
}
...
}
As a result, __xe_migrate_copy() and xe_migrate_clear() encode physical
addresses starting at 0x0 instead of mgr->stolen_base, causing GPU DMA to
read or overwrite low host system RAM (for example during fbdev BIOS
framebuffer takeover).
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116131349.333818-7-dev@lankhorst.se?part=2
next prev parent reply other threads:[~2026-11-16 13:29 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 13:13 [PATCH v5 0/5] drm/xe/display: Transparant fallback from stolen to sysmem Maarten Lankhorst
2026-11-16 13:13 ` [PATCH v5 1/5] drm/xe/display: Avoid using stolen memory for framebuffer when media gt exists Maarten Lankhorst
2026-11-16 13:13 ` [PATCH v5 2/5] drm/xe/migrate: Support copying between sysmem and stolen Maarten Lankhorst
2026-11-16 13:29 ` sashiko-bot [this message]
2026-11-16 13:13 ` [PATCH v5 3/5] drm/xe: Raise gt frequency slightly earlier Maarten Lankhorst
2026-11-16 13:13 ` [PATCH v5 4/5] HACK: Always fallback Maarten Lankhorst
2026-11-16 13:25 ` sashiko-bot
2026-11-16 13:13 ` [PATCH v5 5/5] drm/i915: Introduce intel_bo_fbdev_bios_fb_takeover() Maarten Lankhorst
2026-11-16 13:26 ` Ville Syrjälä
2026-11-17 15:57 ` Maarten Lankhorst
2026-11-16 13:59 ` sashiko-bot
2026-11-16 15:53 ` ✗ CI.checkpatch: warning for drm/xe/display: Transparant fallback from stolen to sysmem. (rev6) Patchwork
2026-11-16 15:55 ` ✓ CI.KUnit: success " Patchwork
2026-11-16 16:22 ` ✓ i915.CI.BAT: success for drm/xe/display: Transparant fallback from stolen to sysmem. (rev5) Patchwork
2026-11-16 16:28 ` ✗ Xe.CI.BAT: failure for drm/xe/display: Transparant fallback from stolen to sysmem. (rev6) Patchwork
2026-11-17 0:28 ` ✗ i915.CI.Full: failure for drm/xe/display: Transparant fallback from stolen to sysmem. (rev5) Patchwork
2026-11-17 0:41 ` ✗ Xe.CI.FULL: failure for drm/xe/display: Transparant fallback from stolen to sysmem. (rev6) Patchwork
-- strict thread matches above, loose matches on Subject: below --
2026-11-13 12:44 [PATCH v5 0/5] drm/xe/display: Transparant fallback from stolen to sysmem Maarten Lankhorst
2026-11-13 12:44 ` [PATCH v5 2/5] drm/xe/migrate: Support copying between sysmem and stolen Maarten Lankhorst
2026-11-13 13:05 ` 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=sashiko-outbox-217075@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dev@lankhorst.se \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.