Lines Matching full:mbox

115 	struct mbox *mbox = &pf->mbox;  in otx2_flr_handler()  local
121 mutex_lock(&mbox->lock); in otx2_flr_handler()
122 req = otx2_mbox_alloc_msg_vf_flr(mbox); in otx2_flr_handler()
124 mutex_unlock(&mbox->lock); in otx2_flr_handler()
130 if (!otx2_sync_mbox_msg(&pf->mbox)) { in otx2_flr_handler()
140 mutex_unlock(&mbox->lock); in otx2_flr_handler()
294 static void otx2_queue_work(struct mbox *mw, struct workqueue_struct *mbox_wq, in otx2_queue_work()
298 struct otx2_mbox *mbox; in otx2_queue_work() local
307 mbox = &mw->mbox; in otx2_queue_work()
308 mdev = &mbox->dev[i]; in otx2_queue_work()
310 otx2_sync_mbox_bbuf(mbox, i); in otx2_queue_work()
311 hdr = mdev->mbase + mbox->rx_start; in otx2_queue_work()
315 * pf->mbox.num_msgs holds the data for use in pfaf_mbox_handler in otx2_queue_work()
316 * pf>mbox.up_num_msgs holds the data for use in in otx2_queue_work()
323 memset(mbox->hwbase + mbox->rx_start, 0, in otx2_queue_work()
330 mbox = &mw->mbox_up; in otx2_queue_work()
331 mdev = &mbox->dev[i]; in otx2_queue_work()
333 otx2_sync_mbox_bbuf(mbox, i); in otx2_queue_work()
334 hdr = mdev->mbase + mbox->rx_start; in otx2_queue_work()
339 memset(mbox->hwbase + mbox->rx_start, 0, in otx2_queue_work()
355 /* Msgs are already copied, trigger VF's mbox irq */ in otx2_forward_msg_pfvf()
361 /* Restore VF's mbox bounce buffer region address */ in otx2_forward_msg_pfvf()
372 struct mbox *dst_mbox; in otx2_forward_vf_mbox_msgs()
377 * that explicit copying of VF's msgs to PF=>AF mbox region in otx2_forward_vf_mbox_msgs()
378 * and AF=>PF responses to VF's mbox region can be avoided. in otx2_forward_vf_mbox_msgs()
384 dst_mbox = &pf->mbox; in otx2_forward_vf_mbox_msgs()
385 dst_size = dst_mbox->mbox.tx_size - in otx2_forward_vf_mbox_msgs()
391 dst_mdev = &dst_mbox->mbox.dev[0]; in otx2_forward_vf_mbox_msgs()
393 mutex_lock(&pf->mbox.lock); in otx2_forward_vf_mbox_msgs()
407 dst_mdev->mbase = pf->mbox.bbuf_base; in otx2_forward_vf_mbox_msgs()
408 mutex_unlock(&pf->mbox.lock); in otx2_forward_vf_mbox_msgs()
416 dst_mbox->mbox.rx_start); in otx2_forward_vf_mbox_msgs()
419 otx2_forward_msg_pfvf(dst_mdev, &pf->mbox_pfvf[0].mbox, in otx2_forward_vf_mbox_msgs()
420 pf->mbox.bbuf_base, vf); in otx2_forward_vf_mbox_msgs()
421 mutex_unlock(&pf->mbox.lock); in otx2_forward_vf_mbox_msgs()
451 &pf->mbox.mbox_up, in otx2_forward_vf_mbox_msgs()
465 struct otx2_mbox *mbox; in otx2_pfvf_mbox_handler() local
466 struct mbox *vf_mbox; in otx2_pfvf_mbox_handler()
469 vf_mbox = container_of(work, struct mbox, mbox_wrk); in otx2_pfvf_mbox_handler()
473 mbox = &pf->mbox_pfvf[0].mbox; in otx2_pfvf_mbox_handler()
474 mdev = &mbox->dev[vf_idx]; in otx2_pfvf_mbox_handler()
475 req_hdr = (struct mbox_hdr *)(mdev->mbase + mbox->rx_start); in otx2_pfvf_mbox_handler()
480 msg = (struct mbox_msghdr *)(mdev->mbase + mbox->rx_start + in otx2_pfvf_mbox_handler()
491 err = otx2_forward_vf_mbox_msgs(pf, mbox, MBOX_DIR_PFAF, vf_idx, in otx2_pfvf_mbox_handler()
498 otx2_reply_invalid_msg(mbox, vf_idx, 0, msg->id); in otx2_pfvf_mbox_handler()
499 otx2_mbox_msg_send(mbox, vf_idx); in otx2_pfvf_mbox_handler()
504 struct mbox *vf_mbox = container_of(work, struct mbox, mbox_up_wrk); in otx2_pfvf_mbox_up_handler()
510 struct otx2_mbox *mbox; in otx2_pfvf_mbox_up_handler() local
513 mbox = &pf->mbox_pfvf[0].mbox_up; in otx2_pfvf_mbox_up_handler()
514 mdev = &mbox->dev[vf_idx]; in otx2_pfvf_mbox_up_handler()
516 rsp_hdr = (struct mbox_hdr *)(mdev->mbase + mbox->rx_start); in otx2_pfvf_mbox_up_handler()
517 offset = mbox->rx_start + ALIGN(sizeof(*rsp_hdr), MBOX_MSG_ALIGN); in otx2_pfvf_mbox_up_handler()
524 "Mbox msg with unknown ID 0x%x\n", msg->id); in otx2_pfvf_mbox_up_handler()
530 "Mbox msg with wrong signature %x, ID 0x%x\n", in otx2_pfvf_mbox_up_handler()
541 "Mbox msg response has err %d, ID 0x%x\n", in otx2_pfvf_mbox_up_handler()
547 offset = mbox->rx_start + msg->next_msgoff; in otx2_pfvf_mbox_up_handler()
549 __otx2_mbox_reset(mbox, 0); in otx2_pfvf_mbox_up_handler()
558 struct mbox *mbox; in otx2_pfvf_mbox_intr_handler() local
561 mbox = pf->mbox_pfvf; in otx2_pfvf_mbox_intr_handler()
566 otx2_queue_work(mbox, pf->mbox_pfvf_wq, 64, vfs, intr, in otx2_pfvf_mbox_intr_handler()
574 otx2_queue_work(mbox, pf->mbox_pfvf_wq, 0, vfs, intr, TYPE_PFVF); in otx2_pfvf_mbox_intr_handler()
576 trace_otx2_msg_interrupt(mbox->mbox.pdev, "VF(s) to PF", intr); in otx2_pfvf_mbox_intr_handler()
584 struct mbox *mbox; in otx2_pfvf_mbox_init() local
592 sizeof(struct mbox), GFP_KERNEL); in otx2_pfvf_mbox_init()
618 mbox = &pf->mbox_pfvf[0]; in otx2_pfvf_mbox_init()
619 err = otx2_mbox_init(&mbox->mbox, hwbase, pf->pdev, pf->reg_base, in otx2_pfvf_mbox_init()
624 err = otx2_mbox_init(&mbox->mbox_up, hwbase, pf->pdev, pf->reg_base, in otx2_pfvf_mbox_init()
630 mbox->pfvf = pf; in otx2_pfvf_mbox_init()
631 INIT_WORK(&mbox->mbox_wrk, otx2_pfvf_mbox_handler); in otx2_pfvf_mbox_init()
632 INIT_WORK(&mbox->mbox_up_wrk, otx2_pfvf_mbox_up_handler); in otx2_pfvf_mbox_init()
633 mbox++; in otx2_pfvf_mbox_init()
648 struct mbox *mbox = &pf->mbox_pfvf[0]; in otx2_pfvf_mbox_destroy() local
650 if (!mbox) in otx2_pfvf_mbox_destroy()
658 if (mbox->mbox.hwbase) in otx2_pfvf_mbox_destroy()
659 iounmap(mbox->mbox.hwbase); in otx2_pfvf_mbox_destroy()
661 otx2_mbox_destroy(&mbox->mbox); in otx2_pfvf_mbox_destroy()
750 "Mbox msg with unknown ID 0x%x\n", msg->id); in otx2_process_pfaf_mbox_msg()
756 "Mbox msg with wrong signature %x, ID 0x%x\n", in otx2_process_pfaf_mbox_msg()
810 "Mbox msg response has err %d, ID 0x%x\n", in otx2_process_pfaf_mbox_msg()
821 struct otx2_mbox *mbox; in otx2_pfaf_mbox_handler() local
822 struct mbox *af_mbox; in otx2_pfaf_mbox_handler()
826 af_mbox = container_of(work, struct mbox, mbox_wrk); in otx2_pfaf_mbox_handler()
827 mbox = &af_mbox->mbox; in otx2_pfaf_mbox_handler()
828 mdev = &mbox->dev[0]; in otx2_pfaf_mbox_handler()
829 rsp_hdr = (struct mbox_hdr *)(mdev->mbase + mbox->rx_start); in otx2_pfaf_mbox_handler()
831 offset = mbox->rx_start + ALIGN(sizeof(*rsp_hdr), MBOX_MSG_ALIGN); in otx2_pfaf_mbox_handler()
837 offset = mbox->rx_start + msg->next_msgoff; in otx2_pfaf_mbox_handler()
839 __otx2_mbox_reset(mbox, 0); in otx2_pfaf_mbox_handler()
904 otx2_reply_invalid_msg(&pf->mbox.mbox_up, 0, 0, req->id); in otx2_process_mbox_msg_up()
915 &pf->mbox.mbox_up, 0, \ in otx2_process_mbox_msg_up()
934 otx2_reply_invalid_msg(&pf->mbox.mbox_up, 0, 0, req->id); in otx2_process_mbox_msg_up()
942 struct mbox *af_mbox = container_of(work, struct mbox, mbox_up_wrk); in otx2_pfaf_mbox_up_handler()
943 struct otx2_mbox *mbox = &af_mbox->mbox_up; in otx2_pfaf_mbox_up_handler() local
944 struct otx2_mbox_dev *mdev = &mbox->dev[0]; in otx2_pfaf_mbox_up_handler()
950 rsp_hdr = (struct mbox_hdr *)(mdev->mbase + mbox->rx_start); in otx2_pfaf_mbox_up_handler()
952 offset = mbox->rx_start + ALIGN(sizeof(*rsp_hdr), MBOX_MSG_ALIGN); in otx2_pfaf_mbox_up_handler()
961 offset = mbox->rx_start + msg->next_msgoff; in otx2_pfaf_mbox_up_handler()
964 otx2_forward_vf_mbox_msgs(pf, &pf->mbox.mbox_up, in otx2_pfaf_mbox_up_handler()
970 otx2_mbox_msg_send(mbox, 0); in otx2_pfaf_mbox_up_handler()
976 struct mbox *mbox; in otx2_pfaf_mbox_intr_handler() local
981 mbox = &pf->mbox; in otx2_pfaf_mbox_intr_handler()
983 trace_otx2_msg_interrupt(mbox->mbox.pdev, "AF to PF", BIT_ULL(0)); in otx2_pfaf_mbox_intr_handler()
985 otx2_queue_work(mbox, pf->mbox_wq, 0, 1, 1, TYPE_PFAF); in otx2_pfaf_mbox_intr_handler()
1008 snprintf(irq_name, NAME_SIZE, "RVUPFAF Mbox"); in otx2_register_mbox_intr()
1013 "RVUPF: IRQ registration failed for PFAF mbox irq\n"); in otx2_register_mbox_intr()
1027 req = otx2_mbox_alloc_msg_ready(&pf->mbox); in otx2_register_mbox_intr()
1032 err = otx2_sync_mbox_msg(&pf->mbox); in otx2_register_mbox_intr()
1045 struct mbox *mbox = &pf->mbox; in otx2_pfaf_mbox_destroy() local
1052 if (mbox->mbox.hwbase) in otx2_pfaf_mbox_destroy()
1053 iounmap((void __iomem *)mbox->mbox.hwbase); in otx2_pfaf_mbox_destroy()
1055 otx2_mbox_destroy(&mbox->mbox); in otx2_pfaf_mbox_destroy()
1056 otx2_mbox_destroy(&mbox->mbox_up); in otx2_pfaf_mbox_destroy()
1061 struct mbox *mbox = &pf->mbox; in otx2_pfaf_mbox_init() local
1065 mbox->pfvf = pf; in otx2_pfaf_mbox_init()
1084 err = otx2_mbox_init(&mbox->mbox, hwbase, pf->pdev, pf->reg_base, in otx2_pfaf_mbox_init()
1089 err = otx2_mbox_init(&mbox->mbox_up, hwbase, pf->pdev, pf->reg_base, in otx2_pfaf_mbox_init()
1094 err = otx2_mbox_bbuf_init(mbox, pf->pdev); in otx2_pfaf_mbox_init()
1098 INIT_WORK(&mbox->mbox_wrk, otx2_pfaf_mbox_handler); in otx2_pfaf_mbox_init()
1099 INIT_WORK(&mbox->mbox_up_wrk, otx2_pfaf_mbox_up_handler); in otx2_pfaf_mbox_init()
1100 mutex_init(&mbox->lock); in otx2_pfaf_mbox_init()
1113 mutex_lock(&pf->mbox.lock); in otx2_cgx_config_linkevents()
1115 msg = otx2_mbox_alloc_msg_cgx_start_linkevents(&pf->mbox); in otx2_cgx_config_linkevents()
1117 msg = otx2_mbox_alloc_msg_cgx_stop_linkevents(&pf->mbox); in otx2_cgx_config_linkevents()
1120 mutex_unlock(&pf->mbox.lock); in otx2_cgx_config_linkevents()
1124 err = otx2_sync_mbox_msg(&pf->mbox); in otx2_cgx_config_linkevents()
1125 mutex_unlock(&pf->mbox.lock); in otx2_cgx_config_linkevents()
1139 mutex_lock(&pf->mbox.lock); in otx2_cgx_config_loopback()
1141 msg = otx2_mbox_alloc_msg_cgx_intlbk_enable(&pf->mbox); in otx2_cgx_config_loopback()
1143 msg = otx2_mbox_alloc_msg_cgx_intlbk_disable(&pf->mbox); in otx2_cgx_config_loopback()
1146 mutex_unlock(&pf->mbox.lock); in otx2_cgx_config_loopback()
1150 err = otx2_sync_mbox_msg(&pf->mbox); in otx2_cgx_config_loopback()
1151 mutex_unlock(&pf->mbox.lock); in otx2_cgx_config_loopback()
1294 * TODO: But we are in irq context. How to call mbox functions which does sleep in otx2_q_intr_handler()
1369 otx2_ctx_disable(&pf->mbox, NIX_AQ_CTYPE_CQ, false); in otx2_free_cq_res()
1383 otx2_ctx_disable(&pf->mbox, NIX_AQ_CTYPE_SQ, false); in otx2_free_sq_res()
1426 struct mbox *mbox = &pf->mbox; in otx2_init_hw_resources() local
1444 mutex_lock(&mbox->lock); in otx2_init_hw_resources()
1461 mutex_unlock(&mbox->lock); in otx2_init_hw_resources()
1467 mutex_unlock(&mbox->lock); in otx2_init_hw_resources()
1473 mutex_unlock(&mbox->lock); in otx2_init_hw_resources()
1481 mutex_unlock(&mbox->lock); in otx2_init_hw_resources()
1489 mutex_unlock(&mbox->lock); in otx2_init_hw_resources()
1496 mutex_unlock(&mbox->lock); in otx2_init_hw_resources()
1505 mutex_unlock(&mbox->lock); in otx2_init_hw_resources()
1511 mutex_unlock(&mbox->lock); in otx2_init_hw_resources()
1517 otx2_ctx_disable(mbox, NIX_AQ_CTYPE_RQ, false); in otx2_init_hw_resources()
1525 otx2_ctx_disable(mbox, NPA_AQ_CTYPE_POOL, true); in otx2_init_hw_resources()
1526 otx2_ctx_disable(mbox, NPA_AQ_CTYPE_AURA, true); in otx2_init_hw_resources()
1529 mutex_lock(&mbox->lock); in otx2_init_hw_resources()
1530 free_req = otx2_mbox_alloc_msg_nix_lf_free(mbox); in otx2_init_hw_resources()
1533 if (otx2_sync_mbox_msg(mbox)) in otx2_init_hw_resources()
1538 req = otx2_mbox_alloc_msg_npa_lf_free(mbox); in otx2_init_hw_resources()
1540 if (otx2_sync_mbox_msg(mbox)) in otx2_init_hw_resources()
1544 mutex_unlock(&mbox->lock); in otx2_init_hw_resources()
1552 struct mbox *mbox = &pf->mbox; in otx2_free_hw_resources() local
1570 mutex_lock(&mbox->lock); in otx2_free_hw_resources()
1574 mutex_unlock(&mbox->lock); in otx2_free_hw_resources()
1577 otx2_ctx_disable(mbox, NIX_AQ_CTYPE_RQ, false); in otx2_free_hw_resources()
1598 mutex_lock(&mbox->lock); in otx2_free_hw_resources()
1600 free_req = otx2_mbox_alloc_msg_nix_lf_free(mbox); in otx2_free_hw_resources()
1605 if (otx2_sync_mbox_msg(mbox)) in otx2_free_hw_resources()
1608 mutex_unlock(&mbox->lock); in otx2_free_hw_resources()
1611 otx2_ctx_disable(mbox, NPA_AQ_CTYPE_POOL, true); in otx2_free_hw_resources()
1612 otx2_ctx_disable(mbox, NPA_AQ_CTYPE_AURA, true); in otx2_free_hw_resources()
1615 mutex_lock(&mbox->lock); in otx2_free_hw_resources()
1617 req = otx2_mbox_alloc_msg_npa_lf_free(mbox); in otx2_free_hw_resources()
1619 if (otx2_sync_mbox_msg(mbox)) in otx2_free_hw_resources()
1622 mutex_unlock(&mbox->lock); in otx2_free_hw_resources()
1643 mutex_lock(&pf->mbox.lock); in otx2_do_set_rx_mode()
1644 req = otx2_mbox_alloc_msg_nix_set_rx_mode(&pf->mbox); in otx2_do_set_rx_mode()
1646 mutex_unlock(&pf->mbox.lock); in otx2_do_set_rx_mode()
1659 otx2_sync_mbox_msg(&pf->mbox); in otx2_do_set_rx_mode()
1660 mutex_unlock(&pf->mbox.lock); in otx2_do_set_rx_mode()
2056 mutex_lock(&pfvf->mbox.lock); in otx2_config_hw_rx_tstamp()
2058 req = otx2_mbox_alloc_msg_cgx_ptp_rx_enable(&pfvf->mbox); in otx2_config_hw_rx_tstamp()
2060 req = otx2_mbox_alloc_msg_cgx_ptp_rx_disable(&pfvf->mbox); in otx2_config_hw_rx_tstamp()
2062 mutex_unlock(&pfvf->mbox.lock); in otx2_config_hw_rx_tstamp()
2066 err = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_config_hw_rx_tstamp()
2068 mutex_unlock(&pfvf->mbox.lock); in otx2_config_hw_rx_tstamp()
2072 mutex_unlock(&pfvf->mbox.lock); in otx2_config_hw_rx_tstamp()
2088 mutex_lock(&pfvf->mbox.lock); in otx2_config_hw_tx_tstamp()
2090 req = otx2_mbox_alloc_msg_nix_lf_ptp_tx_enable(&pfvf->mbox); in otx2_config_hw_tx_tstamp()
2092 req = otx2_mbox_alloc_msg_nix_lf_ptp_tx_disable(&pfvf->mbox); in otx2_config_hw_tx_tstamp()
2094 mutex_unlock(&pfvf->mbox.lock); in otx2_config_hw_tx_tstamp()
2098 err = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_config_hw_tx_tstamp()
2100 mutex_unlock(&pfvf->mbox.lock); in otx2_config_hw_tx_tstamp()
2104 mutex_unlock(&pfvf->mbox.lock); in otx2_config_hw_tx_tstamp()
2199 mutex_lock(&pf->mbox.lock); in otx2_do_set_vf_mac()
2200 req = otx2_mbox_alloc_msg_npc_install_flow(&pf->mbox); in otx2_do_set_vf_mac()
2216 err = otx2_sync_mbox_msg(&pf->mbox); in otx2_do_set_vf_mac()
2218 mutex_unlock(&pf->mbox.lock); in otx2_do_set_vf_mac()
2266 mutex_lock(&pf->mbox.lock); in otx2_do_set_vf_vlan()
2270 vtag_req = otx2_mbox_alloc_msg_nix_vtag_cfg(&pf->mbox); in otx2_do_set_vf_vlan()
2279 err = otx2_sync_mbox_msg(&pf->mbox); in otx2_do_set_vf_vlan()
2286 del_req = otx2_mbox_alloc_msg_npc_delete_flow(&pf->mbox); in otx2_do_set_vf_vlan()
2294 err = otx2_sync_mbox_msg(&pf->mbox); in otx2_do_set_vf_vlan()
2299 del_req = otx2_mbox_alloc_msg_npc_delete_flow(&pf->mbox); in otx2_do_set_vf_vlan()
2307 err = otx2_sync_mbox_msg(&pf->mbox); in otx2_do_set_vf_vlan()
2313 req = otx2_mbox_alloc_msg_npc_install_flow(&pf->mbox); in otx2_do_set_vf_vlan()
2334 err = otx2_sync_mbox_msg(&pf->mbox); in otx2_do_set_vf_vlan()
2339 vtag_req = otx2_mbox_alloc_msg_nix_vtag_cfg(&pf->mbox); in otx2_do_set_vf_vlan()
2351 err = otx2_sync_mbox_msg(&pf->mbox); in otx2_do_set_vf_vlan()
2356 (&pf->mbox.mbox, 0, &vtag_req->hdr); in otx2_do_set_vf_vlan()
2363 req = otx2_mbox_alloc_msg_npc_install_flow(&pf->mbox); in otx2_do_set_vf_vlan()
2381 err = otx2_sync_mbox_msg(&pf->mbox); in otx2_do_set_vf_vlan()
2384 mutex_unlock(&pf->mbox.lock); in otx2_do_set_vf_vlan()
2546 mutex_lock(&pf->mbox.lock); in otx2_set_vf_permissions()
2547 req = otx2_mbox_alloc_msg_set_vf_perm(&pf->mbox); in otx2_set_vf_permissions()
2562 rc = otx2_sync_mbox_msg(&pf->mbox); in otx2_set_vf_permissions()
2564 mutex_unlock(&pf->mbox.lock); in otx2_set_vf_permissions()
2938 otx2_detach_resources(&pf->mbox); in otx2_probe()
3095 otx2_detach_resources(&pf->mbox); in otx2_remove()