Lines Matching refs:fl
142 struct fastrpc_user *fl; member
164 struct fastrpc_user *fl; member
191 struct fastrpc_user *fl; member
265 static int fastrpc_map_find(struct fastrpc_user *fl, int fd, in fastrpc_map_find() argument
270 mutex_lock(&fl->mutex); in fastrpc_map_find()
271 list_for_each_entry(map, &fl->maps, node) { in fastrpc_map_find()
275 mutex_unlock(&fl->mutex); in fastrpc_map_find()
279 mutex_unlock(&fl->mutex); in fastrpc_map_find()
291 static int fastrpc_buf_alloc(struct fastrpc_user *fl, struct device *dev, in fastrpc_buf_alloc() argument
304 buf->fl = fl; in fastrpc_buf_alloc()
319 if (fl->sctx && fl->sctx->sid) in fastrpc_buf_alloc()
320 buf->phys += ((u64)fl->sctx->sid << 32); in fastrpc_buf_alloc()
454 ctx->fl = user; in fastrpc_context_alloc()
617 static int fastrpc_map_create(struct fastrpc_user *fl, int fd, in fastrpc_map_create() argument
620 struct fastrpc_session_ctx *sess = fl->sctx; in fastrpc_map_create()
624 if (!fastrpc_map_find(fl, fd, ppmap)) in fastrpc_map_create()
632 map->fl = fl; in fastrpc_map_create()
654 map->phys += ((u64)fl->sctx->sid << 32); in fastrpc_map_create()
660 spin_lock(&fl->lock); in fastrpc_map_create()
661 list_add_tail(&map->node, &fl->maps); in fastrpc_map_create()
662 spin_unlock(&fl->lock); in fastrpc_map_create()
740 struct device *dev = ctx->fl->sctx->dev; in fastrpc_create_maps()
752 err = fastrpc_map_create(ctx->fl, ctx->args[i].fd, in fastrpc_create_maps()
765 struct device *dev = ctx->fl->sctx->dev; in fastrpc_get_args()
785 err = fastrpc_buf_alloc(ctx->fl, dev, pkt_size, &ctx->buf); in fastrpc_get_args()
915 struct fastrpc_user *fl = ctx->fl; in fastrpc_invoke_send() local
919 cctx = fl->cctx; in fastrpc_invoke_send()
920 msg->pid = fl->tgid; in fastrpc_invoke_send()
926 msg->ctx = ctx->ctxid | fl->pd; in fastrpc_invoke_send()
942 static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel, in fastrpc_internal_invoke() argument
949 if (!fl->sctx) in fastrpc_internal_invoke()
952 if (!fl->cctx->rpdev) in fastrpc_internal_invoke()
956 …dev_warn_ratelimited(fl->sctx->dev, "user app trying to send a kernel RPC message (%d)\n", handle… in fastrpc_internal_invoke()
960 ctx = fastrpc_context_alloc(fl, kernel, sc, args); in fastrpc_internal_invoke()
973 err = fastrpc_invoke_send(fl->sctx, ctx, kernel, handle); in fastrpc_internal_invoke()
1004 spin_lock(&fl->lock); in fastrpc_internal_invoke()
1006 spin_unlock(&fl->lock); in fastrpc_internal_invoke()
1010 dev_dbg(fl->sctx->dev, "Error: Invoke Failed %d\n", err); in fastrpc_internal_invoke()
1015 static int fastrpc_init_create_process(struct fastrpc_user *fl, in fastrpc_init_create_process() argument
1049 inbuf.pgid = fl->tgid; in fastrpc_init_create_process()
1055 fl->pd = USER_PD; in fastrpc_init_create_process()
1058 err = fastrpc_map_create(fl, init.filefd, init.filelen, &map); in fastrpc_init_create_process()
1065 err = fastrpc_buf_alloc(fl, fl->sctx->dev, memlen, in fastrpc_init_create_process()
1070 fl->init_mem = imem; in fastrpc_init_create_process()
1102 err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, in fastrpc_init_create_process()
1112 fl->init_mem = NULL; in fastrpc_init_create_process()
1116 spin_lock(&fl->lock); in fastrpc_init_create_process()
1118 spin_unlock(&fl->lock); in fastrpc_init_create_process()
1157 static int fastrpc_release_current_dsp_process(struct fastrpc_user *fl) in fastrpc_release_current_dsp_process() argument
1163 tgid = fl->tgid; in fastrpc_release_current_dsp_process()
1170 return fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, in fastrpc_release_current_dsp_process()
1176 struct fastrpc_user *fl = (struct fastrpc_user *)file->private_data; in fastrpc_device_release() local
1177 struct fastrpc_channel_ctx *cctx = fl->cctx; in fastrpc_device_release()
1183 fastrpc_release_current_dsp_process(fl); in fastrpc_device_release()
1186 list_del(&fl->user); in fastrpc_device_release()
1189 if (fl->init_mem) in fastrpc_device_release()
1190 fastrpc_buf_free(fl->init_mem); in fastrpc_device_release()
1192 list_for_each_entry_safe(ctx, n, &fl->pending, node) { in fastrpc_device_release()
1197 list_for_each_entry_safe(map, m, &fl->maps, node) { in fastrpc_device_release()
1202 list_for_each_entry_safe(buf, b, &fl->mmaps, node) { in fastrpc_device_release()
1207 fastrpc_session_free(cctx, fl->sctx); in fastrpc_device_release()
1210 mutex_destroy(&fl->mutex); in fastrpc_device_release()
1211 kfree(fl); in fastrpc_device_release()
1220 struct fastrpc_user *fl = NULL; in fastrpc_device_open() local
1223 fl = kzalloc(sizeof(*fl), GFP_KERNEL); in fastrpc_device_open()
1224 if (!fl) in fastrpc_device_open()
1230 filp->private_data = fl; in fastrpc_device_open()
1231 spin_lock_init(&fl->lock); in fastrpc_device_open()
1232 mutex_init(&fl->mutex); in fastrpc_device_open()
1233 INIT_LIST_HEAD(&fl->pending); in fastrpc_device_open()
1234 INIT_LIST_HEAD(&fl->maps); in fastrpc_device_open()
1235 INIT_LIST_HEAD(&fl->mmaps); in fastrpc_device_open()
1236 INIT_LIST_HEAD(&fl->user); in fastrpc_device_open()
1237 fl->tgid = current->tgid; in fastrpc_device_open()
1238 fl->cctx = cctx; in fastrpc_device_open()
1240 fl->sctx = fastrpc_session_alloc(cctx); in fastrpc_device_open()
1241 if (!fl->sctx) { in fastrpc_device_open()
1243 mutex_destroy(&fl->mutex); in fastrpc_device_open()
1244 kfree(fl); in fastrpc_device_open()
1250 list_add_tail(&fl->user, &cctx->users); in fastrpc_device_open()
1256 static int fastrpc_dmabuf_alloc(struct fastrpc_user *fl, char __user *argp) in fastrpc_dmabuf_alloc() argument
1266 err = fastrpc_buf_alloc(fl, fl->sctx->dev, bp.size, &buf); in fastrpc_dmabuf_alloc()
1301 static int fastrpc_init_attach(struct fastrpc_user *fl, int pd) in fastrpc_init_attach() argument
1304 int tgid = fl->tgid; in fastrpc_init_attach()
1312 fl->pd = pd; in fastrpc_init_attach()
1314 return fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, in fastrpc_init_attach()
1318 static int fastrpc_invoke(struct fastrpc_user *fl, char __user *argp) in fastrpc_invoke() argument
1342 err = fastrpc_internal_invoke(fl, false, inv.handle, inv.sc, args); in fastrpc_invoke()
1348 static int fastrpc_req_munmap_impl(struct fastrpc_user *fl, in fastrpc_req_munmap_impl() argument
1354 struct device *dev = fl->sctx->dev; in fastrpc_req_munmap_impl()
1358 spin_lock(&fl->lock); in fastrpc_req_munmap_impl()
1359 list_for_each_entry_safe(iter, b, &fl->mmaps, node) { in fastrpc_req_munmap_impl()
1365 spin_unlock(&fl->lock); in fastrpc_req_munmap_impl()
1372 req_msg.pgid = fl->tgid; in fastrpc_req_munmap_impl()
1380 err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, sc, in fastrpc_req_munmap_impl()
1384 spin_lock(&fl->lock); in fastrpc_req_munmap_impl()
1386 spin_unlock(&fl->lock); in fastrpc_req_munmap_impl()
1395 static int fastrpc_req_munmap(struct fastrpc_user *fl, char __user *argp) in fastrpc_req_munmap() argument
1402 return fastrpc_req_munmap_impl(fl, &req); in fastrpc_req_munmap()
1405 static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp) in fastrpc_req_mmap() argument
1414 struct device *dev = fl->sctx->dev; in fastrpc_req_mmap()
1431 err = fastrpc_buf_alloc(fl, fl->sctx->dev, req.size, &buf); in fastrpc_req_mmap()
1437 req_msg.pgid = fl->tgid; in fastrpc_req_mmap()
1455 err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, sc, in fastrpc_req_mmap()
1468 spin_lock(&fl->lock); in fastrpc_req_mmap()
1469 list_add_tail(&buf->node, &fl->mmaps); in fastrpc_req_mmap()
1470 spin_unlock(&fl->lock); in fastrpc_req_mmap()
1476 fastrpc_req_munmap_impl(fl, &req_unmap); in fastrpc_req_mmap()
1494 struct fastrpc_user *fl = (struct fastrpc_user *)file->private_data; in fastrpc_device_ioctl() local
1500 err = fastrpc_invoke(fl, argp); in fastrpc_device_ioctl()
1503 err = fastrpc_init_attach(fl, AUDIO_PD); in fastrpc_device_ioctl()
1506 err = fastrpc_init_attach(fl, SENSORS_PD); in fastrpc_device_ioctl()
1509 err = fastrpc_init_create_process(fl, argp); in fastrpc_device_ioctl()
1512 err = fastrpc_dmabuf_alloc(fl, argp); in fastrpc_device_ioctl()
1515 err = fastrpc_req_mmap(fl, argp); in fastrpc_device_ioctl()
1518 err = fastrpc_req_munmap(fl, argp); in fastrpc_device_ioctl()