From: Matt Roper Date: Wed, 29 Mar 2023 17:33:33 +0000 (-0700) Subject: drm/xe: Adjust batchbuffer space warning when creating a job X-Git-Tag: Ubuntu-6.8.0-17.17~1697^2~7^2~820 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=9b36f7af2024ef30866f5fa0b1132ca924fd81fc;p=mirror_ubuntu-kernels.git drm/xe: Adjust batchbuffer space warning when creating a job We should WARN (not BUG) when creating a job if the batchbuffer does not have sufficient space and padding. The hardware prefetch requirements should also be considered. Link: https://lore.kernel.org/r/20230329173334.4015124-3-matthew.d.roper@intel.com Signed-off-by: Matt Roper Reviewed-by: José Roberto de Souza Signed-off-by: Rodrigo Vivi --- diff --git a/drivers/gpu/drm/xe/xe_bb.c b/drivers/gpu/drm/xe/xe_bb.c index f326f117ba3b..7172801ee570 100644 --- a/drivers/gpu/drm/xe/xe_bb.c +++ b/drivers/gpu/drm/xe/xe_bb.c @@ -63,10 +63,10 @@ __xe_bb_create_job(struct xe_engine *kernel_eng, struct xe_bb *bb, u64 *addr) { u32 size = drm_suballoc_size(bb->bo); - XE_BUG_ON((bb->len * 4 + 1) > size); - bb->cs[bb->len++] = MI_BATCH_BUFFER_END; + WARN_ON(bb->len * 4 + bb_prefetch(kernel_eng->gt) > size); + xe_sa_bo_flush_write(bb->bo); return xe_sched_job_create(kernel_eng, addr);