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