Lines Matching refs:cctx

252 	struct fastrpc_channel_ctx *cctx;  member
286 struct fastrpc_channel_ctx *cctx; member
297 struct fastrpc_channel_ctx *cctx; member
319 int vmid = map->fl->cctx->vmperms[0].vmid; in fastrpc_free_map()
455 struct device *rdev = &fl->cctx->rpdev->dev; in fastrpc_remote_heap_alloc()
462 struct fastrpc_channel_ctx *cctx; in fastrpc_channel_ctx_free() local
464 cctx = container_of(ref, struct fastrpc_channel_ctx, refcount); in fastrpc_channel_ctx_free()
466 kfree(cctx); in fastrpc_channel_ctx_free()
469 static void fastrpc_channel_ctx_get(struct fastrpc_channel_ctx *cctx) in fastrpc_channel_ctx_get() argument
471 kref_get(&cctx->refcount); in fastrpc_channel_ctx_get()
474 static void fastrpc_channel_ctx_put(struct fastrpc_channel_ctx *cctx) in fastrpc_channel_ctx_put() argument
476 kref_put(&cctx->refcount, fastrpc_channel_ctx_free); in fastrpc_channel_ctx_put()
482 struct fastrpc_channel_ctx *cctx; in fastrpc_context_free() local
487 cctx = ctx->cctx; in fastrpc_context_free()
495 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_context_free()
496 idr_remove(&cctx->ctx_idr, ctx->ctxid >> 4); in fastrpc_context_free()
497 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_context_free()
503 fastrpc_channel_ctx_put(cctx); in fastrpc_context_free()
577 struct fastrpc_channel_ctx *cctx = user->cctx; in fastrpc_context_alloc() local
611 fastrpc_channel_ctx_get(cctx); in fastrpc_context_alloc()
617 ctx->cctx = cctx; in fastrpc_context_alloc()
625 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_context_alloc()
626 ret = idr_alloc_cyclic(&cctx->ctx_idr, ctx, 1, in fastrpc_context_alloc()
629 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_context_alloc()
633 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_context_alloc()
642 fastrpc_channel_ctx_put(cctx); in fastrpc_context_alloc()
814 dst_perms[1].vmid = fl->cctx->vmperms[0].vmid; in fastrpc_map_create()
1108 struct fastrpc_channel_ctx *cctx; in fastrpc_invoke_send() local
1113 cctx = fl->cctx; in fastrpc_invoke_send()
1127 ret = rpmsg_send(cctx->rpdev->ept, (void *)msg, sizeof(*msg)); in fastrpc_invoke_send()
1148 if (!fl->cctx->rpdev) in fastrpc_internal_invoke()
1205 list_add_tail(&buf->node, &fl->cctx->invoke_interrupted_mmaps); in fastrpc_internal_invoke()
1218 if (!fl->is_secure_dev && fl->cctx->secure) { in is_session_rejected()
1224 if (!fl->cctx->unsigned_support || !unsigned_pd_request) { in is_session_rejected()
1225 dev_err(&fl->cctx->rpdev->dev, "Error: Untrusted application trying to offload to signed PD"); in is_session_rejected()
1274 if (!fl->cctx->remote_heap) { in fastrpc_init_create_static_process()
1276 &fl->cctx->remote_heap); in fastrpc_init_create_static_process()
1281 if (fl->cctx->vmcount) { in fastrpc_init_create_static_process()
1284 err = qcom_scm_assign_mem(fl->cctx->remote_heap->phys, in fastrpc_init_create_static_process()
1285 (u64)fl->cctx->remote_heap->size, in fastrpc_init_create_static_process()
1287 fl->cctx->vmperms, fl->cctx->vmcount); in fastrpc_init_create_static_process()
1290 fl->cctx->remote_heap->phys, fl->cctx->remote_heap->size, err); in fastrpc_init_create_static_process()
1310 pages[0].addr = fl->cctx->remote_heap->phys; in fastrpc_init_create_static_process()
1311 pages[0].size = fl->cctx->remote_heap->size; in fastrpc_init_create_static_process()
1329 if (fl->cctx->vmcount && scm_done) { in fastrpc_init_create_static_process()
1334 for (i = 0; i < fl->cctx->vmcount; i++) in fastrpc_init_create_static_process()
1335 src_perms |= BIT(fl->cctx->vmperms[i].vmid); in fastrpc_init_create_static_process()
1339 err = qcom_scm_assign_mem(fl->cctx->remote_heap->phys, in fastrpc_init_create_static_process()
1340 (u64)fl->cctx->remote_heap->size, in fastrpc_init_create_static_process()
1344 fl->cctx->remote_heap->phys, fl->cctx->remote_heap->size, err); in fastrpc_init_create_static_process()
1347 fastrpc_buf_free(fl->cctx->remote_heap); in fastrpc_init_create_static_process()
1473 struct fastrpc_channel_ctx *cctx) in fastrpc_session_alloc() argument
1479 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_session_alloc()
1480 for (i = 0; i < cctx->sesscount; i++) { in fastrpc_session_alloc()
1481 if (!cctx->session[i].used && cctx->session[i].valid) { in fastrpc_session_alloc()
1482 cctx->session[i].used = true; in fastrpc_session_alloc()
1483 session = &cctx->session[i]; in fastrpc_session_alloc()
1487 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_session_alloc()
1492 static void fastrpc_session_free(struct fastrpc_channel_ctx *cctx, in fastrpc_session_free() argument
1497 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_session_free()
1499 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_session_free()
1521 struct fastrpc_channel_ctx *cctx = fl->cctx; in fastrpc_device_release() local
1529 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_device_release()
1531 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_device_release()
1549 fastrpc_session_free(cctx, fl->sctx); in fastrpc_device_release()
1550 fastrpc_channel_ctx_put(cctx); in fastrpc_device_release()
1561 struct fastrpc_channel_ctx *cctx; in fastrpc_device_open() local
1567 cctx = fdevice->cctx; in fastrpc_device_open()
1574 fastrpc_channel_ctx_get(cctx); in fastrpc_device_open()
1584 fl->cctx = cctx; in fastrpc_device_open()
1587 fl->sctx = fastrpc_session_alloc(cctx); in fastrpc_device_open()
1589 dev_err(&cctx->rpdev->dev, "No session available\n"); in fastrpc_device_open()
1596 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_device_open()
1597 list_add_tail(&fl->user, &cctx->users); in fastrpc_device_open()
1598 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_device_open()
1721 struct fastrpc_channel_ctx *cctx = fl->cctx; in fastrpc_get_info_from_kernel() local
1728 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_get_info_from_kernel()
1730 if (cctx->valid_attributes) { in fastrpc_get_info_from_kernel()
1731 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_get_info_from_kernel()
1734 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_get_info_from_kernel()
1742 dev_info(&cctx->rpdev->dev, in fastrpc_get_info_from_kernel()
1747 dev_err(&cctx->rpdev->dev, "Error: dsp information is incorrect err: %d\n", err); in fastrpc_get_info_from_kernel()
1752 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_get_info_from_kernel()
1753 memcpy(cctx->dsp_attributes, dsp_attributes, FASTRPC_MAX_DSP_ATTRIBUTES_LEN); in fastrpc_get_info_from_kernel()
1754 cctx->valid_attributes = true; in fastrpc_get_info_from_kernel()
1755 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_get_info_from_kernel()
1758 cap->capability = cctx->dsp_attributes[attribute_id]; in fastrpc_get_info_from_kernel()
1772 dev_err(&fl->cctx->rpdev->dev, "Error: Invalid domain id:%d, err:%d\n", in fastrpc_get_dsp_info()
1779 dev_err(&fl->cctx->rpdev->dev, "Error: modem not supported %d\n", err); in fastrpc_get_dsp_info()
1784 dev_err(&fl->cctx->rpdev->dev, "Error: invalid attribute: %d, err: %d\n", in fastrpc_get_dsp_info()
1926 if (req.flags == ADSP_MMAP_REMOTE_HEAP_ADDR && fl->cctx->vmcount) { in fastrpc_req_mmap()
1930 &src_perms, fl->cctx->vmperms, fl->cctx->vmcount); in fastrpc_req_mmap()
2147 struct fastrpc_channel_ctx *cctx; in fastrpc_cb_probe() local
2154 cctx = dev_get_drvdata(dev->parent); in fastrpc_cb_probe()
2155 if (!cctx) in fastrpc_cb_probe()
2160 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_cb_probe()
2161 if (cctx->sesscount >= FASTRPC_MAX_SESSIONS) { in fastrpc_cb_probe()
2163 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_probe()
2166 sess = &cctx->session[cctx->sesscount++]; in fastrpc_cb_probe()
2179 if (cctx->sesscount >= FASTRPC_MAX_SESSIONS) in fastrpc_cb_probe()
2181 dup_sess = &cctx->session[cctx->sesscount++]; in fastrpc_cb_probe()
2185 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_probe()
2197 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(pdev->dev.parent); in fastrpc_cb_remove() local
2202 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_cb_remove()
2204 if (cctx->session[i].sid == sess->sid) { in fastrpc_cb_remove()
2205 cctx->session[i].valid = false; in fastrpc_cb_remove()
2206 cctx->sesscount--; in fastrpc_cb_remove()
2209 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_remove()
2229 static int fastrpc_device_register(struct device *dev, struct fastrpc_channel_ctx *cctx, in fastrpc_device_register() argument
2240 fdev->cctx = cctx; in fastrpc_device_register()
2251 cctx->secure_fdevice = fdev; in fastrpc_device_register()
2253 cctx->fdevice = fdev; in fastrpc_device_register()
2380 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(&rpdev->dev); in fastrpc_rpmsg_remove() local
2386 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_rpmsg_remove()
2387 cctx->rpdev = NULL; in fastrpc_rpmsg_remove()
2388 list_for_each_entry(user, &cctx->users, user) in fastrpc_rpmsg_remove()
2390 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_rpmsg_remove()
2392 if (cctx->fdevice) in fastrpc_rpmsg_remove()
2393 misc_deregister(&cctx->fdevice->miscdev); in fastrpc_rpmsg_remove()
2395 if (cctx->secure_fdevice) in fastrpc_rpmsg_remove()
2396 misc_deregister(&cctx->secure_fdevice->miscdev); in fastrpc_rpmsg_remove()
2398 list_for_each_entry_safe(buf, b, &cctx->invoke_interrupted_mmaps, node) in fastrpc_rpmsg_remove()
2401 if (cctx->remote_heap) in fastrpc_rpmsg_remove()
2402 fastrpc_buf_free(cctx->remote_heap); in fastrpc_rpmsg_remove()
2406 fastrpc_channel_ctx_put(cctx); in fastrpc_rpmsg_remove()
2412 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(&rpdev->dev); in fastrpc_rpmsg_callback() local
2423 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_rpmsg_callback()
2424 ctx = idr_find(&cctx->ctx_idr, ctxid); in fastrpc_rpmsg_callback()
2425 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_rpmsg_callback()