Lines Matching refs:fl

179 	struct fastrpc_user *fl;  member
201 struct fastrpc_user *fl; member
230 struct fastrpc_user *fl; member
306 &(map->fl->cctx->vmperms[0].vmid), &perm, 1); in fastrpc_free_map()
308 dev_err(map->fl->sctx->dev, "Failed to assign memory phys 0x%llx size 0x%llx err %d", in fastrpc_free_map()
335 static int fastrpc_map_lookup(struct fastrpc_user *fl, int fd, in fastrpc_map_lookup() argument
340 mutex_lock(&fl->mutex); in fastrpc_map_lookup()
341 list_for_each_entry(map, &fl->maps, node) { in fastrpc_map_lookup()
344 mutex_unlock(&fl->mutex); in fastrpc_map_lookup()
348 mutex_unlock(&fl->mutex); in fastrpc_map_lookup()
353 static int fastrpc_map_find(struct fastrpc_user *fl, int fd, in fastrpc_map_find() argument
356 int ret = fastrpc_map_lookup(fl, fd, ppmap); in fastrpc_map_find()
371 static int fastrpc_buf_alloc(struct fastrpc_user *fl, struct device *dev, in fastrpc_buf_alloc() argument
384 buf->fl = fl; in fastrpc_buf_alloc()
399 if (fl->sctx && fl->sctx->sid) in fastrpc_buf_alloc()
400 buf->phys += ((u64)fl->sctx->sid << 32); in fastrpc_buf_alloc()
534 ctx->fl = user; in fastrpc_context_alloc()
699 static int fastrpc_map_create(struct fastrpc_user *fl, int fd, in fastrpc_map_create() argument
702 struct fastrpc_session_ctx *sess = fl->sctx; in fastrpc_map_create()
706 if (!fastrpc_map_find(fl, fd, ppmap)) in fastrpc_map_create()
714 map->fl = fl; in fastrpc_map_create()
736 map->phys += ((u64)fl->sctx->sid << 32); in fastrpc_map_create()
751 fl->cctx->vmperms, fl->cctx->vmcount); in fastrpc_map_create()
758 spin_lock(&fl->lock); in fastrpc_map_create()
759 list_add_tail(&map->node, &fl->maps); in fastrpc_map_create()
760 spin_unlock(&fl->lock); in fastrpc_map_create()
838 struct device *dev = ctx->fl->sctx->dev; in fastrpc_create_maps()
847 err = fastrpc_map_create(ctx->fl, ctx->args[i].fd, in fastrpc_create_maps()
870 struct device *dev = ctx->fl->sctx->dev; in fastrpc_get_args()
890 err = fastrpc_buf_alloc(ctx->fl, dev, pkt_size, &ctx->buf); in fastrpc_get_args()
997 struct fastrpc_user *fl = ctx->fl; in fastrpc_put_args() local
1029 if (!fastrpc_map_lookup(fl, (int)fdlist[i], &mmap)) in fastrpc_put_args()
1041 struct fastrpc_user *fl = ctx->fl; in fastrpc_invoke_send() local
1045 cctx = fl->cctx; in fastrpc_invoke_send()
1046 msg->pid = fl->tgid; in fastrpc_invoke_send()
1052 msg->ctx = ctx->ctxid | fl->pd; in fastrpc_invoke_send()
1068 static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel, in fastrpc_internal_invoke() argument
1075 if (!fl->sctx) in fastrpc_internal_invoke()
1078 if (!fl->cctx->rpdev) in fastrpc_internal_invoke()
1082 …dev_warn_ratelimited(fl->sctx->dev, "user app trying to send a kernel RPC message (%d)\n", handle… in fastrpc_internal_invoke()
1086 ctx = fastrpc_context_alloc(fl, kernel, sc, args); in fastrpc_internal_invoke()
1099 err = fastrpc_invoke_send(fl->sctx, ctx, kernel, handle); in fastrpc_internal_invoke()
1130 spin_lock(&fl->lock); in fastrpc_internal_invoke()
1132 spin_unlock(&fl->lock); in fastrpc_internal_invoke()
1136 dev_dbg(fl->sctx->dev, "Error: Invoke Failed %d\n", err); in fastrpc_internal_invoke()
1141 static bool is_session_rejected(struct fastrpc_user *fl, bool unsigned_pd_request) in is_session_rejected() argument
1144 if (!fl->is_secure_dev && fl->cctx->secure) { in is_session_rejected()
1150 if (!fl->cctx->unsigned_support || !unsigned_pd_request) { in is_session_rejected()
1151 dev_err(&fl->cctx->rpdev->dev, "Error: Untrusted application trying to offload to signed PD"); in is_session_rejected()
1159 static int fastrpc_init_create_process(struct fastrpc_user *fl, in fastrpc_init_create_process() argument
1192 if (is_session_rejected(fl, unsigned_module)) { in fastrpc_init_create_process()
1202 inbuf.pgid = fl->tgid; in fastrpc_init_create_process()
1208 fl->pd = USER_PD; in fastrpc_init_create_process()
1211 err = fastrpc_map_create(fl, init.filefd, init.filelen, 0, &map); in fastrpc_init_create_process()
1218 err = fastrpc_buf_alloc(fl, fl->sctx->dev, memlen, in fastrpc_init_create_process()
1223 fl->init_mem = imem; in fastrpc_init_create_process()
1255 err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, in fastrpc_init_create_process()
1265 fl->init_mem = NULL; in fastrpc_init_create_process()
1269 spin_lock(&fl->lock); in fastrpc_init_create_process()
1271 spin_unlock(&fl->lock); in fastrpc_init_create_process()
1310 static int fastrpc_release_current_dsp_process(struct fastrpc_user *fl) in fastrpc_release_current_dsp_process() argument
1316 tgid = fl->tgid; in fastrpc_release_current_dsp_process()
1322 return fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, in fastrpc_release_current_dsp_process()
1328 struct fastrpc_user *fl = (struct fastrpc_user *)file->private_data; in fastrpc_device_release() local
1329 struct fastrpc_channel_ctx *cctx = fl->cctx; in fastrpc_device_release()
1335 fastrpc_release_current_dsp_process(fl); in fastrpc_device_release()
1338 list_del(&fl->user); in fastrpc_device_release()
1341 if (fl->init_mem) in fastrpc_device_release()
1342 fastrpc_buf_free(fl->init_mem); in fastrpc_device_release()
1344 list_for_each_entry_safe(ctx, n, &fl->pending, node) { in fastrpc_device_release()
1349 list_for_each_entry_safe(map, m, &fl->maps, node) { in fastrpc_device_release()
1354 list_for_each_entry_safe(buf, b, &fl->mmaps, node) { in fastrpc_device_release()
1359 fastrpc_session_free(cctx, fl->sctx); in fastrpc_device_release()
1362 mutex_destroy(&fl->mutex); in fastrpc_device_release()
1363 kfree(fl); in fastrpc_device_release()
1373 struct fastrpc_user *fl = NULL; in fastrpc_device_open() local
1379 fl = kzalloc(sizeof(*fl), GFP_KERNEL); in fastrpc_device_open()
1380 if (!fl) in fastrpc_device_open()
1386 filp->private_data = fl; in fastrpc_device_open()
1387 spin_lock_init(&fl->lock); in fastrpc_device_open()
1388 mutex_init(&fl->mutex); in fastrpc_device_open()
1389 INIT_LIST_HEAD(&fl->pending); in fastrpc_device_open()
1390 INIT_LIST_HEAD(&fl->maps); in fastrpc_device_open()
1391 INIT_LIST_HEAD(&fl->mmaps); in fastrpc_device_open()
1392 INIT_LIST_HEAD(&fl->user); in fastrpc_device_open()
1393 fl->tgid = current->tgid; in fastrpc_device_open()
1394 fl->cctx = cctx; in fastrpc_device_open()
1395 fl->is_secure_dev = fdevice->secure; in fastrpc_device_open()
1397 fl->sctx = fastrpc_session_alloc(cctx); in fastrpc_device_open()
1398 if (!fl->sctx) { in fastrpc_device_open()
1400 mutex_destroy(&fl->mutex); in fastrpc_device_open()
1401 kfree(fl); in fastrpc_device_open()
1407 list_add_tail(&fl->user, &cctx->users); in fastrpc_device_open()
1413 static int fastrpc_dmabuf_alloc(struct fastrpc_user *fl, char __user *argp) in fastrpc_dmabuf_alloc() argument
1423 err = fastrpc_buf_alloc(fl, fl->sctx->dev, bp.size, &buf); in fastrpc_dmabuf_alloc()
1458 static int fastrpc_init_attach(struct fastrpc_user *fl, int pd) in fastrpc_init_attach() argument
1461 int tgid = fl->tgid; in fastrpc_init_attach()
1468 fl->pd = pd; in fastrpc_init_attach()
1470 return fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, in fastrpc_init_attach()
1474 static int fastrpc_invoke(struct fastrpc_user *fl, char __user *argp) in fastrpc_invoke() argument
1498 err = fastrpc_internal_invoke(fl, false, inv.handle, inv.sc, args); in fastrpc_invoke()
1504 static int fastrpc_get_info_from_dsp(struct fastrpc_user *fl, uint32_t *dsp_attr_buf, in fastrpc_get_info_from_dsp() argument
1518 fl->pd = USER_PD; in fastrpc_get_info_from_dsp()
1520 return fastrpc_internal_invoke(fl, true, FASTRPC_DSP_UTILITIES_HANDLE, in fastrpc_get_info_from_dsp()
1525 struct fastrpc_user *fl) in fastrpc_get_info_from_kernel() argument
1527 struct fastrpc_channel_ctx *cctx = fl->cctx; in fastrpc_get_info_from_kernel()
1546 err = fastrpc_get_info_from_dsp(fl, dsp_attributes, FASTRPC_MAX_DSP_ATTRIBUTES_LEN); in fastrpc_get_info_from_kernel()
1568 static int fastrpc_get_dsp_info(struct fastrpc_user *fl, char __user *argp) in fastrpc_get_dsp_info() argument
1578 dev_err(&fl->cctx->rpdev->dev, "Error: Invalid domain id:%d, err:%d\n", in fastrpc_get_dsp_info()
1585 dev_err(&fl->cctx->rpdev->dev, "Error: modem not supported %d\n", err); in fastrpc_get_dsp_info()
1590 dev_err(&fl->cctx->rpdev->dev, "Error: invalid attribute: %d, err: %d\n", in fastrpc_get_dsp_info()
1595 err = fastrpc_get_info_from_kernel(&cap, fl); in fastrpc_get_dsp_info()
1605 static int fastrpc_req_munmap_impl(struct fastrpc_user *fl, in fastrpc_req_munmap_impl() argument
1611 struct device *dev = fl->sctx->dev; in fastrpc_req_munmap_impl()
1615 spin_lock(&fl->lock); in fastrpc_req_munmap_impl()
1616 list_for_each_entry_safe(iter, b, &fl->mmaps, node) { in fastrpc_req_munmap_impl()
1622 spin_unlock(&fl->lock); in fastrpc_req_munmap_impl()
1629 req_msg.pgid = fl->tgid; in fastrpc_req_munmap_impl()
1637 err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, sc, in fastrpc_req_munmap_impl()
1641 spin_lock(&fl->lock); in fastrpc_req_munmap_impl()
1643 spin_unlock(&fl->lock); in fastrpc_req_munmap_impl()
1652 static int fastrpc_req_munmap(struct fastrpc_user *fl, char __user *argp) in fastrpc_req_munmap() argument
1659 return fastrpc_req_munmap_impl(fl, &req); in fastrpc_req_munmap()
1662 static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp) in fastrpc_req_mmap() argument
1671 struct device *dev = fl->sctx->dev; in fastrpc_req_mmap()
1688 err = fastrpc_buf_alloc(fl, fl->sctx->dev, req.size, &buf); in fastrpc_req_mmap()
1694 req_msg.pgid = fl->tgid; in fastrpc_req_mmap()
1712 err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, sc, in fastrpc_req_mmap()
1725 spin_lock(&fl->lock); in fastrpc_req_mmap()
1726 list_add_tail(&buf->node, &fl->mmaps); in fastrpc_req_mmap()
1727 spin_unlock(&fl->lock); in fastrpc_req_mmap()
1733 fastrpc_req_munmap_impl(fl, &req_unmap); in fastrpc_req_mmap()
1748 static int fastrpc_req_mem_unmap_impl(struct fastrpc_user *fl, struct fastrpc_mem_unmap *req) in fastrpc_req_mem_unmap_impl() argument
1755 struct device *dev = fl->sctx->dev; in fastrpc_req_mem_unmap_impl()
1757 spin_lock(&fl->lock); in fastrpc_req_mem_unmap_impl()
1758 list_for_each_entry_safe(iter, m, &fl->maps, node) { in fastrpc_req_mem_unmap_impl()
1765 spin_unlock(&fl->lock); in fastrpc_req_mem_unmap_impl()
1772 req_msg.pgid = fl->tgid; in fastrpc_req_mem_unmap_impl()
1781 err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, sc, in fastrpc_req_mem_unmap_impl()
1790 static int fastrpc_req_mem_unmap(struct fastrpc_user *fl, char __user *argp) in fastrpc_req_mem_unmap() argument
1797 return fastrpc_req_mem_unmap_impl(fl, &req); in fastrpc_req_mem_unmap()
1800 static int fastrpc_req_mem_map(struct fastrpc_user *fl, char __user *argp) in fastrpc_req_mem_map() argument
1808 struct device *dev = fl->sctx->dev; in fastrpc_req_mem_map()
1817 err = fastrpc_map_create(fl, req.fd, req.length, 0, &map); in fastrpc_req_mem_map()
1823 req_msg.pgid = fl->tgid; in fastrpc_req_mem_map()
1848 err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, sc, &args[0]); in fastrpc_req_mem_map()
1865 fastrpc_req_mem_unmap_impl(fl, &req_unmap); in fastrpc_req_mem_map()
1880 struct fastrpc_user *fl = (struct fastrpc_user *)file->private_data; in fastrpc_device_ioctl() local
1886 err = fastrpc_invoke(fl, argp); in fastrpc_device_ioctl()
1889 err = fastrpc_init_attach(fl, AUDIO_PD); in fastrpc_device_ioctl()
1892 err = fastrpc_init_attach(fl, SENSORS_PD); in fastrpc_device_ioctl()
1895 err = fastrpc_init_create_process(fl, argp); in fastrpc_device_ioctl()
1898 err = fastrpc_dmabuf_alloc(fl, argp); in fastrpc_device_ioctl()
1901 err = fastrpc_req_mmap(fl, argp); in fastrpc_device_ioctl()
1904 err = fastrpc_req_munmap(fl, argp); in fastrpc_device_ioctl()
1907 err = fastrpc_req_mem_map(fl, argp); in fastrpc_device_ioctl()
1910 err = fastrpc_req_mem_unmap(fl, argp); in fastrpc_device_ioctl()
1913 err = fastrpc_get_dsp_info(fl, argp); in fastrpc_device_ioctl()