Lines Matching +full:in +full:-

1 // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
10 struct mlx5_core_dev *mdev = dev->mdev; in alloc_pd()
13 u32 in[MLX5_ST_SZ_DW(alloc_pd_in)] = {}; in alloc_pd() local
16 MLX5_SET(alloc_pd_in, in, opcode, MLX5_CMD_OP_ALLOC_PD); in alloc_pd()
17 MLX5_SET(alloc_pd_in, in, uid, uid); in alloc_pd()
19 err = mlx5_cmd_exec_inout(mdev, alloc_pd, in, out); in alloc_pd()
28 u32 in[MLX5_ST_SZ_DW(dealloc_pd_in)] = {}; in dealloc_pd() local
29 struct mlx5_core_dev *mdev = dev->mdev; in dealloc_pd()
31 MLX5_SET(dealloc_pd_in, in, opcode, MLX5_CMD_OP_DEALLOC_PD); in dealloc_pd()
32 MLX5_SET(dealloc_pd_in, in, pd, pdn); in dealloc_pd()
33 MLX5_SET(dealloc_pd_in, in, uid, uid); in dealloc_pd()
34 return mlx5_cmd_exec_in(mdev, dealloc_pd, in); in dealloc_pd()
40 u32 in[MLX5_ST_SZ_DW(query_special_contexts_in)] = {}; in get_null_mkey() local
41 struct mlx5_core_dev *mdev = dev->mdev; in get_null_mkey()
44 MLX5_SET(query_special_contexts_in, in, opcode, MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS); in get_null_mkey()
45 err = mlx5_cmd_exec_inout(mdev, query_special_contexts, in, out); in get_null_mkey()
55 void *in; in create_uctx() local
58 if (MLX5_CAP_GEN(mvdev->mdev, umem_uid_0)) in create_uctx()
62 if (!MLX5_CAP_GEN(mvdev->mdev, log_max_uctx)) in create_uctx()
63 return -EOPNOTSUPP; in create_uctx()
66 in = kzalloc(inlen, GFP_KERNEL); in create_uctx()
67 if (!in) in create_uctx()
68 return -ENOMEM; in create_uctx()
70 MLX5_SET(create_uctx_in, in, opcode, MLX5_CMD_OP_CREATE_UCTX); in create_uctx()
71 MLX5_SET(create_uctx_in, in, uctx.cap, MLX5_UCTX_CAP_RAW_TX); in create_uctx()
73 err = mlx5_cmd_exec(mvdev->mdev, in, inlen, out, sizeof(out)); in create_uctx()
74 kfree(in); in create_uctx()
84 u32 in[MLX5_ST_SZ_DW(destroy_uctx_in)] = {}; in destroy_uctx() local
89 MLX5_SET(destroy_uctx_in, in, opcode, MLX5_CMD_OP_DESTROY_UCTX); in destroy_uctx()
90 MLX5_SET(destroy_uctx_in, in, uid, uid); in destroy_uctx()
92 mlx5_cmd_exec(mvdev->mdev, in, sizeof(in), out, sizeof(out)); in destroy_uctx()
95 int mlx5_vdpa_create_tis(struct mlx5_vdpa_dev *mvdev, void *in, u32 *tisn) in mlx5_vdpa_create_tis() argument
100 MLX5_SET(create_tis_in, in, opcode, MLX5_CMD_OP_CREATE_TIS); in mlx5_vdpa_create_tis()
101 MLX5_SET(create_tis_in, in, uid, mvdev->res.uid); in mlx5_vdpa_create_tis()
102 err = mlx5_cmd_exec_inout(mvdev->mdev, create_tis, in, out); in mlx5_vdpa_create_tis()
111 u32 in[MLX5_ST_SZ_DW(destroy_tis_in)] = {}; in mlx5_vdpa_destroy_tis() local
113 MLX5_SET(destroy_tis_in, in, opcode, MLX5_CMD_OP_DESTROY_TIS); in mlx5_vdpa_destroy_tis()
114 MLX5_SET(destroy_tis_in, in, uid, mvdev->res.uid); in mlx5_vdpa_destroy_tis()
115 MLX5_SET(destroy_tis_in, in, tisn, tisn); in mlx5_vdpa_destroy_tis()
116 mlx5_cmd_exec_in(mvdev->mdev, destroy_tis, in); in mlx5_vdpa_destroy_tis()
119 int mlx5_vdpa_create_rqt(struct mlx5_vdpa_dev *mvdev, void *in, int inlen, u32 *rqtn) in mlx5_vdpa_create_rqt() argument
124 MLX5_SET(create_rqt_in, in, opcode, MLX5_CMD_OP_CREATE_RQT); in mlx5_vdpa_create_rqt()
125 err = mlx5_cmd_exec(mvdev->mdev, in, inlen, out, sizeof(out)); in mlx5_vdpa_create_rqt()
132 int mlx5_vdpa_modify_rqt(struct mlx5_vdpa_dev *mvdev, void *in, int inlen, u32 rqtn) in mlx5_vdpa_modify_rqt() argument
136 MLX5_SET(modify_rqt_in, in, uid, mvdev->res.uid); in mlx5_vdpa_modify_rqt()
137 MLX5_SET(modify_rqt_in, in, rqtn, rqtn); in mlx5_vdpa_modify_rqt()
138 MLX5_SET(modify_rqt_in, in, opcode, MLX5_CMD_OP_MODIFY_RQT); in mlx5_vdpa_modify_rqt()
139 return mlx5_cmd_exec(mvdev->mdev, in, inlen, out, sizeof(out)); in mlx5_vdpa_modify_rqt()
144 u32 in[MLX5_ST_SZ_DW(destroy_rqt_in)] = {}; in mlx5_vdpa_destroy_rqt() local
146 MLX5_SET(destroy_rqt_in, in, opcode, MLX5_CMD_OP_DESTROY_RQT); in mlx5_vdpa_destroy_rqt()
147 MLX5_SET(destroy_rqt_in, in, uid, mvdev->res.uid); in mlx5_vdpa_destroy_rqt()
148 MLX5_SET(destroy_rqt_in, in, rqtn, rqtn); in mlx5_vdpa_destroy_rqt()
149 mlx5_cmd_exec_in(mvdev->mdev, destroy_rqt, in); in mlx5_vdpa_destroy_rqt()
152 int mlx5_vdpa_create_tir(struct mlx5_vdpa_dev *mvdev, void *in, u32 *tirn) in mlx5_vdpa_create_tir() argument
157 MLX5_SET(create_tir_in, in, opcode, MLX5_CMD_OP_CREATE_TIR); in mlx5_vdpa_create_tir()
158 err = mlx5_cmd_exec_inout(mvdev->mdev, create_tir, in, out); in mlx5_vdpa_create_tir()
167 u32 in[MLX5_ST_SZ_DW(destroy_tir_in)] = {}; in mlx5_vdpa_destroy_tir() local
169 MLX5_SET(destroy_tir_in, in, opcode, MLX5_CMD_OP_DESTROY_TIR); in mlx5_vdpa_destroy_tir()
170 MLX5_SET(destroy_tir_in, in, uid, mvdev->res.uid); in mlx5_vdpa_destroy_tir()
171 MLX5_SET(destroy_tir_in, in, tirn, tirn); in mlx5_vdpa_destroy_tir()
172 mlx5_cmd_exec_in(mvdev->mdev, destroy_tir, in); in mlx5_vdpa_destroy_tir()
178 u32 in[MLX5_ST_SZ_DW(alloc_transport_domain_in)] = {}; in mlx5_vdpa_alloc_transport_domain() local
181 MLX5_SET(alloc_transport_domain_in, in, opcode, MLX5_CMD_OP_ALLOC_TRANSPORT_DOMAIN); in mlx5_vdpa_alloc_transport_domain()
182 MLX5_SET(alloc_transport_domain_in, in, uid, mvdev->res.uid); in mlx5_vdpa_alloc_transport_domain()
184 err = mlx5_cmd_exec_inout(mvdev->mdev, alloc_transport_domain, in, out); in mlx5_vdpa_alloc_transport_domain()
193 u32 in[MLX5_ST_SZ_DW(dealloc_transport_domain_in)] = {}; in mlx5_vdpa_dealloc_transport_domain() local
195 MLX5_SET(dealloc_transport_domain_in, in, opcode, MLX5_CMD_OP_DEALLOC_TRANSPORT_DOMAIN); in mlx5_vdpa_dealloc_transport_domain()
196 MLX5_SET(dealloc_transport_domain_in, in, uid, mvdev->res.uid); in mlx5_vdpa_dealloc_transport_domain()
197 MLX5_SET(dealloc_transport_domain_in, in, transport_domain, tdn); in mlx5_vdpa_dealloc_transport_domain()
198 mlx5_cmd_exec_in(mvdev->mdev, dealloc_transport_domain, in); in mlx5_vdpa_dealloc_transport_domain()
201 int mlx5_vdpa_create_mkey(struct mlx5_vdpa_dev *mvdev, u32 *mkey, u32 *in, in mlx5_vdpa_create_mkey() argument
208 MLX5_SET(create_mkey_in, in, opcode, MLX5_CMD_OP_CREATE_MKEY); in mlx5_vdpa_create_mkey()
209 MLX5_SET(create_mkey_in, in, uid, mvdev->res.uid); in mlx5_vdpa_create_mkey()
211 err = mlx5_cmd_exec(mvdev->mdev, in, inlen, lout, sizeof(lout)); in mlx5_vdpa_create_mkey()
222 u32 in[MLX5_ST_SZ_DW(destroy_mkey_in)] = {}; in mlx5_vdpa_destroy_mkey() local
224 MLX5_SET(destroy_mkey_in, in, uid, mvdev->res.uid); in mlx5_vdpa_destroy_mkey()
225 MLX5_SET(destroy_mkey_in, in, opcode, MLX5_CMD_OP_DESTROY_MKEY); in mlx5_vdpa_destroy_mkey()
226 MLX5_SET(destroy_mkey_in, in, mkey_index, mlx5_mkey_to_idx(mkey)); in mlx5_vdpa_destroy_mkey()
227 return mlx5_cmd_exec_in(mvdev->mdev, destroy_mkey, in); in mlx5_vdpa_destroy_mkey()
232 mvdev->cvq.iotlb = vhost_iotlb_alloc(0, 0); in init_ctrl_vq()
233 if (!mvdev->cvq.iotlb) in init_ctrl_vq()
234 return -ENOMEM; in init_ctrl_vq()
236 spin_lock_init(&mvdev->cvq.iommu_lock); in init_ctrl_vq()
237 vringh_set_iotlb(&mvdev->cvq.vring, mvdev->cvq.iotlb, &mvdev->cvq.iommu_lock); in init_ctrl_vq()
244 vhost_iotlb_free(mvdev->cvq.iotlb); in cleanup_ctrl_vq()
249 u64 offset = MLX5_CAP64_DEV_VDPA_EMULATION(mvdev->mdev, doorbell_bar_offset); in mlx5_vdpa_alloc_resources()
250 struct mlx5_vdpa_resources *res = &mvdev->res; in mlx5_vdpa_alloc_resources()
251 struct mlx5_core_dev *mdev = mvdev->mdev; in mlx5_vdpa_alloc_resources()
255 if (res->valid) { in mlx5_vdpa_alloc_resources()
257 return -EINVAL; in mlx5_vdpa_alloc_resources()
259 res->uar = mlx5_get_uars_page(mdev); in mlx5_vdpa_alloc_resources()
260 if (IS_ERR(res->uar)) { in mlx5_vdpa_alloc_resources()
261 err = PTR_ERR(res->uar); in mlx5_vdpa_alloc_resources()
265 err = create_uctx(mvdev, &res->uid); in mlx5_vdpa_alloc_resources()
269 err = alloc_pd(mvdev, &res->pdn, res->uid); in mlx5_vdpa_alloc_resources()
273 err = get_null_mkey(mvdev, &res->null_mkey); in mlx5_vdpa_alloc_resources()
277 kick_addr = mdev->bar_addr + offset; in mlx5_vdpa_alloc_resources()
278 res->phys_kick_addr = kick_addr; in mlx5_vdpa_alloc_resources()
280 res->kick_addr = ioremap(kick_addr, PAGE_SIZE); in mlx5_vdpa_alloc_resources()
281 if (!res->kick_addr) { in mlx5_vdpa_alloc_resources()
282 err = -ENOMEM; in mlx5_vdpa_alloc_resources()
290 res->valid = true; in mlx5_vdpa_alloc_resources()
295 iounmap(res->kick_addr); in mlx5_vdpa_alloc_resources()
297 dealloc_pd(mvdev, res->pdn, res->uid); in mlx5_vdpa_alloc_resources()
299 destroy_uctx(mvdev, res->uid); in mlx5_vdpa_alloc_resources()
301 mlx5_put_uars_page(mdev, res->uar); in mlx5_vdpa_alloc_resources()
308 struct mlx5_vdpa_resources *res = &mvdev->res; in mlx5_vdpa_free_resources()
310 if (!res->valid) in mlx5_vdpa_free_resources()
314 iounmap(res->kick_addr); in mlx5_vdpa_free_resources()
315 res->kick_addr = NULL; in mlx5_vdpa_free_resources()
316 dealloc_pd(mvdev, res->pdn, res->uid); in mlx5_vdpa_free_resources()
317 destroy_uctx(mvdev, res->uid); in mlx5_vdpa_free_resources()
318 mlx5_put_uars_page(mvdev->mdev, res->uar); in mlx5_vdpa_free_resources()
319 res->valid = false; in mlx5_vdpa_free_resources()
327 cmd->err = mlx5_cmd_check(context->ctx->dev, status, cmd->in, cmd->out); in virtqueue_cmd_callback()
328 complete(&cmd->cmd_done); in virtqueue_cmd_callback()
341 err = mlx5_cmd_exec_cb(&mvdev->async_ctx, in issue_async_cmd()
342 cmd->in, cmd->inlen, in issue_async_cmd()
343 cmd->out, cmd->outlen, in issue_async_cmd()
345 &cmd->cb_work); in issue_async_cmd()
346 if (err == -EBUSY) { in issue_async_cmd()
355 err = mlx5_cmd_exec(mvdev->mdev, in issue_async_cmd()
356 cmd->in, cmd->inlen, in issue_async_cmd()
357 cmd->out, cmd->outlen); in issue_async_cmd()