Lines Matching refs:cctx
253 struct fastrpc_channel_ctx *cctx; member
287 struct fastrpc_channel_ctx *cctx; member
298 struct fastrpc_channel_ctx *cctx; member
320 int vmid = map->fl->cctx->vmperms[0].vmid; in fastrpc_free_map()
456 struct device *rdev = &fl->cctx->rpdev->dev; in fastrpc_remote_heap_alloc()
463 struct fastrpc_channel_ctx *cctx; in fastrpc_channel_ctx_free() local
465 cctx = container_of(ref, struct fastrpc_channel_ctx, refcount); in fastrpc_channel_ctx_free()
467 kfree(cctx); in fastrpc_channel_ctx_free()
470 static void fastrpc_channel_ctx_get(struct fastrpc_channel_ctx *cctx) in fastrpc_channel_ctx_get() argument
472 kref_get(&cctx->refcount); in fastrpc_channel_ctx_get()
475 static void fastrpc_channel_ctx_put(struct fastrpc_channel_ctx *cctx) in fastrpc_channel_ctx_put() argument
477 kref_put(&cctx->refcount, fastrpc_channel_ctx_free); in fastrpc_channel_ctx_put()
483 struct fastrpc_channel_ctx *cctx; in fastrpc_context_free() local
488 cctx = ctx->cctx; in fastrpc_context_free()
496 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_context_free()
497 idr_remove(&cctx->ctx_idr, ctx->ctxid >> 4); in fastrpc_context_free()
498 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_context_free()
504 fastrpc_channel_ctx_put(cctx); in fastrpc_context_free()
578 struct fastrpc_channel_ctx *cctx = user->cctx; in fastrpc_context_alloc() local
612 fastrpc_channel_ctx_get(cctx); in fastrpc_context_alloc()
618 ctx->cctx = cctx; in fastrpc_context_alloc()
626 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_context_alloc()
627 ret = idr_alloc_cyclic(&cctx->ctx_idr, ctx, 1, in fastrpc_context_alloc()
630 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_context_alloc()
634 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_context_alloc()
643 fastrpc_channel_ctx_put(cctx); in fastrpc_context_alloc()
815 dst_perms[1].vmid = fl->cctx->vmperms[0].vmid; in fastrpc_map_create()
1112 struct fastrpc_channel_ctx *cctx; in fastrpc_invoke_send() local
1117 cctx = fl->cctx; in fastrpc_invoke_send()
1131 ret = rpmsg_send(cctx->rpdev->ept, (void *)msg, sizeof(*msg)); in fastrpc_invoke_send()
1152 if (!fl->cctx->rpdev) in fastrpc_internal_invoke()
1209 list_add_tail(&buf->node, &fl->cctx->invoke_interrupted_mmaps); in fastrpc_internal_invoke()
1222 if (!fl->is_secure_dev && fl->cctx->secure) { in is_session_rejected()
1228 if (!fl->cctx->unsigned_support || !unsigned_pd_request) { in is_session_rejected()
1229 dev_err(&fl->cctx->rpdev->dev, "Error: Untrusted application trying to offload to signed PD\n"); in is_session_rejected()
1273 if (!fl->cctx->remote_heap) { in fastrpc_init_create_static_process()
1275 &fl->cctx->remote_heap); in fastrpc_init_create_static_process()
1280 if (fl->cctx->vmcount) { in fastrpc_init_create_static_process()
1283 err = qcom_scm_assign_mem(fl->cctx->remote_heap->phys, in fastrpc_init_create_static_process()
1284 (u64)fl->cctx->remote_heap->size, in fastrpc_init_create_static_process()
1286 fl->cctx->vmperms, fl->cctx->vmcount); in fastrpc_init_create_static_process()
1289 fl->cctx->remote_heap->phys, fl->cctx->remote_heap->size, err); in fastrpc_init_create_static_process()
1309 pages[0].addr = fl->cctx->remote_heap->phys; in fastrpc_init_create_static_process()
1310 pages[0].size = fl->cctx->remote_heap->size; in fastrpc_init_create_static_process()
1328 if (fl->cctx->vmcount && scm_done) { in fastrpc_init_create_static_process()
1333 for (i = 0; i < fl->cctx->vmcount; i++) in fastrpc_init_create_static_process()
1334 src_perms |= BIT(fl->cctx->vmperms[i].vmid); in fastrpc_init_create_static_process()
1338 err = qcom_scm_assign_mem(fl->cctx->remote_heap->phys, in fastrpc_init_create_static_process()
1339 (u64)fl->cctx->remote_heap->size, in fastrpc_init_create_static_process()
1343 fl->cctx->remote_heap->phys, fl->cctx->remote_heap->size, err); in fastrpc_init_create_static_process()
1346 fastrpc_buf_free(fl->cctx->remote_heap); in fastrpc_init_create_static_process()
1474 struct fastrpc_channel_ctx *cctx = fl->cctx; in fastrpc_session_alloc() local
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()
1489 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_session_alloc()
1494 static void fastrpc_session_free(struct fastrpc_channel_ctx *cctx, in fastrpc_session_free() argument
1499 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_session_free()
1501 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_session_free()
1523 struct fastrpc_channel_ctx *cctx = fl->cctx; in fastrpc_device_release() local
1531 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_device_release()
1533 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_device_release()
1551 fastrpc_session_free(cctx, fl->sctx); in fastrpc_device_release()
1552 fastrpc_channel_ctx_put(cctx); in fastrpc_device_release()
1563 struct fastrpc_channel_ctx *cctx; in fastrpc_device_open() local
1569 cctx = fdevice->cctx; in fastrpc_device_open()
1576 fastrpc_channel_ctx_get(cctx); in fastrpc_device_open()
1585 fl->cctx = cctx; in fastrpc_device_open()
1590 dev_err(&cctx->rpdev->dev, "No session available\n"); in fastrpc_device_open()
1597 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_device_open()
1598 list_add_tail(&fl->user, &cctx->users); in fastrpc_device_open()
1599 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_device_open()
1722 struct fastrpc_channel_ctx *cctx = fl->cctx; in fastrpc_get_info_from_kernel() local
1729 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_get_info_from_kernel()
1731 if (cctx->valid_attributes) { in fastrpc_get_info_from_kernel()
1732 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_get_info_from_kernel()
1735 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_get_info_from_kernel()
1743 dev_info(&cctx->rpdev->dev, in fastrpc_get_info_from_kernel()
1748 dev_err(&cctx->rpdev->dev, "Error: dsp information is incorrect err: %d\n", err); in fastrpc_get_info_from_kernel()
1753 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_get_info_from_kernel()
1754 memcpy(cctx->dsp_attributes, dsp_attributes, FASTRPC_MAX_DSP_ATTRIBUTES_LEN); in fastrpc_get_info_from_kernel()
1755 cctx->valid_attributes = true; in fastrpc_get_info_from_kernel()
1756 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_get_info_from_kernel()
1759 cap->capability = cctx->dsp_attributes[attribute_id]; in fastrpc_get_info_from_kernel()
1773 dev_err(&fl->cctx->rpdev->dev, "Error: Invalid domain id:%d, err:%d\n", in fastrpc_get_dsp_info()
1780 dev_err(&fl->cctx->rpdev->dev, "Error: modem not supported %d\n", err); in fastrpc_get_dsp_info()
1785 dev_err(&fl->cctx->rpdev->dev, "Error: invalid attribute: %d, err: %d\n", in fastrpc_get_dsp_info()
1927 if (req.flags == ADSP_MMAP_REMOTE_HEAP_ADDR && fl->cctx->vmcount) { in fastrpc_req_mmap()
1931 &src_perms, fl->cctx->vmperms, fl->cctx->vmcount); in fastrpc_req_mmap()
2148 struct fastrpc_channel_ctx *cctx; in fastrpc_cb_probe() local
2155 cctx = dev_get_drvdata(dev->parent); in fastrpc_cb_probe()
2156 if (!cctx) in fastrpc_cb_probe()
2161 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_cb_probe()
2162 if (cctx->sesscount >= FASTRPC_MAX_SESSIONS) { in fastrpc_cb_probe()
2164 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_probe()
2167 sess = &cctx->session[cctx->sesscount++]; in fastrpc_cb_probe()
2180 if (cctx->sesscount >= FASTRPC_MAX_SESSIONS) in fastrpc_cb_probe()
2182 dup_sess = &cctx->session[cctx->sesscount++]; in fastrpc_cb_probe()
2186 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_probe()
2198 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(pdev->dev.parent); in fastrpc_cb_remove() local
2203 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_cb_remove()
2205 if (cctx->session[i].sid == sess->sid) { in fastrpc_cb_remove()
2206 cctx->session[i].valid = false; in fastrpc_cb_remove()
2207 cctx->sesscount--; in fastrpc_cb_remove()
2210 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_remove()
2228 static int fastrpc_device_register(struct device *dev, struct fastrpc_channel_ctx *cctx, in fastrpc_device_register() argument
2239 fdev->cctx = cctx; in fastrpc_device_register()
2250 cctx->secure_fdevice = fdev; in fastrpc_device_register()
2252 cctx->fdevice = fdev; in fastrpc_device_register()
2394 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(&rpdev->dev); in fastrpc_rpmsg_remove() local
2400 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_rpmsg_remove()
2401 cctx->rpdev = NULL; in fastrpc_rpmsg_remove()
2402 list_for_each_entry(user, &cctx->users, user) in fastrpc_rpmsg_remove()
2404 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_rpmsg_remove()
2406 if (cctx->fdevice) in fastrpc_rpmsg_remove()
2407 misc_deregister(&cctx->fdevice->miscdev); in fastrpc_rpmsg_remove()
2409 if (cctx->secure_fdevice) in fastrpc_rpmsg_remove()
2410 misc_deregister(&cctx->secure_fdevice->miscdev); in fastrpc_rpmsg_remove()
2412 list_for_each_entry_safe(buf, b, &cctx->invoke_interrupted_mmaps, node) in fastrpc_rpmsg_remove()
2415 if (cctx->remote_heap) in fastrpc_rpmsg_remove()
2416 fastrpc_buf_free(cctx->remote_heap); in fastrpc_rpmsg_remove()
2420 fastrpc_channel_ctx_put(cctx); in fastrpc_rpmsg_remove()
2426 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(&rpdev->dev); in fastrpc_rpmsg_callback() local
2437 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_rpmsg_callback()
2438 ctx = idr_find(&cctx->ctx_idr, ctxid); in fastrpc_rpmsg_callback()
2439 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_rpmsg_callback()