Lines Matching full:shm
49 * A typical OP-TEE private shm allocation is 224 bytes (argument struct
85 struct tee_shm *shm; in from_msg_param_tmp_mem() local
92 shm = (struct tee_shm *)(unsigned long)mp->u.tmem.shm_ref; in from_msg_param_tmp_mem()
93 if (!shm) { in from_msg_param_tmp_mem()
95 p->u.memref.shm = NULL; in from_msg_param_tmp_mem()
99 rc = tee_shm_get_pa(shm, 0, &pa); in from_msg_param_tmp_mem()
104 p->u.memref.shm = shm; in from_msg_param_tmp_mem()
112 struct tee_shm *shm; in from_msg_param_reg_mem() local
117 shm = (struct tee_shm *)(unsigned long)mp->u.rmem.shm_ref; in from_msg_param_reg_mem()
119 if (shm) { in from_msg_param_reg_mem()
121 p->u.memref.shm = shm; in from_msg_param_reg_mem()
124 p->u.memref.shm = NULL; in from_msg_param_reg_mem()
188 mp->u.tmem.shm_ref = (unsigned long)p->u.memref.shm; in to_msg_param_tmp_mem()
191 if (!p->u.memref.shm) { in to_msg_param_tmp_mem()
196 rc = tee_shm_get_pa(p->u.memref.shm, p->u.memref.shm_offs, &pa); in to_msg_param_tmp_mem()
213 mp->u.rmem.shm_ref = (unsigned long)p->u.memref.shm; in to_msg_param_reg_mem()
251 if (tee_shm_is_dynamic(p->u.memref.shm)) in optee_to_msg_param()
321 break; /* All shm's freed */ in __optee_disable_shm_cache()
323 struct tee_shm *shm; in __optee_disable_shm_cache() local
332 shm = reg_pair_to_ptr(res.result.shm_upper32, in __optee_disable_shm_cache()
334 tee_shm_free(shm); in __optee_disable_shm_cache()
452 static int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm, in optee_shm_register() argument
494 tee_shm_get_page_offset(shm)); in optee_shm_register()
501 msg_arg->params->u.tmem.shm_ref = (unsigned long)shm; in optee_shm_register()
502 msg_arg->params->u.tmem.size = tee_shm_get_size(shm); in optee_shm_register()
508 (tee_shm_get_page_offset(shm) & (OPTEE_MSG_NONCONTIG_PAGE_SIZE - 1)); in optee_shm_register()
520 static int optee_shm_unregister(struct tee_context *ctx, struct tee_shm *shm) in optee_shm_unregister() argument
551 msg_arg->params[0].u.rmem.shm_ref = (unsigned long)shm; in optee_shm_unregister()
561 static int optee_shm_register_supp(struct tee_context *ctx, struct tee_shm *shm, in optee_shm_register_supp() argument
573 struct tee_shm *shm) in optee_shm_unregister_supp() argument
588 struct tee_shm *shm, size_t size, size_t align) in pool_op_alloc() argument
594 if (shm->flags & TEE_SHM_PRIV) in pool_op_alloc()
595 return optee_pool_op_alloc_helper(pool, shm, size, align, NULL); in pool_op_alloc()
597 return optee_pool_op_alloc_helper(pool, shm, size, align, in pool_op_alloc()
602 struct tee_shm *shm) in pool_op_free() argument
604 if (!(shm->flags & TEE_SHM_PRIV)) in pool_op_free()
605 optee_pool_op_free_helper(pool, shm, optee_shm_unregister); in pool_op_free()
607 optee_pool_op_free_helper(pool, shm, NULL); in pool_op_free()
624 * This pool is used when OP-TEE supports dymanic SHM. In this case
652 struct tee_shm *shm; in handle_rpc_func_cmd_shm_free() local
662 shm = (struct tee_shm *)(unsigned long)arg->params[0].u.value.b; in handle_rpc_func_cmd_shm_free()
665 optee_rpc_cmd_free_suppl(ctx, shm); in handle_rpc_func_cmd_shm_free()
668 tee_shm_free(shm); in handle_rpc_func_cmd_shm_free()
682 struct tee_shm *shm; in handle_rpc_func_cmd_shm_alloc() local
704 shm = optee_rpc_cmd_alloc_suppl(ctx, sz); in handle_rpc_func_cmd_shm_alloc()
707 shm = tee_shm_alloc_priv_buf(optee->ctx, sz); in handle_rpc_func_cmd_shm_alloc()
714 if (IS_ERR(shm)) { in handle_rpc_func_cmd_shm_alloc()
719 if (tee_shm_get_pa(shm, 0, &pa)) { in handle_rpc_func_cmd_shm_alloc()
724 sz = tee_shm_get_size(shm); in handle_rpc_func_cmd_shm_alloc()
726 if (tee_shm_is_dynamic(shm)) { in handle_rpc_func_cmd_shm_alloc()
731 pages = tee_shm_get_pages(shm, &page_num); in handle_rpc_func_cmd_shm_alloc()
753 (tee_shm_get_page_offset(shm) & in handle_rpc_func_cmd_shm_alloc()
755 arg->params[0].u.tmem.size = tee_shm_get_size(shm); in handle_rpc_func_cmd_shm_alloc()
756 arg->params[0].u.tmem.shm_ref = (unsigned long)shm; in handle_rpc_func_cmd_shm_alloc()
759 tee_shm_get_page_offset(shm)); in handle_rpc_func_cmd_shm_alloc()
764 arg->params[0].u.tmem.shm_ref = (unsigned long)shm; in handle_rpc_func_cmd_shm_alloc()
770 tee_shm_free(shm); in handle_rpc_func_cmd_shm_alloc()
822 struct tee_shm *shm; in optee_handle_rpc() local
827 shm = tee_shm_alloc_priv_buf(optee->ctx, param->a1); in optee_handle_rpc()
828 if (!IS_ERR(shm) && !tee_shm_get_pa(shm, 0, &pa)) { in optee_handle_rpc()
831 (unsigned long)shm); in optee_handle_rpc()
838 kmemleak_not_leak(shm); in optee_handle_rpc()
841 shm = reg_pair_to_ptr(param->a1, param->a2); in optee_handle_rpc()
842 tee_shm_free(shm); in optee_handle_rpc()
856 shm = reg_pair_to_ptr(param->a1, param->a2); in optee_handle_rpc()
857 arg = tee_shm_get_va(shm, 0); in optee_handle_rpc()
860 __func__, shm); in optee_handle_rpc()
879 * @shm: shared memory holding the message to pass to secure world
880 * @offs: offset of the message in @shm
888 struct tee_shm *shm, u_int offs) in optee_smc_do_call_with_arg() argument
901 arg = tee_shm_get_va(shm, offs); in optee_smc_do_call_with_arg()
906 rpc_arg = tee_shm_get_va(shm, offs + rpc_arg_offs); in optee_smc_do_call_with_arg()
911 if (rpc_arg && tee_shm_is_dynamic(shm)) { in optee_smc_do_call_with_arg()
913 reg_pair_from_64(¶m.a1, ¶m.a2, (u_long)shm); in optee_smc_do_call_with_arg()
918 rc = tee_shm_get_pa(shm, offs, &parg); in optee_smc_do_call_with_arg()
972 struct tee_shm *shm; in simple_call_with_arg() local
975 msg_arg = optee_get_msg_arg(ctx, 0, &entry, &shm, &offs); in simple_call_with_arg()
980 optee_smc_do_call_with_arg(ctx, shm, offs); in simple_call_with_arg()
1377 pr_err("static shm service not available\n"); in optee_config_shm_memremap()
1766 * Ensure that there are no pre-existing shm objects before enabling in optee_probe()
1767 * the shm cache so that there's no chance of receiving an invalid in optee_probe()
1770 * shm cache. in optee_probe()
1775 * Only enable the shm cache in case we're not able to pass the RPC in optee_probe()