Lines Matching refs:cptpf
14 static int forward_to_af(struct otx2_cptpf_dev *cptpf, in forward_to_af() argument
21 mutex_lock(&cptpf->lock); in forward_to_af()
22 msg = otx2_mbox_alloc_msg(&cptpf->afpf_mbox, 0, size); in forward_to_af()
24 mutex_unlock(&cptpf->lock); in forward_to_af()
35 ret = otx2_cpt_sync_mbox_msg(&cptpf->afpf_mbox); in forward_to_af()
42 dev_warn(&cptpf->pdev->dev, in forward_to_af()
44 mutex_unlock(&cptpf->lock); in forward_to_af()
47 mutex_unlock(&cptpf->lock); in forward_to_af()
51 static int handle_msg_get_caps(struct otx2_cptpf_dev *cptpf, in handle_msg_get_caps() argument
58 otx2_mbox_alloc_msg(&cptpf->vfpf_mbox, vf->vf_id, in handle_msg_get_caps()
67 rsp->cpt_revision = cptpf->pdev->revision; in handle_msg_get_caps()
68 memcpy(&rsp->eng_caps, &cptpf->eng_caps, sizeof(rsp->eng_caps)); in handle_msg_get_caps()
73 static int handle_msg_get_eng_grp_num(struct otx2_cptpf_dev *cptpf, in handle_msg_get_eng_grp_num() argument
82 otx2_mbox_alloc_msg(&cptpf->vfpf_mbox, vf->vf_id, sizeof(*rsp)); in handle_msg_get_eng_grp_num()
90 rsp->eng_grp_num = otx2_cpt_get_eng_grp(&cptpf->eng_grps, in handle_msg_get_eng_grp_num()
96 static int handle_msg_kvf_limits(struct otx2_cptpf_dev *cptpf, in handle_msg_kvf_limits() argument
103 otx2_mbox_alloc_msg(&cptpf->vfpf_mbox, vf->vf_id, sizeof(*rsp)); in handle_msg_kvf_limits()
110 rsp->kvf_limits = cptpf->kvf_limits; in handle_msg_kvf_limits()
115 static int cptpf_handle_vf_req(struct otx2_cptpf_dev *cptpf, in cptpf_handle_vf_req() argument
127 err = handle_msg_get_eng_grp_num(cptpf, vf, req); in cptpf_handle_vf_req()
130 err = handle_msg_get_caps(cptpf, vf, req); in cptpf_handle_vf_req()
133 err = handle_msg_kvf_limits(cptpf, vf, req); in cptpf_handle_vf_req()
136 err = forward_to_af(cptpf, vf, req, size); in cptpf_handle_vf_req()
142 otx2_reply_invalid_msg(&cptpf->vfpf_mbox, vf->vf_id, 0, req->id); in cptpf_handle_vf_req()
143 otx2_mbox_msg_send(&cptpf->vfpf_mbox, vf->vf_id); in cptpf_handle_vf_req()
149 struct otx2_cptpf_dev *cptpf = arg; in otx2_cptpf_vfpf_mbox_intr() local
160 intr = otx2_cpt_read64(cptpf->reg_base, BLKADDR_RVUM, 0, in otx2_cptpf_vfpf_mbox_intr()
163 for (vf_idx = i * 64; vf_idx < cptpf->enabled_vfs; vf_idx++) { in otx2_cptpf_vfpf_mbox_intr()
164 vf = &cptpf->vf[vf_idx]; in otx2_cptpf_vfpf_mbox_intr()
166 queue_work(cptpf->vfpf_mbox_wq, in otx2_cptpf_vfpf_mbox_intr()
169 otx2_cpt_write64(cptpf->reg_base, BLKADDR_RVUM, in otx2_cptpf_vfpf_mbox_intr()
180 struct otx2_cptpf_dev *cptpf; in otx2_cptpf_vfpf_mbox_handler() local
189 cptpf = vf->cptpf; in otx2_cptpf_vfpf_mbox_handler()
190 mbox = &cptpf->vfpf_mbox; in otx2_cptpf_vfpf_mbox_handler()
202 msg->pcifunc = ((u16)cptpf->pf_id << RVU_PFVF_PF_SHIFT) | in otx2_cptpf_vfpf_mbox_handler()
205 err = cptpf_handle_vf_req(cptpf, vf, msg, in otx2_cptpf_vfpf_mbox_handler()
226 struct otx2_cptpf_dev *cptpf = arg; in otx2_cptpf_afpf_mbox_intr() local
230 intr = otx2_cpt_read64(cptpf->reg_base, BLKADDR_RVUM, 0, RVU_PF_INT); in otx2_cptpf_afpf_mbox_intr()
234 queue_work(cptpf->afpf_mbox_wq, &cptpf->afpf_mbox_work); in otx2_cptpf_afpf_mbox_intr()
236 otx2_cpt_write64(cptpf->reg_base, BLKADDR_RVUM, 0, RVU_PF_INT, in otx2_cptpf_afpf_mbox_intr()
242 static void process_afpf_mbox_msg(struct otx2_cptpf_dev *cptpf, in process_afpf_mbox_msg() argument
245 struct device *dev = &cptpf->pdev->dev; in process_afpf_mbox_msg()
260 cptpf->pf_id = (msg->pcifunc >> RVU_PFVF_PF_SHIFT) & in process_afpf_mbox_msg()
276 cptpf->lfs.are_lfs_attached = 1; in process_afpf_mbox_msg()
280 cptpf->lfs.are_lfs_attached = 0; in process_afpf_mbox_msg()
290 static void forward_to_vf(struct otx2_cptpf_dev *cptpf, struct mbox_msghdr *msg, in forward_to_vf() argument
297 dev_err(&cptpf->pdev->dev, in forward_to_vf()
302 dev_err(&cptpf->pdev->dev, in forward_to_vf()
307 vfpf_mbox = &cptpf->vfpf_mbox; in forward_to_vf()
309 if (vf_id >= cptpf->enabled_vfs) { in forward_to_vf()
310 dev_err(&cptpf->pdev->dev, in forward_to_vf()
312 vf_id, cptpf->enabled_vfs); in forward_to_vf()
320 dev_err(&cptpf->pdev->dev, in forward_to_vf()
336 struct otx2_cptpf_dev *cptpf; in otx2_cptpf_afpf_mbox_handler() local
343 cptpf = container_of(work, struct otx2_cptpf_dev, afpf_mbox_work); in otx2_cptpf_afpf_mbox_handler()
344 afpf_mbox = &cptpf->afpf_mbox; in otx2_cptpf_afpf_mbox_handler()
358 forward_to_vf(cptpf, msg, vf_id, in otx2_cptpf_afpf_mbox_handler()
361 process_afpf_mbox_msg(cptpf, msg); in otx2_cptpf_afpf_mbox_handler()