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()
619 static int fastrpc_map_create(struct fastrpc_user *fl, int fd, in fastrpc_map_create() argument
622 struct fastrpc_session_ctx *sess = fl->sctx; in fastrpc_map_create()
626 if (!fastrpc_map_find(fl, fd, ppmap)) in fastrpc_map_create()
634 map->fl = fl; in fastrpc_map_create()
656 map->phys += ((u64)fl->sctx->sid << 32); in fastrpc_map_create()
662 spin_lock(&fl->lock); in fastrpc_map_create()
663 list_add_tail(&map->node, &fl->maps); in fastrpc_map_create()
664 spin_unlock(&fl->lock); in fastrpc_map_create()
742 struct device *dev = ctx->fl->sctx->dev; in fastrpc_create_maps()
754 err = fastrpc_map_create(ctx->fl, ctx->args[i].fd, in fastrpc_create_maps()
767 struct device *dev = ctx->fl->sctx->dev; in fastrpc_get_args()
787 err = fastrpc_buf_alloc(ctx->fl, dev, pkt_size, &ctx->buf); in fastrpc_get_args()
919 struct fastrpc_user *fl = ctx->fl; in fastrpc_invoke_send() local
923 cctx = fl->cctx; in fastrpc_invoke_send()
924 msg->pid = fl->tgid; in fastrpc_invoke_send()
930 msg->ctx = ctx->ctxid | fl->pd; in fastrpc_invoke_send()
946 static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel, in fastrpc_internal_invoke() argument
953 if (!fl->sctx) in fastrpc_internal_invoke()
956 if (!fl->cctx->rpdev) in fastrpc_internal_invoke()
960 …dev_warn_ratelimited(fl->sctx->dev, "user app trying to send a kernel RPC message (%d)\n", handle… in fastrpc_internal_invoke()
964 ctx = fastrpc_context_alloc(fl, kernel, sc, args); in fastrpc_internal_invoke()
977 err = fastrpc_invoke_send(fl->sctx, ctx, kernel, handle); in fastrpc_internal_invoke()
1008 spin_lock(&fl->lock); in fastrpc_internal_invoke()
1010 spin_unlock(&fl->lock); in fastrpc_internal_invoke()
1014 dev_dbg(fl->sctx->dev, "Error: Invoke Failed %d\n", err); in fastrpc_internal_invoke()
1019 static int fastrpc_init_create_process(struct fastrpc_user *fl, in fastrpc_init_create_process() argument
1053 inbuf.pgid = fl->tgid; in fastrpc_init_create_process()
1059 fl->pd = USER_PD; in fastrpc_init_create_process()
1062 err = fastrpc_map_create(fl, init.filefd, init.filelen, &map); in fastrpc_init_create_process()
1069 err = fastrpc_buf_alloc(fl, fl->sctx->dev, memlen, in fastrpc_init_create_process()
1074 fl->init_mem = imem; in fastrpc_init_create_process()
1106 err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, in fastrpc_init_create_process()
1116 fl->init_mem = NULL; in fastrpc_init_create_process()
1120 spin_lock(&fl->lock); in fastrpc_init_create_process()
1122 spin_unlock(&fl->lock); in fastrpc_init_create_process()
1161 static int fastrpc_release_current_dsp_process(struct fastrpc_user *fl) in fastrpc_release_current_dsp_process() argument
1167 tgid = fl->tgid; in fastrpc_release_current_dsp_process()
1174 return fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, in fastrpc_release_current_dsp_process()
1180 struct fastrpc_user *fl = (struct fastrpc_user *)file->private_data; in fastrpc_device_release() local
1181 struct fastrpc_channel_ctx *cctx = fl->cctx; in fastrpc_device_release()
1187 fastrpc_release_current_dsp_process(fl); in fastrpc_device_release()
1190 list_del(&fl->user); in fastrpc_device_release()
1193 if (fl->init_mem) in fastrpc_device_release()
1194 fastrpc_buf_free(fl->init_mem); in fastrpc_device_release()
1196 list_for_each_entry_safe(ctx, n, &fl->pending, node) { in fastrpc_device_release()
1201 list_for_each_entry_safe(map, m, &fl->maps, node) { in fastrpc_device_release()
1206 list_for_each_entry_safe(buf, b, &fl->mmaps, node) { in fastrpc_device_release()
1211 fastrpc_session_free(cctx, fl->sctx); in fastrpc_device_release()
1214 mutex_destroy(&fl->mutex); in fastrpc_device_release()
1215 kfree(fl); in fastrpc_device_release()
1224 struct fastrpc_user *fl = NULL; in fastrpc_device_open() local
1227 fl = kzalloc(sizeof(*fl), GFP_KERNEL); in fastrpc_device_open()
1228 if (!fl) in fastrpc_device_open()
1234 filp->private_data = fl; in fastrpc_device_open()
1235 spin_lock_init(&fl->lock); in fastrpc_device_open()
1236 mutex_init(&fl->mutex); in fastrpc_device_open()
1237 INIT_LIST_HEAD(&fl->pending); in fastrpc_device_open()
1238 INIT_LIST_HEAD(&fl->maps); in fastrpc_device_open()
1239 INIT_LIST_HEAD(&fl->mmaps); in fastrpc_device_open()
1240 INIT_LIST_HEAD(&fl->user); in fastrpc_device_open()
1241 fl->tgid = current->tgid; in fastrpc_device_open()
1242 fl->cctx = cctx; in fastrpc_device_open()
1244 fl->sctx = fastrpc_session_alloc(cctx); in fastrpc_device_open()
1245 if (!fl->sctx) { in fastrpc_device_open()
1247 mutex_destroy(&fl->mutex); in fastrpc_device_open()
1248 kfree(fl); in fastrpc_device_open()
1254 list_add_tail(&fl->user, &cctx->users); in fastrpc_device_open()
1260 static int fastrpc_dmabuf_alloc(struct fastrpc_user *fl, char __user *argp) in fastrpc_dmabuf_alloc() argument
1270 err = fastrpc_buf_alloc(fl, fl->sctx->dev, bp.size, &buf); in fastrpc_dmabuf_alloc()
1298 static int fastrpc_init_attach(struct fastrpc_user *fl, int pd) in fastrpc_init_attach() argument
1301 int tgid = fl->tgid; in fastrpc_init_attach()
1309 fl->pd = pd; in fastrpc_init_attach()
1311 return fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, in fastrpc_init_attach()
1315 static int fastrpc_invoke(struct fastrpc_user *fl, char __user *argp) in fastrpc_invoke() argument
1339 err = fastrpc_internal_invoke(fl, false, inv.handle, inv.sc, args); in fastrpc_invoke()
1345 static int fastrpc_req_munmap_impl(struct fastrpc_user *fl, in fastrpc_req_munmap_impl() argument
1351 struct device *dev = fl->sctx->dev; in fastrpc_req_munmap_impl()
1355 spin_lock(&fl->lock); in fastrpc_req_munmap_impl()
1356 list_for_each_entry_safe(buf, b, &fl->mmaps, node) { in fastrpc_req_munmap_impl()
1361 spin_unlock(&fl->lock); in fastrpc_req_munmap_impl()
1368 req_msg.pgid = fl->tgid; in fastrpc_req_munmap_impl()
1376 err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, sc, in fastrpc_req_munmap_impl()
1380 spin_lock(&fl->lock); in fastrpc_req_munmap_impl()
1382 spin_unlock(&fl->lock); in fastrpc_req_munmap_impl()
1391 static int fastrpc_req_munmap(struct fastrpc_user *fl, char __user *argp) in fastrpc_req_munmap() argument
1398 return fastrpc_req_munmap_impl(fl, &req); in fastrpc_req_munmap()
1401 static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp) in fastrpc_req_mmap() argument
1410 struct device *dev = fl->sctx->dev; in fastrpc_req_mmap()
1427 err = fastrpc_buf_alloc(fl, fl->sctx->dev, req.size, &buf); in fastrpc_req_mmap()
1433 req_msg.pgid = fl->tgid; in fastrpc_req_mmap()
1451 err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, sc, in fastrpc_req_mmap()
1464 spin_lock(&fl->lock); in fastrpc_req_mmap()
1465 list_add_tail(&buf->node, &fl->mmaps); in fastrpc_req_mmap()
1466 spin_unlock(&fl->lock); in fastrpc_req_mmap()
1472 fastrpc_req_munmap_impl(fl, &req_unmap); in fastrpc_req_mmap()
1490 struct fastrpc_user *fl = (struct fastrpc_user *)file->private_data; in fastrpc_device_ioctl() local
1496 err = fastrpc_invoke(fl, argp); in fastrpc_device_ioctl()
1499 err = fastrpc_init_attach(fl, AUDIO_PD); in fastrpc_device_ioctl()
1502 err = fastrpc_init_attach(fl, SENSORS_PD); in fastrpc_device_ioctl()
1505 err = fastrpc_init_create_process(fl, argp); in fastrpc_device_ioctl()
1508 err = fastrpc_dmabuf_alloc(fl, argp); in fastrpc_device_ioctl()
1511 err = fastrpc_req_mmap(fl, argp); in fastrpc_device_ioctl()
1514 err = fastrpc_req_munmap(fl, argp); in fastrpc_device_ioctl()