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()
208 * more than once per CS for the same queue
281 struct hl_device *hdev = job->cs->ctx->hdev; in ext_queue_schedule_job()
301 /* Skip completion flow in case this is a non completion CS */ in ext_queue_schedule_job()
302 if (!cs_needs_completion(job->cs)) in ext_queue_schedule_job()
346 struct hl_device *hdev = job->cs->ctx->hdev; in int_queue_schedule_job()
382 struct hl_device *hdev = job->cs->ctx->hdev; in hw_queue_schedule_job()
393 offset = job->cs->sequence & (hdev->asic_prop.max_pending_cs - 1); in hw_queue_schedule_job()
444 job->cs->sob_addr_offset = hw_sob->sob_addr; in init_signal_cs()
445 job->cs->initial_sob_count = prop->next_sob_val - 1; in init_signal_cs()
451 struct hl_cs *cs, struct hl_cs_job *job, in hl_hw_queue_encaps_sig_set_sob_info() argument
454 struct hl_cs_encaps_sig_handle *handle = cs->encaps_sig_hdl; in hl_hw_queue_encaps_sig_set_sob_info()
465 * if user set wait offset to 0, then treat it as legacy wait cs, in hl_hw_queue_encaps_sig_set_sob_info()
474 static int init_wait_cs(struct hl_device *hdev, struct hl_cs *cs, in init_wait_cs() argument
485 signal_cs_cmpl = container_of(cs->signal_fence, in init_wait_cs()
489 if (cs->encaps_signals) { in init_wait_cs()
494 hl_hw_queue_encaps_sig_set_sob_info(hdev, cs, job, cs_cmpl); in init_wait_cs()
496 …dev_dbg(hdev->dev, "Wait for encaps signals handle, qidx(%u), CS sequence(%llu), sob val: 0x%x, of… in init_wait_cs()
497 cs->encaps_sig_hdl->q_idx, in init_wait_cs()
498 cs->encaps_sig_hdl->cs_seq, in init_wait_cs()
502 /* Copy the SOB id and value of the signal CS */ in init_wait_cs()
507 /* check again if the signal cs already completed. in init_wait_cs()
508 * if yes then don't send any wait cs since the hw_sob in init_wait_cs()
511 * while wait cs is not submitted. in init_wait_cs()
521 if (completion_done(&cs->signal_fence->completion)) { in init_wait_cs()
533 prop->base_mon_id, q_idx, cs->sequence); in init_wait_cs()
546 hl_fence_put(cs->signal_fence); in init_wait_cs()
547 cs->signal_fence = NULL; in init_wait_cs()
553 * init_signal_wait_cs - initialize a signal/wait CS
554 * @cs: pointer to the signal/wait CS
558 static int init_signal_wait_cs(struct hl_cs *cs) in init_signal_wait_cs() argument
560 struct hl_ctx *ctx = cs->ctx; in init_signal_wait_cs()
564 container_of(cs->fence, struct hl_cs_compl, base_fence); in init_signal_wait_cs()
567 /* There is only one job in a signal/wait CS */ in init_signal_wait_cs()
568 job = list_first_entry(&cs->job_list, struct hl_cs_job, in init_signal_wait_cs()
571 if (cs->type & CS_TYPE_SIGNAL) in init_signal_wait_cs()
573 else if (cs->type & CS_TYPE_WAIT) in init_signal_wait_cs()
574 rc = init_wait_cs(hdev, cs, job, cs_cmpl); in init_signal_wait_cs()
580 (struct hl_device *hdev, struct hl_cs *cs) in encaps_sig_first_staged_cs_handler() argument
583 container_of(cs->fence, in encaps_sig_first_staged_cs_handler()
589 mgr = &cs->ctx->sig_mgr; in encaps_sig_first_staged_cs_handler()
592 encaps_sig_hdl = idr_find(&mgr->handles, cs->encaps_sig_hdl_id); in encaps_sig_first_staged_cs_handler()
595 * Set handler CS sequence, in encaps_sig_first_staged_cs_handler()
596 * the CS which contains the encapsulated signals. in encaps_sig_first_staged_cs_handler()
598 encaps_sig_hdl->cs_seq = cs->sequence; in encaps_sig_first_staged_cs_handler()
614 …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()
615 cs->sequence, encaps_sig_hdl->id, in encaps_sig_first_staged_cs_handler()
623 cs->encaps_sig_hdl_id); in encaps_sig_first_staged_cs_handler()
634 * @cs: pointer to the CS
636 int hl_hw_queue_schedule_cs(struct hl_cs *cs) in hl_hw_queue_schedule_cs() argument
640 struct hl_ctx *ctx = cs->ctx; in hl_hw_queue_schedule_cs()
656 "device is %s, CS rejected!\n", hdev->status[status]); in hl_hw_queue_schedule_cs()
665 if (cs->jobs_in_queue_cnt[i]) { in hl_hw_queue_schedule_cs()
669 cs->jobs_in_queue_cnt[i], in hl_hw_queue_schedule_cs()
670 cs_needs_completion(cs) ? in hl_hw_queue_schedule_cs()
675 cs->jobs_in_queue_cnt[i]); in hl_hw_queue_schedule_cs()
679 cs->jobs_in_queue_cnt[i]); in hl_hw_queue_schedule_cs()
700 if ((cs->type == CS_TYPE_SIGNAL) || (cs->type == CS_TYPE_WAIT)) { in hl_hw_queue_schedule_cs()
701 rc = init_signal_wait_cs(cs); in hl_hw_queue_schedule_cs()
704 } else if (cs->type == CS_TYPE_COLLECTIVE_WAIT) { in hl_hw_queue_schedule_cs()
705 rc = hdev->asic_funcs->collective_wait_init_cs(cs); in hl_hw_queue_schedule_cs()
710 rc = hdev->asic_funcs->pre_schedule_cs(cs); in hl_hw_queue_schedule_cs()
713 "Failed in pre-submission operations of CS %d.%llu\n", in hl_hw_queue_schedule_cs()
714 ctx->asid, cs->sequence); in hl_hw_queue_schedule_cs()
718 hdev->shadow_cs_queue[cs->sequence & in hl_hw_queue_schedule_cs()
719 (hdev->asic_prop.max_pending_cs - 1)] = cs; in hl_hw_queue_schedule_cs()
721 if (cs->encaps_signals && cs->staged_first) { in hl_hw_queue_schedule_cs()
722 rc = encaps_sig_first_staged_cs_handler(hdev, cs); in hl_hw_queue_schedule_cs()
729 /* Verify staged CS exists and add to the staged list */ in hl_hw_queue_schedule_cs()
730 if (cs->staged_cs && !cs->staged_first) { in hl_hw_queue_schedule_cs()
733 staged_cs = hl_staged_cs_find_first(hdev, cs->staged_sequence); in hl_hw_queue_schedule_cs()
737 cs->staged_sequence); in hl_hw_queue_schedule_cs()
745 cs->staged_sequence); in hl_hw_queue_schedule_cs()
750 list_add_tail(&cs->staged_cs_node, &staged_cs->staged_cs_node); in hl_hw_queue_schedule_cs()
752 /* update stream map of the first CS */ in hl_hw_queue_schedule_cs()
755 cs->fence->stream_master_qid_map; in hl_hw_queue_schedule_cs()
758 list_add_tail(&cs->mirror_node, &hdev->cs_mirror_list); in hl_hw_queue_schedule_cs()
760 /* Queue TDR if the CS is the first entry and if timeout is wanted */ in hl_hw_queue_schedule_cs()
762 struct hl_cs, mirror_node) == cs; in hl_hw_queue_schedule_cs()
764 first_entry && cs_needs_timeout(cs)) { in hl_hw_queue_schedule_cs()
765 cs->tdr_active = true; in hl_hw_queue_schedule_cs()
766 schedule_delayed_work(&cs->work_tdr, cs->timeout_jiffies); in hl_hw_queue_schedule_cs()
772 list_for_each_entry_safe(job, tmp, &cs->job_list, cs_node) in hl_hw_queue_schedule_cs()
787 cs->submitted = true; in hl_hw_queue_schedule_cs()
797 (cs->jobs_in_queue_cnt[i])) { in hl_hw_queue_schedule_cs()
800 atomic_add(cs->jobs_in_queue_cnt[i], free_slots); in hl_hw_queue_schedule_cs()
978 * In case we got here due to a stuck CS, the refcnt might be bigger in sync_stream_queue_reset()