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

drm/xe/sched_job: Promote xe_sched_job_add_deps()

Move it out of the xe_migrate compilation unit so it can be re-used in
other places.

Cc: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Francois Dugast <francois.dugast@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240614094433.775866-1-francois.dugast@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

authored by

Francois Dugast and committed by
Rodrigo Vivi
de8390b1 8c57c4dc

+22 -19
+3 -3
drivers/gpu/drm/xe/xe_exec.c
··· 259 259 260 260 /* Wait behind rebinds */ 261 261 if (!xe_vm_in_lr_mode(vm)) { 262 - err = drm_sched_job_add_resv_dependencies(&job->drm, 263 - xe_vm_resv(vm), 264 - DMA_RESV_USAGE_KERNEL); 262 + err = xe_sched_job_add_deps(job, 263 + xe_vm_resv(vm), 264 + DMA_RESV_USAGE_KERNEL); 265 265 if (err) 266 266 goto err_put_job; 267 267 }
+10 -16
drivers/gpu/drm/xe/xe_migrate.c
··· 647 647 bb->cs[bb->len++] = upper_32_bits(src_ofs); 648 648 } 649 649 650 - static int job_add_deps(struct xe_sched_job *job, struct dma_resv *resv, 651 - enum dma_resv_usage usage) 652 - { 653 - return drm_sched_job_add_resv_dependencies(&job->drm, resv, usage); 654 - } 655 - 656 650 static u64 xe_migrate_batch_base(struct xe_migrate *m, bool usm) 657 651 { 658 652 return usm ? m->usm_batch_base_ofs : m->batch_base_ofs; ··· 843 849 844 850 xe_sched_job_add_migrate_flush(job, flush_flags); 845 851 if (!fence) { 846 - err = job_add_deps(job, src_bo->ttm.base.resv, 847 - DMA_RESV_USAGE_BOOKKEEP); 852 + err = xe_sched_job_add_deps(job, src_bo->ttm.base.resv, 853 + DMA_RESV_USAGE_BOOKKEEP); 848 854 if (!err && src_bo != dst_bo) 849 - err = job_add_deps(job, dst_bo->ttm.base.resv, 850 - DMA_RESV_USAGE_BOOKKEEP); 855 + err = xe_sched_job_add_deps(job, dst_bo->ttm.base.resv, 856 + DMA_RESV_USAGE_BOOKKEEP); 851 857 if (err) 852 858 goto err_job; 853 859 } ··· 1085 1091 * fences, which are always tracked as 1086 1092 * DMA_RESV_USAGE_KERNEL. 1087 1093 */ 1088 - err = job_add_deps(job, bo->ttm.base.resv, 1089 - DMA_RESV_USAGE_KERNEL); 1094 + err = xe_sched_job_add_deps(job, bo->ttm.base.resv, 1095 + DMA_RESV_USAGE_KERNEL); 1090 1096 if (err) 1091 1097 goto err_job; 1092 1098 } ··· 1411 1417 1412 1418 /* Wait on BO move */ 1413 1419 if (bo) { 1414 - err = job_add_deps(job, bo->ttm.base.resv, 1415 - DMA_RESV_USAGE_KERNEL); 1420 + err = xe_sched_job_add_deps(job, bo->ttm.base.resv, 1421 + DMA_RESV_USAGE_KERNEL); 1416 1422 if (err) 1417 1423 goto err_job; 1418 1424 } ··· 1422 1428 * trigger preempts before moving forward 1423 1429 */ 1424 1430 if (first_munmap_rebind) { 1425 - err = job_add_deps(job, xe_vm_resv(vm), 1426 - DMA_RESV_USAGE_BOOKKEEP); 1431 + err = xe_sched_job_add_deps(job, xe_vm_resv(vm), 1432 + DMA_RESV_USAGE_BOOKKEEP); 1427 1433 if (err) 1428 1434 goto err_job; 1429 1435 }
+6
drivers/gpu/drm/xe/xe_sched_job.c
··· 363 363 for (i = 0; i < snapshot->batch_addr_len; i++) 364 364 drm_printf(p, "batch_addr[%u]: 0x%016llx\n", i, snapshot->batch_addr[i]); 365 365 } 366 + 367 + int xe_sched_job_add_deps(struct xe_sched_job *job, struct dma_resv *resv, 368 + enum dma_resv_usage usage) 369 + { 370 + return drm_sched_job_add_resv_dependencies(&job->drm, resv, usage); 371 + }
+3
drivers/gpu/drm/xe/xe_sched_job.h
··· 90 90 void xe_sched_job_snapshot_free(struct xe_sched_job_snapshot *snapshot); 91 91 void xe_sched_job_snapshot_print(struct xe_sched_job_snapshot *snapshot, struct drm_printer *p); 92 92 93 + int xe_sched_job_add_deps(struct xe_sched_job *job, struct dma_resv *resv, 94 + enum dma_resv_usage usage); 95 + 93 96 #endif