Skip to content

Commit 057a7d6

Browse files
author
Lucas De Marchi
committed
drm/xe/migrate: Fix alignment check
The check would fail if the address is unaligned, but not when accounting the offset. Instead of `buf | offset` it should have been `buf + offset`. To make it more readable and also drop the uintptr_t, just use the IS_ALIGNED() macro. Fixes: 270172f ("drm/xe: Update xe_ttm_access_memory to use GPU for non-visible access") Reviewed-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Link: https://lore.kernel.org/r/20250710-migrate-aligned-v1-1-44003ef3c078@intel.com Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> (cherry picked from commit 81e139d) Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
1 parent 3155ac8 commit 057a7d6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/gpu/drm/xe/xe_migrate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,8 +1817,8 @@ int xe_migrate_access_memory(struct xe_migrate *m, struct xe_bo *bo,
18171817
xe_bo_assert_held(bo);
18181818

18191819
/* Use bounce buffer for small access and unaligned access */
1820-
if (len & XE_CACHELINE_MASK ||
1821-
((uintptr_t)buf | offset) & XE_CACHELINE_MASK) {
1820+
if (!IS_ALIGNED(len, XE_CACHELINE_BYTES) ||
1821+
!IS_ALIGNED((unsigned long)buf + offset, XE_CACHELINE_BYTES)) {
18221822
int buf_offset = 0;
18231823

18241824
/*

0 commit comments

Comments
 (0)