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()
1472 struct fastrpc_channel_ctx *cctx) in fastrpc_session_alloc() argument
1478 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_session_alloc()
1479 for (i = 0; i < cctx->sesscount; i++) { in fastrpc_session_alloc()
1480 if (!cctx->session[i].used && cctx->session[i].valid) { in fastrpc_session_alloc()
1481 cctx->session[i].used = true; in fastrpc_session_alloc()
1482 session = &cctx->session[i]; in fastrpc_session_alloc()
1486 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_session_alloc()
1491 static void fastrpc_session_free(struct fastrpc_channel_ctx *cctx, in fastrpc_session_free() argument
1496 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_session_free()
1498 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_session_free()
1520 struct fastrpc_channel_ctx *cctx = fl->cctx; in fastrpc_device_release() local
1528 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_device_release()
1530 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_device_release()
1548 fastrpc_session_free(cctx, fl->sctx); in fastrpc_device_release()
1549 fastrpc_channel_ctx_put(cctx); in fastrpc_device_release()
1560 struct fastrpc_channel_ctx *cctx; in fastrpc_device_open() local
1566 cctx = fdevice->cctx; in fastrpc_device_open()
1573 fastrpc_channel_ctx_get(cctx); in fastrpc_device_open()
1583 fl->cctx = cctx; in fastrpc_device_open()
1586 fl->sctx = fastrpc_session_alloc(cctx); in fastrpc_device_open()
1588 dev_err(&cctx->rpdev->dev, "No session available\n"); in fastrpc_device_open()
1595 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_device_open()
1596 list_add_tail(&fl->user, &cctx->users); in fastrpc_device_open()
1597 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_device_open()
1720 struct fastrpc_channel_ctx *cctx = fl->cctx; in fastrpc_get_info_from_kernel() local
1727 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_get_info_from_kernel()
1729 if (cctx->valid_attributes) { in fastrpc_get_info_from_kernel()
1730 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_get_info_from_kernel()
1733 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_get_info_from_kernel()
1741 dev_info(&cctx->rpdev->dev, in fastrpc_get_info_from_kernel()
1746 dev_err(&cctx->rpdev->dev, "Error: dsp information is incorrect err: %d\n", err); in fastrpc_get_info_from_kernel()
1751 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_get_info_from_kernel()
1752 memcpy(cctx->dsp_attributes, dsp_attributes, FASTRPC_MAX_DSP_ATTRIBUTES_LEN); in fastrpc_get_info_from_kernel()
1753 cctx->valid_attributes = true; in fastrpc_get_info_from_kernel()
1754 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_get_info_from_kernel()
1757 cap->capability = cctx->dsp_attributes[attribute_id]; in fastrpc_get_info_from_kernel()
1771 dev_err(&fl->cctx->rpdev->dev, "Error: Invalid domain id:%d, err:%d\n", in fastrpc_get_dsp_info()
1778 dev_err(&fl->cctx->rpdev->dev, "Error: modem not supported %d\n", err); in fastrpc_get_dsp_info()
1783 dev_err(&fl->cctx->rpdev->dev, "Error: invalid attribute: %d, err: %d\n", in fastrpc_get_dsp_info()
1925 if (req.flags == ADSP_MMAP_REMOTE_HEAP_ADDR && fl->cctx->vmcount) { in fastrpc_req_mmap()
1929 &src_perms, fl->cctx->vmperms, fl->cctx->vmcount); in fastrpc_req_mmap()
2146 struct fastrpc_channel_ctx *cctx; in fastrpc_cb_probe() local
2153 cctx = dev_get_drvdata(dev->parent); in fastrpc_cb_probe()
2154 if (!cctx) in fastrpc_cb_probe()
2159 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_cb_probe()
2160 if (cctx->sesscount >= FASTRPC_MAX_SESSIONS) { in fastrpc_cb_probe()
2162 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_probe()
2165 sess = &cctx->session[cctx->sesscount++]; in fastrpc_cb_probe()
2178 if (cctx->sesscount >= FASTRPC_MAX_SESSIONS) in fastrpc_cb_probe()
2180 dup_sess = &cctx->session[cctx->sesscount++]; in fastrpc_cb_probe()
2184 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_probe()
2196 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(pdev->dev.parent); in fastrpc_cb_remove() local
2201 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_cb_remove()
2203 if (cctx->session[i].sid == sess->sid) { in fastrpc_cb_remove()
2204 cctx->session[i].valid = false; in fastrpc_cb_remove()
2205 cctx->sesscount--; in fastrpc_cb_remove()
2208 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_remove()
2226 static int fastrpc_device_register(struct device *dev, struct fastrpc_channel_ctx *cctx, in fastrpc_device_register() argument
2237 fdev->cctx = cctx; in fastrpc_device_register()
2248 cctx->secure_fdevice = fdev; in fastrpc_device_register()
2250 cctx->fdevice = fdev; in fastrpc_device_register()
2397 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(&rpdev->dev); in fastrpc_rpmsg_remove() local
2403 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_rpmsg_remove()
2404 cctx->rpdev = NULL; in fastrpc_rpmsg_remove()
2405 list_for_each_entry(user, &cctx->users, user) in fastrpc_rpmsg_remove()
2407 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_rpmsg_remove()
2409 if (cctx->fdevice) in fastrpc_rpmsg_remove()
2410 misc_deregister(&cctx->fdevice->miscdev); in fastrpc_rpmsg_remove()
2412 if (cctx->secure_fdevice) in fastrpc_rpmsg_remove()
2413 misc_deregister(&cctx->secure_fdevice->miscdev); in fastrpc_rpmsg_remove()
2415 list_for_each_entry_safe(buf, b, &cctx->invoke_interrupted_mmaps, node) in fastrpc_rpmsg_remove()
2418 if (cctx->remote_heap) in fastrpc_rpmsg_remove()
2419 fastrpc_buf_free(cctx->remote_heap); in fastrpc_rpmsg_remove()
2423 fastrpc_channel_ctx_put(cctx); in fastrpc_rpmsg_remove()
2429 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(&rpdev->dev); in fastrpc_rpmsg_callback() local
2440 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_rpmsg_callback()
2441 ctx = idr_find(&cctx->ctx_idr, ctxid); in fastrpc_rpmsg_callback()
2442 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_rpmsg_callback()