Lines Matching refs:optee
58 static struct tee_shm *optee_shm_from_ffa_handle(struct optee *optee,
64 mutex_lock(&optee->ffa.mutex);
65 r = rhashtable_lookup_fast(&optee->ffa.global_ids, &global_id,
69 mutex_unlock(&optee->ffa.mutex);
74 static int optee_shm_add_ffa_handle(struct optee *optee, struct tee_shm *shm,
86 mutex_lock(&optee->ffa.mutex);
87 rc = rhashtable_lookup_insert_fast(&optee->ffa.global_ids, &r->linkage,
89 mutex_unlock(&optee->ffa.mutex);
97 static int optee_shm_rem_ffa_handle(struct optee *optee, u64 global_id)
102 mutex_lock(&optee->ffa.mutex);
103 r = rhashtable_lookup_fast(&optee->ffa.global_ids, &global_id,
106 rc = rhashtable_remove_fast(&optee->ffa.global_ids,
108 mutex_unlock(&optee->ffa.mutex);
123 static void from_msg_param_ffa_mem(struct optee *optee, struct tee_param *p,
135 shm = optee_shm_from_ffa_handle(optee, mp->u.fmem.global_id);
148 * @optee: main service struct
155 static int optee_ffa_from_msg_param(struct optee *optee,
179 from_msg_param_ffa_mem(optee, p, attr, mp);
221 * @optee: main service struct
227 static int optee_ffa_to_msg_param(struct optee *optee,
273 struct optee *optee = tee_get_drvdata(ctx->teedev);
274 struct ffa_device *ffa_dev = optee->ffa.ffa_dev;
302 rc = optee_shm_add_ffa_handle(optee, shm, args.g_handle);
316 struct optee *optee = tee_get_drvdata(ctx->teedev);
317 struct ffa_device *ffa_dev = optee->ffa.ffa_dev;
328 optee_shm_rem_ffa_handle(optee, global_handle);
345 struct optee *optee = tee_get_drvdata(ctx->teedev);
356 optee_shm_rem_ffa_handle(optee, global_handle);
357 mem_ops = optee->ffa.ffa_dev->ops->mem_ops;
427 struct optee *optee,
443 shm = tee_shm_alloc_priv_buf(optee->ctx,
467 struct optee *optee,
476 shm = optee_shm_from_ffa_handle(optee, arg->params[0].u.value.b);
497 struct optee *optee,
503 handle_ffa_rpc_func_cmd_shm_alloc(ctx, optee, arg);
506 handle_ffa_rpc_func_cmd_shm_free(ctx, optee, arg);
509 optee_rpc_cmd(ctx, optee, arg);
513 static void optee_handle_ffa_rpc(struct tee_context *ctx, struct optee *optee,
518 handle_ffa_rpc_func_cmd(ctx, optee, arg);
533 struct optee *optee = tee_get_drvdata(ctx->teedev);
534 struct ffa_device *ffa_dev = optee->ffa.ffa_dev;
544 optee_cq_wait_init(&optee->call_queue, &w);
563 optee_cq_wait_for_completion(&optee->call_queue, &w);
585 optee_handle_ffa_rpc(ctx, optee, data->data1, rpc_arg);
597 optee_cq_wait_final(&optee->call_queue, &w);
777 struct optee *optee = ffa_dev_get_drvdata(ffa_dev);
779 optee_remove_common(optee);
781 mutex_destroy(&optee->ffa.mutex);
782 rhashtable_free_and_destroy(&optee->ffa.global_ids, rh_free_fn, NULL);
784 kfree(optee);
795 struct optee *optee;
810 optee = kzalloc(sizeof(*optee), GFP_KERNEL);
811 if (!optee)
819 optee->pool = pool;
821 optee->ops = &optee_ffa_ops;
822 optee->ffa.ffa_dev = ffa_dev;
823 optee->rpc_param_count = rpc_param_count;
825 teedev = tee_device_alloc(&optee_ffa_clnt_desc, NULL, optee->pool,
826 optee);
831 optee->teedev = teedev;
833 teedev = tee_device_alloc(&optee_ffa_supp_desc, NULL, optee->pool,
834 optee);
839 optee->supp_teedev = teedev;
841 rc = tee_device_register(optee->teedev);
845 rc = tee_device_register(optee->supp_teedev);
849 rc = rhashtable_init(&optee->ffa.global_ids, &shm_rhash_params);
852 mutex_init(&optee->ffa.mutex);
853 mutex_init(&optee->call_queue.mutex);
854 INIT_LIST_HEAD(&optee->call_queue.waiters);
855 optee_supp_init(&optee->supp);
856 optee_shm_arg_cache_init(optee, arg_cache_flags);
857 ffa_dev_set_drvdata(ffa_dev, optee);
858 ctx = teedev_open(optee->teedev);
863 optee->ctx = ctx;
864 rc = optee_notif_init(optee, OPTEE_DEFAULT_MAX_NOTIF_VALUE);
877 optee_notif_uninit(optee);
881 rhashtable_free_and_destroy(&optee->ffa.global_ids, rh_free_fn, NULL);
882 optee_supp_uninit(&optee->supp);
883 mutex_destroy(&optee->call_queue.mutex);
884 mutex_destroy(&optee->ffa.mutex);
886 tee_device_unregister(optee->supp_teedev);
888 tee_device_unregister(optee->teedev);
892 kfree(optee);
904 .name = "optee",