Lines Matching full:shm
46 * A typical OP-TEE private shm allocation is 224 bytes (argument struct
65 struct tee_shm *shm; in from_msg_param_tmp_mem() local
72 shm = (struct tee_shm *)(unsigned long)mp->u.tmem.shm_ref; in from_msg_param_tmp_mem()
73 if (!shm) { in from_msg_param_tmp_mem()
75 p->u.memref.shm = NULL; in from_msg_param_tmp_mem()
79 rc = tee_shm_get_pa(shm, 0, &pa); in from_msg_param_tmp_mem()
84 p->u.memref.shm = shm; in from_msg_param_tmp_mem()
92 struct tee_shm *shm; in from_msg_param_reg_mem() local
97 shm = (struct tee_shm *)(unsigned long)mp->u.rmem.shm_ref; in from_msg_param_reg_mem()
99 if (shm) { in from_msg_param_reg_mem()
101 p->u.memref.shm = shm; in from_msg_param_reg_mem()
104 p->u.memref.shm = NULL; in from_msg_param_reg_mem()
168 mp->u.tmem.shm_ref = (unsigned long)p->u.memref.shm; in to_msg_param_tmp_mem()
171 if (!p->u.memref.shm) { in to_msg_param_tmp_mem()
176 rc = tee_shm_get_pa(p->u.memref.shm, p->u.memref.shm_offs, &pa); in to_msg_param_tmp_mem()
193 mp->u.rmem.shm_ref = (unsigned long)p->u.memref.shm; in to_msg_param_reg_mem()
231 if (tee_shm_is_dynamic(p->u.memref.shm)) in optee_to_msg_param()
301 break; /* All shm's freed */ in __optee_disable_shm_cache()
303 struct tee_shm *shm; in __optee_disable_shm_cache() local
312 shm = reg_pair_to_ptr(res.result.shm_upper32, in __optee_disable_shm_cache()
314 tee_shm_free(shm); in __optee_disable_shm_cache()
432 static int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm, in optee_shm_register() argument
474 tee_shm_get_page_offset(shm)); in optee_shm_register()
481 msg_arg->params->u.tmem.shm_ref = (unsigned long)shm; in optee_shm_register()
482 msg_arg->params->u.tmem.size = tee_shm_get_size(shm); in optee_shm_register()
488 (tee_shm_get_page_offset(shm) & (OPTEE_MSG_NONCONTIG_PAGE_SIZE - 1)); in optee_shm_register()
500 static int optee_shm_unregister(struct tee_context *ctx, struct tee_shm *shm) in optee_shm_unregister() argument
531 msg_arg->params[0].u.rmem.shm_ref = (unsigned long)shm; in optee_shm_unregister()
541 static int optee_shm_register_supp(struct tee_context *ctx, struct tee_shm *shm, in optee_shm_register_supp() argument
553 struct tee_shm *shm) in optee_shm_unregister_supp() argument
568 struct tee_shm *shm, size_t size, size_t align) in pool_op_alloc() argument
574 if (shm->flags & TEE_SHM_PRIV) in pool_op_alloc()
575 return optee_pool_op_alloc_helper(pool, shm, size, align, NULL); in pool_op_alloc()
577 return optee_pool_op_alloc_helper(pool, shm, size, align, in pool_op_alloc()
582 struct tee_shm *shm) in pool_op_free() argument
584 if (!(shm->flags & TEE_SHM_PRIV)) in pool_op_free()
585 optee_pool_op_free_helper(pool, shm, optee_shm_unregister); in pool_op_free()
587 optee_pool_op_free_helper(pool, shm, NULL); in pool_op_free()
604 * This pool is used when OP-TEE supports dymanic SHM. In this case
632 struct tee_shm *shm; in handle_rpc_func_cmd_shm_free() local
642 shm = (struct tee_shm *)(unsigned long)arg->params[0].u.value.b; in handle_rpc_func_cmd_shm_free()
645 optee_rpc_cmd_free_suppl(ctx, shm); in handle_rpc_func_cmd_shm_free()
648 tee_shm_free(shm); in handle_rpc_func_cmd_shm_free()
662 struct tee_shm *shm; in handle_rpc_func_cmd_shm_alloc() local
684 shm = optee_rpc_cmd_alloc_suppl(ctx, sz); in handle_rpc_func_cmd_shm_alloc()
687 shm = tee_shm_alloc_priv_buf(optee->ctx, sz); in handle_rpc_func_cmd_shm_alloc()
694 if (IS_ERR(shm)) { in handle_rpc_func_cmd_shm_alloc()
699 if (tee_shm_get_pa(shm, 0, &pa)) { in handle_rpc_func_cmd_shm_alloc()
704 sz = tee_shm_get_size(shm); in handle_rpc_func_cmd_shm_alloc()
706 if (tee_shm_is_dynamic(shm)) { in handle_rpc_func_cmd_shm_alloc()
711 pages = tee_shm_get_pages(shm, &page_num); in handle_rpc_func_cmd_shm_alloc()
733 (tee_shm_get_page_offset(shm) & in handle_rpc_func_cmd_shm_alloc()
735 arg->params[0].u.tmem.size = tee_shm_get_size(shm); in handle_rpc_func_cmd_shm_alloc()
736 arg->params[0].u.tmem.shm_ref = (unsigned long)shm; in handle_rpc_func_cmd_shm_alloc()
739 tee_shm_get_page_offset(shm)); in handle_rpc_func_cmd_shm_alloc()
744 arg->params[0].u.tmem.shm_ref = (unsigned long)shm; in handle_rpc_func_cmd_shm_alloc()
750 tee_shm_free(shm); in handle_rpc_func_cmd_shm_alloc()
802 struct tee_shm *shm; in optee_handle_rpc() local
807 shm = tee_shm_alloc_priv_buf(optee->ctx, param->a1); in optee_handle_rpc()
808 if (!IS_ERR(shm) && !tee_shm_get_pa(shm, 0, &pa)) { in optee_handle_rpc()
811 (unsigned long)shm); in optee_handle_rpc()
818 kmemleak_not_leak(shm); in optee_handle_rpc()
821 shm = reg_pair_to_ptr(param->a1, param->a2); in optee_handle_rpc()
822 tee_shm_free(shm); in optee_handle_rpc()
836 shm = reg_pair_to_ptr(param->a1, param->a2); in optee_handle_rpc()
837 arg = tee_shm_get_va(shm, 0); in optee_handle_rpc()
840 __func__, shm); in optee_handle_rpc()
859 * @shm: shared memory holding the message to pass to secure world
860 * @offs: offset of the message in @shm
868 struct tee_shm *shm, u_int offs) in optee_smc_do_call_with_arg() argument
881 arg = tee_shm_get_va(shm, offs); in optee_smc_do_call_with_arg()
886 rpc_arg = tee_shm_get_va(shm, offs + rpc_arg_offs); in optee_smc_do_call_with_arg()
891 if (rpc_arg && tee_shm_is_dynamic(shm)) { in optee_smc_do_call_with_arg()
893 reg_pair_from_64(¶m.a1, ¶m.a2, (u_long)shm); in optee_smc_do_call_with_arg()
898 rc = tee_shm_get_pa(shm, offs, &parg); in optee_smc_do_call_with_arg()
952 struct tee_shm *shm; in simple_call_with_arg() local
955 msg_arg = optee_get_msg_arg(ctx, 0, &entry, &shm, &offs); in simple_call_with_arg()
960 optee_smc_do_call_with_arg(ctx, shm, offs); in simple_call_with_arg()
1242 pr_err("static shm service not available\n"); in optee_config_shm_memremap()
1514 * Ensure that there are no pre-existing shm objects before enabling in optee_probe()
1515 * the shm cache so that there's no chance of receiving an invalid in optee_probe()
1518 * shm cache. in optee_probe()
1523 * Only enable the shm cache in case we're not able to pass the RPC in optee_probe()