Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: Maarten Lankhorst <dev@lankhorst.se>, intel-xe@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/xe/migrate: Support copying between sysmem and stolen
Date: Thu, 23 Jul 2026 15:00:45 +0100	[thread overview]
Message-ID: <ad6535e8-a125-4bdf-8dfc-d868b5ecbecb@intel.com> (raw)
In-Reply-To: <20260721192540.115548-2-dev@lankhorst.se>

On 21/07/2026 20:25, Maarten Lankhorst wrote:
> Stolen memory is used on integrated devices to hold the
> firmware framebuffer. In the next commit we want to copy
> the framebuffer to normal system memory.
> 
> This requires treating stolen memory mostly as VRAM, but
> without access to the identity mapping.
> 
> On discrete the identity mapping can be used, but we never
> need to copy there, so just prohibit identity map on stolen.
> 
> Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
> ---
>   drivers/gpu/drm/xe/xe_migrate.c | 18 +++++++++++++++---
>   1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
> index 4366c41bd3254..505d105472fca 100644
> --- a/drivers/gpu/drm/xe/xe_migrate.c
> +++ b/drivers/gpu/drm/xe/xe_migrate.c
> @@ -574,6 +574,10 @@ static u64 xe_migrate_res_sizes(struct xe_migrate *m, struct xe_res_cursor *cur)
>   
>   static bool xe_migrate_allow_identity(u64 size, const struct xe_res_cursor *cur)
>   {
> +	/* Stolen only used by integrated, no VRAM or identity map there */
> +	if (cur->mem_type == XE_PL_STOLEN)
> +		return false;
> +
>   	/* If the chunk is not fragmented, allow identity map. */
>   	return cur->size >= size;
>   }
> @@ -879,6 +883,14 @@ static u32 xe_migrate_ccs_copy(struct xe_migrate *m,
>   	return flush_flags;
>   }
>   
> +static bool is_devmem(u32 mem_type)
> +{
> +	if (mem_type_is_vram(mem_type) || mem_type == XE_PL_STOLEN)
> +		return true;
> +
> +	return false;
> +}

Do we need to worry about XE_PPGTT_PTE_DM in xelp_pte_encode_addr() ? I 
don't think that bit is used for stolen until recent platforms? We seem 
to guard against this in xelp_pte_encode_bo() with xe_bo_is_stolen_devmem().

> +
>   static struct dma_fence *__xe_migrate_copy(struct xe_migrate *m,
>   					   struct xe_bo *src_bo,
>   					   struct xe_bo *dst_bo,
> @@ -899,8 +911,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->mem_type);
> +	bool dst_is_vram = is_devmem(dst->mem_type);
>   	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) &&
> @@ -1597,7 +1609,7 @@ struct dma_fence *xe_migrate_clear(struct xe_migrate *m,
>   				   struct ttm_resource *dst,
>   				   u32 clear_flags)
>   {
> -	bool clear_vram = mem_type_is_vram(dst->mem_type);
> +	bool clear_vram = is_devmem(dst->mem_type);

Do we actually trigger this path for stolen? Or is this just for 
symmetry with copy?

Also, I guess overall idea here is to call copy() directly, and not mess 
with this at the bo_move()/validate() level?

>   	bool clear_bo_data = XE_MIGRATE_CLEAR_FLAG_BO_DATA & clear_flags;
>   	bool clear_ccs = XE_MIGRATE_CLEAR_FLAG_CCS_DATA & clear_flags;
>   	struct xe_gt *gt = m->tile->primary_gt;


  parent reply	other threads:[~2026-07-23 14:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21 14:26 [PATCH v2 0/5] drm/xe/display: Transparant fallback from stolen to sysmem Maarten Lankhorst
2026-07-21 14:26 ` [PATCH v2 1/5] drm/xe/display: Avoid using stolen memory for framebuffer when media gt exists Maarten Lankhorst
2026-07-22 18:18   ` Shankar, Uma
2026-07-21 14:26 ` [PATCH v2 2/5] drm/xe/migrate: Support copying between sysmem and stolen Maarten Lankhorst
2026-07-21 19:25   ` [PATCH] " Maarten Lankhorst
2026-07-22 19:01     ` Shankar, Uma
2026-07-23 14:00     ` Matthew Auld [this message]
2026-07-21 14:26 ` [PATCH v2 3/5] drm/xe: Raise gt frequency slightly earlier Maarten Lankhorst
2026-07-21 14:26 ` [PATCH v2 4/5] HACK: Always fallback Maarten Lankhorst
2026-07-21 14:26 ` [PATCH v2 5/5] drm/i915: Introduce intel_bo_fbdev_bios_fb_takeover() Maarten Lankhorst
2026-07-23  9:06   ` Shankar, Uma
2026-07-23 13:37     ` Maarten Lankhorst
2026-07-21 14:30 ` ✗ CI.checkpatch: warning for drm/xe/display: Transparant fallback from stolen to sysmem. (rev2) Patchwork
2026-07-21 14:32 ` ✓ CI.KUnit: success " Patchwork
2026-07-21 15:22 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-21 20:02 ` ✗ CI.checkpatch: warning for drm/xe/display: Transparant fallback from stolen to sysmem. (rev3) Patchwork
2026-07-21 20:03 ` ✓ CI.KUnit: success " Patchwork
2026-07-21 20:53 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-22  8:39 ` ✓ Xe.CI.FULL: " 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=ad6535e8-a125-4bdf-8dfc-d868b5ecbecb@intel.com \
    --to=matthew.auld@intel.com \
    --cc=dev@lankhorst.se \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    /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