Lines Matching full:cs
41 void hl_hw_queue_update_ci(struct hl_cs *cs) in hl_hw_queue_update_ci() argument
43 struct hl_device *hdev = cs->ctx->hdev; in hl_hw_queue_update_ci()
58 * 1. All queues of a non completion CS will never get a completion. in hl_hw_queue_update_ci()
62 if (!cs_needs_completion(cs) || q->queue_type == QUEUE_TYPE_INT) in hl_hw_queue_update_ci()
63 atomic_add(cs->jobs_in_queue_cnt[i], &q->ci); in hl_hw_queue_update_ci()
197 * more than once per CS for the same queue
270 struct hl_device *hdev = job->cs->ctx->hdev; in ext_queue_schedule_job()
290 /* Skip completion flow in case this is a non completion CS */ in ext_queue_schedule_job()
291 if (!cs_needs_completion(job->cs)) in ext_queue_schedule_job()
334 struct hl_device *hdev = job->cs->ctx->hdev; in int_queue_schedule_job()
370 struct hl_device *hdev = job->cs->ctx->hdev; in hw_queue_schedule_job()
381 offset = job->cs->sequence & (hdev->asic_prop.max_pending_cs - 1); in hw_queue_schedule_job()
436 struct hl_cs *cs, struct hl_cs_job *job, in hl_hw_queue_encaps_sig_set_sob_info() argument
439 struct hl_cs_encaps_sig_handle *handle = cs->encaps_sig_hdl; in hl_hw_queue_encaps_sig_set_sob_info()
450 * if user set wait offset to 0, then treat it as legacy wait cs, in hl_hw_queue_encaps_sig_set_sob_info()
459 static int init_wait_cs(struct hl_device *hdev, struct hl_cs *cs, in init_wait_cs() argument
470 signal_cs_cmpl = container_of(cs->signal_fence, in init_wait_cs()
474 if (cs->encaps_signals) { in init_wait_cs()
479 hl_hw_queue_encaps_sig_set_sob_info(hdev, cs, job, cs_cmpl); in init_wait_cs()
481 …dev_dbg(hdev->dev, "Wait for encaps signals handle, qidx(%u), CS sequence(%llu), sob val: 0x%x, of… in init_wait_cs()
482 cs->encaps_sig_hdl->q_idx, in init_wait_cs()
483 cs->encaps_sig_hdl->cs_seq, in init_wait_cs()
487 /* Copy the SOB id and value of the signal CS */ in init_wait_cs()
492 /* check again if the signal cs already completed. in init_wait_cs()
493 * if yes then don't send any wait cs since the hw_sob in init_wait_cs()
496 * while wait cs is not submitted. in init_wait_cs()
506 if (completion_done(&cs->signal_fence->completion)) { in init_wait_cs()
518 prop->base_mon_id, q_idx, cs->sequence); in init_wait_cs()
531 hl_fence_put(cs->signal_fence); in init_wait_cs()
532 cs->signal_fence = NULL; in init_wait_cs()
538 * init_signal_wait_cs - initialize a signal/wait CS
539 * @cs: pointer to the signal/wait CS
543 static int init_signal_wait_cs(struct hl_cs *cs) in init_signal_wait_cs() argument
545 struct hl_ctx *ctx = cs->ctx; in init_signal_wait_cs()
549 container_of(cs->fence, struct hl_cs_compl, base_fence); in init_signal_wait_cs()
552 /* There is only one job in a signal/wait CS */ in init_signal_wait_cs()
553 job = list_first_entry(&cs->job_list, struct hl_cs_job, in init_signal_wait_cs()
556 if (cs->type & CS_TYPE_SIGNAL) in init_signal_wait_cs()
558 else if (cs->type & CS_TYPE_WAIT) in init_signal_wait_cs()
559 rc = init_wait_cs(hdev, cs, job, cs_cmpl); in init_signal_wait_cs()
565 (struct hl_device *hdev, struct hl_cs *cs) in encaps_sig_first_staged_cs_handler() argument
568 container_of(cs->fence, in encaps_sig_first_staged_cs_handler()
577 encaps_sig_hdl = idr_find(&mgr->handles, cs->encaps_sig_hdl_id); in encaps_sig_first_staged_cs_handler()
580 * Set handler CS sequence, in encaps_sig_first_staged_cs_handler()
581 * the CS which contains the encapsulated signals. in encaps_sig_first_staged_cs_handler()
583 encaps_sig_hdl->cs_seq = cs->sequence; in encaps_sig_first_staged_cs_handler()
599 …dev_dbg(hdev->dev, "CS seq (%llu) added to encaps signal handler id (%u), count(%u), qidx(%u), sob… in encaps_sig_first_staged_cs_handler()
600 cs->sequence, encaps_sig_hdl->id, in encaps_sig_first_staged_cs_handler()
608 cs->encaps_sig_hdl_id); in encaps_sig_first_staged_cs_handler()
619 * @cs: pointer to the CS
621 int hl_hw_queue_schedule_cs(struct hl_cs *cs) in hl_hw_queue_schedule_cs() argument
625 struct hl_ctx *ctx = cs->ctx; in hl_hw_queue_schedule_cs()
641 "device is %s, CS rejected!\n", hdev->status[status]); in hl_hw_queue_schedule_cs()
650 if (cs->jobs_in_queue_cnt[i]) { in hl_hw_queue_schedule_cs()
654 cs->jobs_in_queue_cnt[i], in hl_hw_queue_schedule_cs()
655 cs_needs_completion(cs) ? in hl_hw_queue_schedule_cs()
660 cs->jobs_in_queue_cnt[i]); in hl_hw_queue_schedule_cs()
664 cs->jobs_in_queue_cnt[i]); in hl_hw_queue_schedule_cs()
685 if ((cs->type == CS_TYPE_SIGNAL) || (cs->type == CS_TYPE_WAIT)) { in hl_hw_queue_schedule_cs()
686 rc = init_signal_wait_cs(cs); in hl_hw_queue_schedule_cs()
689 } else if (cs->type == CS_TYPE_COLLECTIVE_WAIT) { in hl_hw_queue_schedule_cs()
690 rc = hdev->asic_funcs->collective_wait_init_cs(cs); in hl_hw_queue_schedule_cs()
696 if (cs->encaps_signals && cs->staged_first) { in hl_hw_queue_schedule_cs()
697 rc = encaps_sig_first_staged_cs_handler(hdev, cs); in hl_hw_queue_schedule_cs()
704 /* Verify staged CS exists and add to the staged list */ in hl_hw_queue_schedule_cs()
705 if (cs->staged_cs && !cs->staged_first) { in hl_hw_queue_schedule_cs()
708 staged_cs = hl_staged_cs_find_first(hdev, cs->staged_sequence); in hl_hw_queue_schedule_cs()
712 cs->staged_sequence); in hl_hw_queue_schedule_cs()
720 cs->staged_sequence); in hl_hw_queue_schedule_cs()
725 list_add_tail(&cs->staged_cs_node, &staged_cs->staged_cs_node); in hl_hw_queue_schedule_cs()
727 /* update stream map of the first CS */ in hl_hw_queue_schedule_cs()
730 cs->fence->stream_master_qid_map; in hl_hw_queue_schedule_cs()
733 list_add_tail(&cs->mirror_node, &hdev->cs_mirror_list); in hl_hw_queue_schedule_cs()
735 /* Queue TDR if the CS is the first entry and if timeout is wanted */ in hl_hw_queue_schedule_cs()
737 struct hl_cs, mirror_node) == cs; in hl_hw_queue_schedule_cs()
739 first_entry && cs_needs_timeout(cs)) { in hl_hw_queue_schedule_cs()
740 cs->tdr_active = true; in hl_hw_queue_schedule_cs()
741 schedule_delayed_work(&cs->work_tdr, cs->timeout_jiffies); in hl_hw_queue_schedule_cs()
747 list_for_each_entry_safe(job, tmp, &cs->job_list, cs_node) in hl_hw_queue_schedule_cs()
762 cs->submitted = true; in hl_hw_queue_schedule_cs()
772 (cs->jobs_in_queue_cnt[i])) { in hl_hw_queue_schedule_cs()
775 atomic_add(cs->jobs_in_queue_cnt[i], free_slots); in hl_hw_queue_schedule_cs()
965 * In case we got here due to a stuck CS, the refcnt might be bigger in sync_stream_queue_reset()