From: Matthew Auld <matthew.auld@xxxxxxxxx> commit ee06c09ded3c2f722be4e240ed06287e23596bda upstream. Spec says SW is expected to round up to the nearest 128K, if not already aligned for the CC unit view of CCS. We are seeing the assert sometimes pop on BMG to tell us that there is a hole between GSM and CCS, as well as popping other asserts with having a vram size with strange alignment, which is likely caused by misaligned offset here. v2 (Shuicheng): - Do the round_up() on final SW address. BSpec: 68023 Fixes: b5c2ca0372dc ("drm/xe/xe2hpg: Determine flat ccs offset for vram") Signed-off-by: Matthew Auld <matthew.auld@xxxxxxxxx> Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@xxxxxxxxx> Cc: Akshata Jahagirdar <akshata.jahagirdar@xxxxxxxxx> Cc: Lucas De Marchi <lucas.demarchi@xxxxxxxxx> Cc: Shuicheng Lin <shuicheng.lin@xxxxxxxxx> Cc: Matt Roper <matthew.d.roper@xxxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx # v6.10+ Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@xxxxxxxxx> Tested-by: Shuicheng Lin <shuicheng.lin@xxxxxxxxx> Reviewed-by: Lucas De Marchi <lucas.demarchi@xxxxxxxxx> Link: https://patchwork.freedesktop.org/patch/msgid/20240916084911.13119-2-matthew.auld@xxxxxxxxx Signed-off-by: Lucas De Marchi <lucas.demarchi@xxxxxxxxx> (cherry picked from commit 37173392741c425191b959acb3adf70c9a4610c0) Signed-off-by: Lucas De Marchi <lucas.demarchi@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/xe/xe_vram.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/gpu/drm/xe/xe_vram.c +++ b/drivers/gpu/drm/xe/xe_vram.c @@ -182,6 +182,7 @@ static inline u64 get_flat_ccs_offset(st offset = offset_hi << 32; /* HW view bits 39:32 */ offset |= offset_lo << 6; /* HW view bits 31:6 */ offset *= num_enabled; /* convert to SW view */ + offset = round_up(offset, SZ_128K); /* SW must round up to nearest 128K */ /* We don't expect any holes */ xe_assert_msg(xe, offset == (xe_mmio_read64_2x32(gt, GSMBASE) - ccs_size), Patches currently in stable-queue which might be from matthew.auld@xxxxxxxxx are queue-6.11/drm-xe-vram-fix-ccs-offset-calculation.patch queue-6.11/drm-xe-fixup-xe_alloc_pf_queue.patch queue-6.11/drm-xe-guc_submit-add-missing-locking-in-wedged_fini.patch queue-6.11/drm-xe-vm-move-xa_alloc-to-prevent-uaf.patch queue-6.11/drm-xe-fix-uaf-around-queue-destruction.patch queue-6.11/drm-xe-add-timeout-to-preempt-fences.patch queue-6.11/drm-xe-fix-memory-leak-on-xe_alloc_pf_queue-failure.patch queue-6.11/drm-xe-clean-up-vm-exec-queue-file-lock-usage.patch queue-6.11/drm-i915-gem-fix-bitwise-and-logical-and-mixup.patch