Lines Matching refs:cctx
236 struct fastrpc_channel_ctx *cctx; member
268 struct fastrpc_channel_ctx *cctx; member
279 struct fastrpc_channel_ctx *cctx; member
306 &(map->fl->cctx->vmperms[0].vmid), &perm, 1); in fastrpc_free_map()
409 struct fastrpc_channel_ctx *cctx; in fastrpc_channel_ctx_free() local
411 cctx = container_of(ref, struct fastrpc_channel_ctx, refcount); in fastrpc_channel_ctx_free()
413 kfree(cctx); in fastrpc_channel_ctx_free()
416 static void fastrpc_channel_ctx_get(struct fastrpc_channel_ctx *cctx) in fastrpc_channel_ctx_get() argument
418 kref_get(&cctx->refcount); in fastrpc_channel_ctx_get()
421 static void fastrpc_channel_ctx_put(struct fastrpc_channel_ctx *cctx) in fastrpc_channel_ctx_put() argument
423 kref_put(&cctx->refcount, fastrpc_channel_ctx_free); in fastrpc_channel_ctx_put()
429 struct fastrpc_channel_ctx *cctx; in fastrpc_context_free() local
434 cctx = ctx->cctx; in fastrpc_context_free()
442 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_context_free()
443 idr_remove(&cctx->ctx_idr, ctx->ctxid >> 4); in fastrpc_context_free()
444 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_context_free()
450 fastrpc_channel_ctx_put(cctx); in fastrpc_context_free()
524 struct fastrpc_channel_ctx *cctx = user->cctx; in fastrpc_context_alloc() local
558 fastrpc_channel_ctx_get(cctx); in fastrpc_context_alloc()
564 ctx->cctx = cctx; in fastrpc_context_alloc()
572 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_context_alloc()
573 ret = idr_alloc_cyclic(&cctx->ctx_idr, ctx, 1, in fastrpc_context_alloc()
576 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_context_alloc()
580 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_context_alloc()
589 fastrpc_channel_ctx_put(cctx); in fastrpc_context_alloc()
751 fl->cctx->vmperms, fl->cctx->vmcount); in fastrpc_map_create()
1040 struct fastrpc_channel_ctx *cctx; in fastrpc_invoke_send() local
1045 cctx = fl->cctx; in fastrpc_invoke_send()
1059 ret = rpmsg_send(cctx->rpdev->ept, (void *)msg, sizeof(*msg)); in fastrpc_invoke_send()
1078 if (!fl->cctx->rpdev) in fastrpc_internal_invoke()
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()
1281 struct fastrpc_channel_ctx *cctx) in fastrpc_session_alloc() argument
1287 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_session_alloc()
1288 for (i = 0; i < cctx->sesscount; i++) { in fastrpc_session_alloc()
1289 if (!cctx->session[i].used && cctx->session[i].valid) { in fastrpc_session_alloc()
1290 cctx->session[i].used = true; in fastrpc_session_alloc()
1291 session = &cctx->session[i]; in fastrpc_session_alloc()
1295 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_session_alloc()
1300 static void fastrpc_session_free(struct fastrpc_channel_ctx *cctx, in fastrpc_session_free() argument
1305 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_session_free()
1307 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_session_free()
1329 struct fastrpc_channel_ctx *cctx = fl->cctx; in fastrpc_device_release() local
1337 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_device_release()
1339 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_device_release()
1359 fastrpc_session_free(cctx, fl->sctx); in fastrpc_device_release()
1360 fastrpc_channel_ctx_put(cctx); in fastrpc_device_release()
1371 struct fastrpc_channel_ctx *cctx; in fastrpc_device_open() local
1377 cctx = fdevice->cctx; in fastrpc_device_open()
1384 fastrpc_channel_ctx_get(cctx); in fastrpc_device_open()
1394 fl->cctx = cctx; in fastrpc_device_open()
1397 fl->sctx = fastrpc_session_alloc(cctx); in fastrpc_device_open()
1399 dev_err(&cctx->rpdev->dev, "No session available\n"); in fastrpc_device_open()
1406 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_device_open()
1407 list_add_tail(&fl->user, &cctx->users); in fastrpc_device_open()
1408 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_device_open()
1527 struct fastrpc_channel_ctx *cctx = fl->cctx; in fastrpc_get_info_from_kernel() local
1534 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_get_info_from_kernel()
1536 if (cctx->valid_attributes) { in fastrpc_get_info_from_kernel()
1537 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_get_info_from_kernel()
1540 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_get_info_from_kernel()
1548 dev_info(&cctx->rpdev->dev, in fastrpc_get_info_from_kernel()
1553 dev_err(&cctx->rpdev->dev, "Error: dsp information is incorrect err: %d\n", err); in fastrpc_get_info_from_kernel()
1558 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_get_info_from_kernel()
1559 memcpy(cctx->dsp_attributes, dsp_attributes, FASTRPC_MAX_DSP_ATTRIBUTES_LEN); in fastrpc_get_info_from_kernel()
1560 cctx->valid_attributes = true; in fastrpc_get_info_from_kernel()
1561 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_get_info_from_kernel()
1564 cap->capability = cctx->dsp_attributes[attribute_id]; in fastrpc_get_info_from_kernel()
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()
1932 struct fastrpc_channel_ctx *cctx; in fastrpc_cb_probe() local
1939 cctx = dev_get_drvdata(dev->parent); in fastrpc_cb_probe()
1940 if (!cctx) in fastrpc_cb_probe()
1945 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_cb_probe()
1946 if (cctx->sesscount >= FASTRPC_MAX_SESSIONS) { in fastrpc_cb_probe()
1948 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_probe()
1951 sess = &cctx->session[cctx->sesscount++]; in fastrpc_cb_probe()
1964 if (cctx->sesscount >= FASTRPC_MAX_SESSIONS) in fastrpc_cb_probe()
1966 dup_sess = &cctx->session[cctx->sesscount++]; in fastrpc_cb_probe()
1970 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_probe()
1982 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(pdev->dev.parent); in fastrpc_cb_remove() local
1987 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_cb_remove()
1989 if (cctx->session[i].sid == sess->sid) { in fastrpc_cb_remove()
1990 cctx->session[i].valid = false; in fastrpc_cb_remove()
1991 cctx->sesscount--; in fastrpc_cb_remove()
1994 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_remove()
2014 static int fastrpc_device_register(struct device *dev, struct fastrpc_channel_ctx *cctx, in fastrpc_device_register() argument
2025 fdev->cctx = cctx; in fastrpc_device_register()
2033 cctx->secure_fdevice = fdev; in fastrpc_device_register()
2035 cctx->fdevice = fdev; in fastrpc_device_register()
2145 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(&rpdev->dev); in fastrpc_rpmsg_remove() local
2149 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_rpmsg_remove()
2150 list_for_each_entry(user, &cctx->users, user) in fastrpc_rpmsg_remove()
2152 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_rpmsg_remove()
2154 if (cctx->fdevice) in fastrpc_rpmsg_remove()
2155 misc_deregister(&cctx->fdevice->miscdev); in fastrpc_rpmsg_remove()
2157 if (cctx->secure_fdevice) in fastrpc_rpmsg_remove()
2158 misc_deregister(&cctx->secure_fdevice->miscdev); in fastrpc_rpmsg_remove()
2162 cctx->rpdev = NULL; in fastrpc_rpmsg_remove()
2163 fastrpc_channel_ctx_put(cctx); in fastrpc_rpmsg_remove()
2169 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(&rpdev->dev); in fastrpc_rpmsg_callback() local
2180 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_rpmsg_callback()
2181 ctx = idr_find(&cctx->ctx_idr, ctxid); in fastrpc_rpmsg_callback()
2182 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_rpmsg_callback()