4242#define DEFAULT_POLL_PERIOD_NS (NSEC_PER_SEC / DEFAULT_POLL_FREQUENCY_HZ)
4343#define XE_OA_UNIT_INVALID U32_MAX
4444
45+ enum xe_oa_submit_deps {
46+ XE_OA_SUBMIT_NO_DEPS ,
47+ XE_OA_SUBMIT_ADD_DEPS ,
48+ };
49+
4550struct xe_oa_reg {
4651 struct xe_reg addr ;
4752 u32 value ;
@@ -575,7 +580,8 @@ static __poll_t xe_oa_poll(struct file *file, poll_table *wait)
575580 return ret ;
576581}
577582
578- static struct dma_fence * xe_oa_submit_bb (struct xe_oa_stream * stream , struct xe_bb * bb )
583+ static struct dma_fence * xe_oa_submit_bb (struct xe_oa_stream * stream , enum xe_oa_submit_deps deps ,
584+ struct xe_bb * bb )
579585{
580586 struct xe_sched_job * job ;
581587 struct dma_fence * fence ;
@@ -588,11 +594,22 @@ static struct dma_fence *xe_oa_submit_bb(struct xe_oa_stream *stream, struct xe_
588594 goto exit ;
589595 }
590596
597+ if (deps == XE_OA_SUBMIT_ADD_DEPS ) {
598+ for (int i = 0 ; i < stream -> num_syncs && !err ; i ++ )
599+ err = xe_sync_entry_add_deps (& stream -> syncs [i ], job );
600+ if (err ) {
601+ drm_dbg (& stream -> oa -> xe -> drm , "xe_sync_entry_add_deps err %d\n" , err );
602+ goto err_put_job ;
603+ }
604+ }
605+
591606 xe_sched_job_arm (job );
592607 fence = dma_fence_get (& job -> drm .s_fence -> finished );
593608 xe_sched_job_push (job );
594609
595610 return fence ;
611+ err_put_job :
612+ xe_sched_job_put (job );
596613exit :
597614 return ERR_PTR (err );
598615}
@@ -670,7 +687,7 @@ static int xe_oa_modify_ctx_image(struct xe_oa_stream *stream, struct xe_lrc *lr
670687
671688 xe_oa_store_flex (stream , lrc , bb , flex , count );
672689
673- fence = xe_oa_submit_bb (stream , bb );
690+ fence = xe_oa_submit_bb (stream , XE_OA_SUBMIT_NO_DEPS , bb );
674691 if (IS_ERR (fence )) {
675692 err = PTR_ERR (fence );
676693 goto free_bb ;
@@ -699,7 +716,7 @@ static int xe_oa_load_with_lri(struct xe_oa_stream *stream, struct xe_oa_reg *re
699716
700717 write_cs_mi_lri (bb , reg_lri , 1 );
701718
702- fence = xe_oa_submit_bb (stream , bb );
719+ fence = xe_oa_submit_bb (stream , XE_OA_SUBMIT_NO_DEPS , bb );
703720 if (IS_ERR (fence )) {
704721 err = PTR_ERR (fence );
705722 goto free_bb ;
@@ -949,7 +966,7 @@ static int xe_oa_emit_oa_config(struct xe_oa_stream *stream, struct xe_oa_config
949966 goto exit ;
950967 }
951968
952- fence = xe_oa_submit_bb (stream , oa_bo -> bb );
969+ fence = xe_oa_submit_bb (stream , XE_OA_SUBMIT_ADD_DEPS , oa_bo -> bb );
953970 if (IS_ERR (fence )) {
954971 err = PTR_ERR (fence );
955972 goto exit ;
0 commit comments