Lines Matching refs:shm
158 struct tee_shm *shm = (struct tee_shm *)mp->u.tmem.shm_ref; in msg_param_to_tmp_mem() local
163 if (!shm) { in msg_param_to_tmp_mem()
169 p->a = mp->u.tmem.buf_ptr - k_mem_phys_addr(shm->addr); in msg_param_to_tmp_mem()
294 static int cmd_alloc_suppl(const struct device *dev, size_t sz, struct tee_shm **shm) in cmd_alloc_suppl() argument
310 ret = tee_add_shm(dev, (void *)param.c, 0, param.b, 0, shm); in cmd_alloc_suppl()
315 static void cmd_free_suppl(const struct device *dev, struct tee_shm *shm) in cmd_free_suppl() argument
321 param.b = (uint64_t)shm; in cmd_free_suppl()
325 tee_rm_shm(dev, shm); in cmd_free_suppl()
332 struct tee_shm *shm = NULL; in handle_cmd_alloc() local
346 rc = tee_add_shm(dev, NULL, 0, arg->params[0].u.value.b, TEE_SHM_ALLOC, &shm); in handle_cmd_alloc()
349 rc = cmd_alloc_suppl(dev, arg->params[0].u.value.b, &shm); in handle_cmd_alloc()
365 pl = optee_construct_page_list(shm->addr, shm->size, &pl_phys_and_offset); in handle_cmd_alloc()
374 arg->params[0].u.tmem.size = shm->size; in handle_cmd_alloc()
375 arg->params[0].u.tmem.shm_ref = (uint64_t)shm; in handle_cmd_alloc()
379 tee_shm_free(dev, shm); in handle_cmd_alloc()
608 static uint32_t handle_func_rpc_call(const struct device *dev, struct tee_shm *shm, in handle_func_rpc_call() argument
611 struct optee_msg_arg *arg = shm->addr; in handle_func_rpc_call()
644 struct tee_shm *shm = NULL; in handle_rpc_call() local
651 TEE_SHM_ALLOC, &shm)) { in handle_rpc_call()
652 u64_to_regs((uint64_t)k_mem_phys_addr(shm->addr), ¶m->a1, ¶m->a2); in handle_rpc_call()
653 u64_to_regs((uint64_t)shm, ¶m->a4, ¶m->a5); in handle_rpc_call()
662 shm = (struct tee_shm *)regs_to_u64(param->a1, param->a2); in handle_rpc_call()
663 tee_rm_shm(dev, shm); in handle_rpc_call()
669 shm = (struct tee_shm *)regs_to_u64(param->a1, param->a2); in handle_rpc_call()
670 res = handle_func_rpc_call(dev, shm, pages); in handle_rpc_call()
732 struct tee_shm *shm; in optee_close_session() local
737 TEE_SHM_ALLOC, &shm); in optee_close_session()
743 marg = shm->addr; in optee_close_session()
750 if (tee_rm_shm(dev, shm)) { in optee_close_session()
762 struct tee_shm *shm; in optee_open_session() local
771 TEE_SHM_ALLOC, &shm); in optee_open_session()
777 marg = shm->addr; in optee_open_session()
821 ret = tee_rm_shm(dev, shm); in optee_open_session()
832 struct tee_shm *shm; in optee_cancel() local
837 TEE_SHM_ALLOC, &shm); in optee_cancel()
843 marg = shm->addr; in optee_cancel()
851 if (tee_rm_shm(dev, shm)) { in optee_cancel()
862 struct tee_shm *shm; in optee_invoke_func() local
871 TEE_SHM_ALLOC, &shm); in optee_invoke_func()
877 marg = shm->addr; in optee_invoke_func()
906 ret = tee_rm_shm(dev, shm); in optee_invoke_func()
966 static int optee_shm_register(const struct device *dev, struct tee_shm *shm) in optee_shm_register() argument
984 pl = optee_construct_page_list(shm->addr, shm->size, &pl_phys_and_offset); in optee_shm_register()
996 msg_arg->params->u.tmem.shm_ref = (uint64_t)shm; in optee_shm_register()
997 msg_arg->params->u.tmem.size = shm->size; in optee_shm_register()
1010 static int optee_shm_unregister(const struct device *dev, struct tee_shm *shm) in optee_shm_unregister() argument
1029 msg_arg->params[0].u.rmem.shm_ref = (uint64_t)shm; in optee_shm_unregister()