Lines Matching defs:gts
71 * Find and lock the gts that contains the specified user vaddr.
74 * - *gts with the mmap_sem locked for read and the GTS locked.
82 struct gru_thread_state *gts = NULL;
87 gts = gru_find_thread_state(vma, TSID(vaddr, vma));
88 if (gts)
89 mutex_lock(>s->ts_ctxlock);
92 return gts;
99 struct gru_thread_state *gts = ERR_PTR(-EINVAL);
106 gts = gru_alloc_thread_state(vma, TSID(vaddr, vma));
107 if (IS_ERR(gts))
109 mutex_lock(>s->ts_ctxlock);
111 return gts;
115 return gts;
121 static void gru_unlock_gts(struct gru_thread_state *gts)
123 mutex_unlock(>s->ts_ctxlock);
260 static int gru_vtop(struct gru_thread_state *gts, unsigned long vaddr,
263 struct mm_struct *mm = gts->ts_mm;
318 struct gru_thread_state *gts, int atomic,
340 ret = gru_vtop(gts, vaddr, write, atomic, &gpa, &pageshift);
345 "%s: gid %d, gts 0x%p, tfh 0x%p, vaddr 0x%lx, asid 0x%x, rw %d, ps %d, gpa 0x%lx\n",
346 atomic ? "atomic" : "non-atomic", gru->gs_gid, gts, tfh,
364 struct gru_thread_state *gts,
369 unsigned char tlb_preload_count = gts->ts_tlb_preload_count;
418 if (atomic_read(>s->ts_gms->ms_range_active))
421 ret = gru_vtop(gts, vaddr, write, atomic, &gpa, &pageshift);
427 if (!(gts->ts_sizeavail & GRU_SIZEAVAIL(pageshift))) {
428 gts->ts_sizeavail |= GRU_SIZEAVAIL(pageshift);
429 if (atomic || !gru_update_cch(gts)) {
430 gts->ts_force_cch_reload = 1;
436 gru_preload_tlb(gru, gts, atomic, vaddr, asid, write, tlb_preload_count, tfh, cbe);
441 gts->ustats.tlbdropin++;
445 "%s: gid %d, gts 0x%p, tfh 0x%p, vaddr 0x%lx, asid 0x%x, indexway 0x%x,"
447 atomic ? "atomic" : "non-atomic", gru->gs_gid, gts, tfh, vaddr, asid,
531 struct gru_thread_state *gts;
568 * The gts cannot change until a TFH start/writestart command
572 gts = gru->gs_gts[ctxnum];
575 if (!gts) {
584 gts->ustats.fmm_tlbmiss++;
585 if (!gts->ts_force_cch_reload &&
586 down_read_trylock(>s->ts_mm->mmap_sem)) {
587 gru_try_dropin(gru, gts, tfh, NULL);
588 up_read(>s->ts_mm->mmap_sem);
621 static int gru_user_dropin(struct gru_thread_state *gts,
625 struct gru_mm_struct *gms = gts->ts_gms;
628 gts->ustats.upm_tlbmiss++;
633 ret = gru_try_dropin(gts->ts_gru, gts, tfh, cb);
648 struct gru_thread_state *gts;
659 gts = gru_find_lock_gts(cb);
660 if (!gts)
662 gru_dbg(grudev, "address 0x%lx, gid %d, gts 0x%p\n", cb, gts->ts_gru ? gts->ts_gru->gs_gid : -1, gts);
664 if (ucbnum >= gts->ts_cbr_au_count * GRU_CBR_AU_SIZE)
667 gru_check_context_placement(gts);
672 if (gts->ts_gru && gts->ts_force_cch_reload) {
673 gts->ts_force_cch_reload = 0;
674 gru_update_cch(gts);
678 cbrnum = thread_cbr_number(gts, ucbnum);
679 if (gts->ts_gru) {
680 tfh = get_tfh_by_index(gts->ts_gru, cbrnum);
681 cbk = get_gseg_base_address_cb(gts->ts_gru->gs_gru_base_vaddr,
682 gts->ts_ctxnum, ucbnum);
683 ret = gru_user_dropin(gts, tfh, cbk);
686 gru_unlock_gts(gts);
698 struct gru_thread_state *gts;
705 gts = gru_find_lock_gts(excdet.cb);
706 if (!gts)
709 gru_dbg(grudev, "address 0x%lx, gid %d, gts 0x%p\n", excdet.cb, gts->ts_gru ? gts->ts_gru->gs_gid : -1, gts);
711 if (ucbnum >= gts->ts_cbr_au_count * GRU_CBR_AU_SIZE) {
713 } else if (gts->ts_gru) {
714 cbrnum = thread_cbr_number(gts, ucbnum);
715 cbe = get_cbe_by_index(gts->ts_gru, cbrnum);
730 gru_unlock_gts(gts);
747 struct gru_thread_state *gts;
757 gts = gru->gs_gts[ctxnum];
758 if (gts && mutex_trylock(>s->ts_ctxlock)) {
760 gru_unload_context(gts, 1);
761 mutex_unlock(>s->ts_ctxlock);
772 struct gru_thread_state *gts;
784 gts = gru_find_lock_gts(req.gseg);
785 if (!gts)
788 if (gts->ts_gru)
789 gru_unload_context(gts, 1);
790 gru_unlock_gts(gts);
801 struct gru_thread_state *gts;
812 gts = gru_find_lock_gts(req.gseg);
813 if (!gts)
816 gms = gts->ts_gms;
817 gru_unlock_gts(gts);
828 struct gru_thread_state *gts;
836 * If no gts exists in the array, the context has never been used & all
839 gts = gru_find_lock_gts(req.gseg);
840 if (gts) {
841 memcpy(&req.stats, >s->ustats, sizeof(gts->ustats));
842 gru_unlock_gts(gts);
844 memset(&req.stats, 0, sizeof(gts->ustats));
859 struct gru_thread_state *gts;
868 gts = gru_find_lock_gts(req.gseg);
869 if (!gts) {
870 gts = gru_alloc_locked_gts(req.gseg);
871 if (IS_ERR(gts))
872 return PTR_ERR(gts);
882 gts->ts_user_blade_id = req.val1;
883 gts->ts_user_chiplet_id = req.val0;
884 gru_check_context_placement(gts);
889 gts->ts_tgid_owner = current->tgid;
893 gts->ts_cch_req_slice = req.val1 & 3;
898 gru_unlock_gts(gts);