Skip to content

Commit 3c767f7

Browse files
committed
drm/xe/migrate: fix offset and len check
Restriction here is pitch of 4bytes to match pixel width (32b), and hw restriction where src and dst must be aligned to 64bytes. If any of that is not possible then we need a bounce buffer. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://lore.kernel.org/r/20251022163836.191405-2-matthew.auld@intel.com
1 parent f6c1345 commit 3c767f7

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

drivers/gpu/drm/xe/xe_migrate.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,7 @@ static struct dma_fence *xe_migrate_vram(struct xe_migrate *m,
18831883
unsigned long i, j;
18841884
bool use_pde = xe_migrate_vram_use_pde(sram_addr, len + sram_offset);
18851885

1886-
if (drm_WARN_ON(&xe->drm, (len & XE_CACHELINE_MASK) ||
1886+
if (drm_WARN_ON(&xe->drm, (!IS_ALIGNED(len, pitch)) ||
18871887
(sram_offset | vram_addr) & XE_CACHELINE_MASK))
18881888
return ERR_PTR(-EOPNOTSUPP);
18891889

@@ -2103,8 +2103,9 @@ int xe_migrate_access_memory(struct xe_migrate *m, struct xe_bo *bo,
21032103
xe_bo_assert_held(bo);
21042104

21052105
/* Use bounce buffer for small access and unaligned access */
2106-
if (!IS_ALIGNED(len, XE_CACHELINE_BYTES) ||
2107-
!IS_ALIGNED((unsigned long)buf + offset, XE_CACHELINE_BYTES)) {
2106+
if (!IS_ALIGNED(len, 4) ||
2107+
!IS_ALIGNED(page_offset, XE_CACHELINE_BYTES) ||
2108+
!IS_ALIGNED(offset, XE_CACHELINE_BYTES)) {
21082109
int buf_offset = 0;
21092110
void *bounce;
21102111
int err;

0 commit comments

Comments
 (0)