From: Matthew Auld Date: Wed, 22 Oct 2025 16:38:33 +0000 (+0100) Subject: drm/xe/migrate: fix batch buffer sizing X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1413329456aaf5d209ab9c73ae710fb88785ef78;p=thirdparty%2Fkernel%2Flinux.git drm/xe/migrate: fix batch buffer sizing In xe_migrate_vram() the copy can straddle page boundaries, so the len might look like a single page, but actually accounting for the offset within the page we will need to emit more than one PTE. Otherwise in some cases the batch buffer will be undersized leading to warnings later. We already have npages so use that instead. Signed-off-by: Matthew Auld Cc: Matthew Brost Reviewed-by: Matthew Brost Link: https://lore.kernel.org/r/20251022163836.191405-5-matthew.auld@intel.com --- diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c index ce5543fa7a521..fa87e0eddd09b 100644 --- a/drivers/gpu/drm/xe/xe_migrate.c +++ b/drivers/gpu/drm/xe/xe_migrate.c @@ -1894,7 +1894,7 @@ static struct dma_fence *xe_migrate_vram(struct xe_migrate *m, xe_assert(xe, npages * PAGE_SIZE <= MAX_PREEMPTDISABLE_TRANSFER); - batch_size += pte_update_cmd_size(len); + batch_size += pte_update_cmd_size(npages << PAGE_SHIFT); batch_size += EMIT_COPY_DW; bb = xe_bb_new(gt, batch_size, use_usm_batch);