Lines Matching refs:cb
267 static int gru_get_cpu_resources(int dsr_bytes, void **cb, void **dsr) in gru_get_cpu_resources() argument
276 *cb = bs->kernel_cb + lcpu * GRU_HANDLE_STRIDE; in gru_get_cpu_resources()
284 static void gru_free_cpu_resources(void *cb, void *dsr) in gru_free_cpu_resources() argument
371 void gru_lock_async_resource(unsigned long han, void **cb, void **dsr) in gru_lock_async_resource() argument
379 if (cb) in gru_lock_async_resource()
380 *cb = bs->kernel_cb + ncpus * GRU_HANDLE_STRIDE; in gru_lock_async_resource()
399 int gru_get_cb_exception_detail(void *cb, in gru_get_cb_exception_detail() argument
418 off = cb - kgts->ts_gru->gs_gru_base_vaddr; in gru_get_cb_exception_detail()
424 cbrnum = thread_cbr_number(kgts, get_cb_number(cb)); in gru_get_cb_exception_detail()
425 cbe = get_cbe(GRUBASE(cb), cbrnum); in gru_get_cb_exception_detail()
437 static char *gru_get_cb_exception_detail_str(int ret, void *cb, in gru_get_cb_exception_detail_str() argument
440 struct gru_control_block_status *gen = (void *)cb; in gru_get_cb_exception_detail_str()
444 gru_get_cb_exception_detail(cb, &excdet); in gru_get_cb_exception_detail_str()
465 static int gru_retry_exception(void *cb) in gru_retry_exception() argument
467 struct gru_control_block_status *gen = (void *)cb; in gru_retry_exception()
474 if (gru_get_cb_message_queue_substatus(cb)) in gru_retry_exception()
476 gru_get_cb_exception_detail(cb, &excdet); in gru_retry_exception()
488 int gru_check_status_proc(void *cb) in gru_check_status_proc() argument
490 struct gru_control_block_status *gen = (void *)cb; in gru_check_status_proc()
495 ret = gru_retry_exception(cb); in gru_check_status_proc()
501 int gru_wait_proc(void *cb) in gru_wait_proc() argument
503 struct gru_control_block_status *gen = (void *)cb; in gru_wait_proc()
508 ret = gru_retry_exception(cb); in gru_wait_proc()
513 static void gru_abort(int ret, void *cb, char *str) in gru_abort() argument
518 gru_get_cb_exception_detail_str(ret, cb, buf, sizeof(buf))); in gru_abort()
521 void gru_wait_abort_proc(void *cb) in gru_wait_abort_proc() argument
525 ret = gru_wait_proc(cb); in gru_wait_abort_proc()
527 gru_abort(ret, cb, "gru_wait_abort"); in gru_wait_abort_proc()
591 static int send_noop_message(void *cb, struct gru_message_queue_desc *mqd, in send_noop_message() argument
603 gru_mesq(cb, mqd->mq_gpa, gru_get_tri(mhdr), 1, IMA); in send_noop_message()
604 ret = gru_wait(cb); in send_noop_message()
607 substatus = gru_get_cb_message_queue_substatus(cb); in send_noop_message()
627 m = mqd->mq_gpa + (gru_get_amo_value_head(cb) << 6); in send_noop_message()
628 gru_vstore(cb, m, gru_get_tri(mesg), XTYPE_CL, 1, 1, in send_noop_message()
630 if (gru_wait(cb) == CBS_IDLE) in send_noop_message()
649 static int send_message_queue_full(void *cb, struct gru_message_queue_desc *mqd, in send_message_queue_full() argument
658 avalue = gru_get_amo_value(cb); in send_message_queue_full()
659 head = gru_get_amo_value_head(cb); in send_message_queue_full()
660 limit = gru_get_amo_value_limit(cb); in send_message_queue_full()
671 gru_gamir(cb, EOP_IR_CLR, HSTATUS(mqd->mq_gpa, half), XTYPE_DW, IMA); in send_message_queue_full()
672 if (gru_wait(cb) != CBS_IDLE) in send_message_queue_full()
674 if (!gru_get_amo_value(cb)) { in send_message_queue_full()
681 if (send_noop_message(cb, mqd, mesg)) { in send_message_queue_full()
682 gru_gamir(cb, EOP_IR_INC, HSTATUS(mqd->mq_gpa, half), in send_message_queue_full()
684 if (gru_wait(cb) != CBS_IDLE) in send_message_queue_full()
693 gru_gamer(cb, EOP_ERR_CSWAP, mqd->mq_gpa, XTYPE_DW, mqh.val, avalue, in send_message_queue_full()
695 if (gru_wait(cb) != CBS_IDLE) in send_message_queue_full()
699 if (gru_get_amo_value(cb) != avalue) { in send_message_queue_full()
701 gru_gamir(cb, EOP_IR_INC, HSTATUS(mqd->mq_gpa, half), XTYPE_DW, in send_message_queue_full()
703 if (gru_wait(cb) != CBS_IDLE) in send_message_queue_full()
718 static int send_message_put_nacked(void *cb, struct gru_message_queue_desc *mqd, in send_message_put_nacked() argument
724 m = mqd->mq_gpa + (gru_get_amo_value_head(cb) << 6); in send_message_put_nacked()
726 gru_vset(cb, m, 0, XTYPE_CL, lines, 1, IMA); in send_message_put_nacked()
727 if (gru_wait(cb) != CBS_IDLE) in send_message_put_nacked()
730 gru_vstore(cb, m, gru_get_tri(mesg), XTYPE_CL, lines, 1, IMA); in send_message_put_nacked()
731 if (gru_wait(cb) != CBS_IDLE) in send_message_put_nacked()
748 gru_vstore_phys(cb, gpa, gru_get_tri(mesg), IAA_REGISTER, IMA); in send_message_put_nacked()
749 ret = gru_wait(cb); in send_message_put_nacked()
760 static int send_message_failure(void *cb, struct gru_message_queue_desc *mqd, in send_message_failure() argument
765 substatus = gru_get_cb_message_queue_substatus(cb); in send_message_failure()
777 ret = send_message_queue_full(cb, mqd, mesg, lines); in send_message_failure()
785 ret = send_message_put_nacked(cb, mqd, mesg, lines); in send_message_failure()
806 void *cb; in gru_send_message_gpa() local
814 if (gru_get_cpu_resources(bytes, &cb, &dsr)) in gru_send_message_gpa()
827 gru_mesq(cb, mqd->mq_gpa, gru_get_tri(mhdr), clines, IMA); in gru_send_message_gpa()
828 istatus = gru_wait(cb); in gru_send_message_gpa()
830 ret = send_message_failure(cb, mqd, dsr, clines); in gru_send_message_gpa()
832 gru_free_cpu_resources(cb, dsr); in gru_send_message_gpa()
913 void *cb; in gru_read_gpa() local
918 if (gru_get_cpu_resources(GRU_NUM_KERNEL_DSR_BYTES, &cb, &dsr)) in gru_read_gpa()
921 gru_vload_phys(cb, gpa, gru_get_tri(dsr), iaa, IMA); in gru_read_gpa()
922 ret = gru_wait(cb); in gru_read_gpa()
925 gru_free_cpu_resources(cb, dsr); in gru_read_gpa()
937 void *cb; in gru_copy_gpa() local
942 if (gru_get_cpu_resources(GRU_NUM_KERNEL_DSR_BYTES, &cb, &dsr)) in gru_copy_gpa()
944 gru_bcopy(cb, src_gpa, dest_gpa, gru_get_tri(dsr), in gru_copy_gpa()
946 ret = gru_wait(cb); in gru_copy_gpa()
947 gru_free_cpu_resources(cb, dsr); in gru_copy_gpa()
959 void *cb; in quicktest0() local
964 if (gru_get_cpu_resources(GRU_CACHE_LINE_BYTES, &cb, &dsr)) in quicktest0()
970 gru_vload(cb, uv_gpa(&word0), gru_get_tri(dsr), XTYPE_DW, 1, 1, IMA); in quicktest0()
971 if (gru_wait(cb) != CBS_IDLE) { in quicktest0()
980 gru_vstore(cb, uv_gpa(&word1), gru_get_tri(dsr), XTYPE_DW, 1, 1, IMA); in quicktest0()
981 if (gru_wait(cb) != CBS_IDLE) { in quicktest0()
995 gru_free_cpu_resources(cb, dsr); in quicktest0()
1056 void *cb0, *cb; in quicktest2() local
1081 cb = cb0 + i * GRU_HANDLE_STRIDE; in quicktest2()
1082 istatus = gru_check_status(cb); in quicktest2()
1098 gen = cb; in quicktest2()