Re: [PATCH] drm/xe/migrate: Support copying between sysmem and stolen
Maarten Lankhorst <[email protected]> Thu, 23 Jul 2026 13:21:48 +0200
| Newsgroups | org.freedesktop.lists.intel-gfx,org.freedesktop.lists.intel-xe |
|---|---|
| Message-ID | <[email protected]> |
On 7/22/26 21:01, Shankar, Uma wrote: > > >> -----Original Message----- >> From: Intel-gfx <[email protected]> On Behalf Of Maarten >> Lankhorst >> Sent: Wednesday, July 22, 2026 12:56 AM >> To: [email protected] >> Cc: [email protected]; Maarten Lankhorst <[email protected]> >> Subject: [PATCH] drm/xe/migrate: Support copying between sysmem and stolen >> >> 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 <[email protected]> >> --- >> 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) >> > > This migrate_res_sizes still uses the old function instead of is_devmem. > Is it intentional ? > > Else all looks good to me. > Reviewed-by: Uma Shankar <[email protected]> Yeah, min_chunk_size is not set on integrated and that was causing an infinite loop during boot. The previous version of this patch had that issue worked around by unconditionally setting min_chunk_size for making migrate_res_size work, but the smaller delta makes it worth not fixing. Thanks! > Good to be checked by someone from Core KMD side as well. > >> 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; >> +} >> + >> 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); >> 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; >> -- >> 2.53.0 >