]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/xe: Adjust batchbuffer space warning when creating a job
authorMatt Roper <matthew.d.roper@intel.com>
Wed, 29 Mar 2023 17:33:33 +0000 (10:33 -0700)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Tue, 19 Dec 2023 23:30:26 +0000 (18:30 -0500)
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 <matthew.d.roper@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/xe_bb.c

index f326f117ba3bb73d36eeefba9c8d320148157ae4..7172801ee57053a9fe60ec18fa0ff147f985597e 100644 (file)
@@ -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);