Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xe/migrate: fix chunk handling for 2M page emit

On systems with PAGE_SIZE > 4K the chunk will likely be rounded down to
zero, if say we have single 2M page, so one huge pte, since we also try
to align the chunk to PAGE_SIZE / XE_PAGE_SIZE, which will be 16 on 64K
systems. Make the ALIGN_DOWN conditional for 4K PTEs where we can
encounter gpu_page_size < PAGE_SIZE.

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-4-matthew.auld@intel.com

+3 -1
+3 -1
drivers/gpu/drm/xe/xe_migrate.c
··· 1804 1804 while (ptes) { 1805 1805 u32 chunk = min(MAX_PTE_PER_SDI, ptes); 1806 1806 1807 - chunk = ALIGN_DOWN(chunk, PAGE_SIZE / XE_PAGE_SIZE); 1807 + if (!level) 1808 + chunk = ALIGN_DOWN(chunk, PAGE_SIZE / XE_PAGE_SIZE); 1809 + 1808 1810 bb->cs[bb->len++] = MI_STORE_DATA_IMM | MI_SDI_NUM_QW(chunk); 1809 1811 bb->cs[bb->len++] = pt_offset; 1810 1812 bb->cs[bb->len++] = 0;