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>
{
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);