| /optee_os/core/include/mm/ |
| H A D | mobj.h | 26 struct mobj { struct 34 void *(*get_va)(struct mobj *mobj, size_t offs, size_t len); argument 35 TEE_Result (*get_pa)(struct mobj *mobj, size_t offs, size_t granule, 37 size_t (*get_phys_offs)(struct mobj *mobj, size_t granule); 38 TEE_Result (*get_mem_type)(struct mobj *mobj, uint32_t *mt); 39 bool (*matches)(struct mobj *mobj, enum buf_is_attr attr); 40 void (*free)(struct mobj *mobj); 41 uint64_t (*get_cookie)(struct mobj *mobj); 42 struct fobj *(*get_fobj)(struct mobj *mobj); 43 TEE_Result (*inc_map)(struct mobj *mobj); [all …]
|
| H A D | sp_mem.h | 38 struct mobj *mobj; member 78 struct mobj *mobj); 81 struct mobj *sp_mem_new_mobj(uint64_t pages, uint32_t mem_type, bool is_secure); 82 int sp_mem_add_pages(struct mobj *mobj, unsigned int *idx,
|
| H A D | vm.h | 30 uint32_t prot, uint32_t flags, struct mobj *mobj, 41 struct mobj *mobj, size_t offs) in vm_map() argument 43 return vm_map_pad(uctx, va, len, prot, flags, mobj, offs, 0, 0, 0); in vm_map() 80 struct mobj **mobj, size_t *offs); 98 struct mobj *vm_get_mobj(struct user_mode_ctx *uctx, vaddr_t va, size_t *len,
|
| /optee_os/core/mm/ |
| H A D | mobj.c | 24 struct mobj *mobj_tee_ram_rx; 25 struct mobj *mobj_tee_ram_rw; 32 struct mobj mobj; member 40 static struct mobj_phys *to_mobj_phys(struct mobj *mobj); 42 static void *mobj_phys_get_va(struct mobj *mobj, size_t offset, size_t len) in mobj_phys_get_va() argument 44 struct mobj_phys *moph = to_mobj_phys(mobj); in mobj_phys_get_va() 46 if (!moph->va || !mobj_check_offset_and_len(mobj, offset, len)) in mobj_phys_get_va() 52 static TEE_Result mobj_phys_get_pa(struct mobj *mobj, size_t offs, in mobj_phys_get_pa() argument 55 struct mobj_phys *moph = to_mobj_phys(mobj); in mobj_phys_get_pa() 75 static TEE_Result mobj_phys_get_mem_type(struct mobj *mobj, uint32_t *mem_type) in mobj_phys_get_mem_type() argument [all …]
|
| H A D | mobj_dyn_shm.c | 33 struct mobj mobj; member 49 struct mobj mobj; member 79 static struct mobj_reg_shm *to_mobj_reg_shm(struct mobj *mobj); 81 static TEE_Result mobj_reg_shm_get_pa(struct mobj *mobj, size_t offst, in mobj_reg_shm_get_pa() argument 84 struct mobj_reg_shm *mobj_reg_shm = to_mobj_reg_shm(mobj); in mobj_reg_shm_get_pa() 91 if (offst >= mobj->size) in mobj_reg_shm_get_pa() 112 static size_t mobj_reg_shm_get_phys_offs(struct mobj *mobj, in mobj_reg_shm_get_phys_offs() argument 115 assert(granule >= mobj->phys_granule); in mobj_reg_shm_get_phys_offs() 116 return to_mobj_reg_shm(mobj)->page_offset; in mobj_reg_shm_get_phys_offs() 119 static void *mobj_reg_shm_get_va(struct mobj *mobj, size_t offst, size_t len) in mobj_reg_shm_get_va() argument [all …]
|
| H A D | vm.c | 140 if (mobj_is_paged(r->mobj)) { in rem_um_region() 187 size_t sz = MIN(end - va, mobj_get_phys_granule(r->mobj)); in set_reg_in_table() 194 if (mobj_get_pa(r->mobj, offset, granule, &pa)) in set_reg_in_table() 206 assert(!mobj_is_paged(r->mobj)); in set_um_region() 261 if (offs_plus_size > ROUNDUP(reg->mobj->size, SMALL_PAGE_SIZE)) in umap_add_region() 295 uint32_t prot, uint32_t flags, struct mobj *mobj, in vm_map_pad() argument 310 if (!mobj_is_paged(mobj)) { in vm_map_pad() 313 res = mobj_get_mem_type(mobj, &mem_type); in vm_map_pad() 319 if (mobj_is_secure(mobj)) in vm_map_pad() 322 reg->mobj = mobj_get(mobj); in vm_map_pad() [all …]
|
| /optee_os/core/arch/arm/mm/ |
| H A D | mobj_ffa.c | 79 struct mobj mobj; member 130 static bool is_mobj_ffa_shm(struct mobj *mobj) in is_mobj_ffa_shm() argument 132 return mobj->ops == &mobj_ffa_shm_ops; in is_mobj_ffa_shm() 135 static struct mobj_ffa_shm *to_mobj_ffa_shm(struct mobj *mobj) in to_mobj_ffa_shm() argument 137 assert(is_mobj_ffa_shm(mobj)); in to_mobj_ffa_shm() 138 return container_of(mobj, struct mobj_ffa_shm, mf.mobj); in to_mobj_ffa_shm() 141 static bool is_mobj_ffa_prm(struct mobj *mobj) in is_mobj_ffa_prm() argument 143 return mobj->ops == &mobj_ffa_prm_ops; in is_mobj_ffa_prm() 146 static struct mobj_ffa_prm *to_mobj_ffa_prm(struct mobj *mobj) in to_mobj_ffa_prm() argument 148 assert(is_mobj_ffa_prm(mobj)); in to_mobj_ffa_prm() [all …]
|
| H A D | sp_mem.c | 23 struct mobj mobj; member 29 static struct mobj_sp *to_mobj_sp(struct mobj *mobj) in to_mobj_sp() argument 31 assert(mobj->ops == &mobj_sp_ops); in to_mobj_sp() 32 return container_of(mobj, struct mobj_sp, mobj); in to_mobj_sp() 46 struct mobj *sp_mem_new_mobj(uint64_t pages, uint32_t mem_type, bool is_secure) in sp_mem_new_mobj() 59 m->mobj.ops = &mobj_sp_ops; in sp_mem_new_mobj() 60 m->mobj.size = pages * SMALL_PAGE_SIZE; in sp_mem_new_mobj() 61 m->mobj.phys_granule = SMALL_PAGE_SIZE; in sp_mem_new_mobj() 66 refcount_set(&m->mobj.refc, 1); in sp_mem_new_mobj() 67 return &m->mobj; in sp_mem_new_mobj() [all …]
|
| /optee_os/core/arch/arm/kernel/ |
| H A D | thread_optee_smc.c | 99 static uint32_t get_msg_arg(struct mobj *mobj, size_t offset, in get_msg_arg() argument 106 if (!mobj) in get_msg_arg() 109 p = mobj_get_va(mobj, offset, sizeof(struct optee_msg_arg)); in get_msg_arg() 119 if (!mobj_get_va(mobj, offset, sz)) in get_msg_arg() 126 p = mobj_get_va(mobj, offset + sz, rpc_sz); in get_msg_arg() 186 struct mobj *mobj = NULL; in std_entry_with_parg() local 220 mobj = mobj_mapped_shm_alloc(&parg, 1, 0, 0); in std_entry_with_parg() 221 if (!mobj) in std_entry_with_parg() 224 rv = get_msg_arg(mobj, 0, &num_params, &arg, &rpc_arg); in std_entry_with_parg() 226 rv = get_msg_arg(mobj, 0, &num_params, &arg, NULL); in std_entry_with_parg() [all …]
|
| H A D | rpc_io_i2c.c | 23 struct mobj *mobj = NULL; in rpc_io_i2c_transfer() local 33 req->buffer_len, &mobj); in rpc_io_i2c_transfer() 42 p[2] = THREAD_PARAM_MEMREF(INOUT, mobj, 0, req->buffer_len); in rpc_io_i2c_transfer()
|
| /optee_os/core/arch/riscv/kernel/ |
| H A D | thread_optee_abi.c | 100 static uint32_t get_msg_arg(struct mobj *mobj, size_t offset, in get_msg_arg() argument 107 if (!mobj) in get_msg_arg() 110 p = mobj_get_va(mobj, offset, sizeof(struct optee_msg_arg)); in get_msg_arg() 120 if (!mobj_get_va(mobj, offset, sz)) in get_msg_arg() 127 p = mobj_get_va(mobj, offset + sz, rpc_sz); in get_msg_arg() 187 struct mobj *mobj = NULL; in std_entry_with_parg() local 222 mobj = mobj_mapped_shm_alloc(&parg, 1, 0, 0); in std_entry_with_parg() 223 if (!mobj) in std_entry_with_parg() 226 rv = get_msg_arg(mobj, 0, &num_params, &arg, &rpc_arg); in std_entry_with_parg() 228 rv = get_msg_arg(mobj, 0, &num_params, &arg, NULL); in std_entry_with_parg() [all …]
|
| /optee_os/core/kernel/ |
| H A D | msg_param.c | 66 struct mobj *mobj; in msg_param_extract_pages() local 78 mobj = mobj_mapped_shm_alloc(&buffer, 1, 0, 0); in msg_param_extract_pages() 79 if (!mobj) in msg_param_extract_pages() 82 va = mobj_get_va(mobj, 0, SMALL_PAGE_SIZE); in msg_param_extract_pages() 96 mobj_put(mobj); in msg_param_extract_pages() 97 mobj = mobj_mapped_shm_alloc(&page, 1, 0, 0); in msg_param_extract_pages() 98 if (!mobj) in msg_param_extract_pages() 101 va = mobj_get_va(mobj, 0, SMALL_PAGE_SIZE); in msg_param_extract_pages() 111 mobj_put(mobj); in msg_param_extract_pages() 115 struct mobj *msg_param_mobj_from_noncontig(paddr_t buf_ptr, size_t size, in msg_param_mobj_from_noncontig() [all …]
|
| H A D | user_ta.c | 294 struct mobj *mobj = NULL; in user_ta_dump_ftrace() local 309 mobj = thread_rpc_alloc_payload(pl_sz); in user_ta_dump_ftrace() 310 if (!mobj) { in user_ta_dump_ftrace() 315 buf = mobj_get_va(mobj, 0, pl_sz); in user_ta_dump_ftrace() 319 res = vm_map(&utc->uctx, &va, mobj->size, prot, VM_FLAG_EPHEMERAL, in user_ta_dump_ftrace() 320 mobj, 0); in user_ta_dump_ftrace() 324 ubuf = (uint8_t *)va + mobj_get_phys_offs(mobj, mobj->phys_granule); in user_ta_dump_ftrace() 340 params[1] = THREAD_PARAM_MEMREF(IN, mobj, 0, sizeof(TEE_UUID)); in user_ta_dump_ftrace() 341 params[2] = THREAD_PARAM_MEMREF(IN, mobj, sizeof(TEE_UUID), in user_ta_dump_ftrace() 349 res = vm_unmap(&utc->uctx, va, mobj->size); in user_ta_dump_ftrace() [all …]
|
| H A D | ldelf_syscalls.c | 49 struct mobj *mobj = NULL; in ldelf_syscall_map_zi() local 67 mobj = mobj_with_fobj_alloc(f, NULL, TEE_MATTR_MEM_TYPE_TAGGED); in ldelf_syscall_map_zi() 69 if (!mobj) in ldelf_syscall_map_zi() 72 mobj, 0, pad_begin, pad_end, 0); in ldelf_syscall_map_zi() 73 mobj_put(mobj); in ldelf_syscall_map_zi() 308 struct mobj *mobj = NULL; in ldelf_syscall_map_bin() local 383 mobj = mobj_with_fobj_alloc(fs->fobj, binh->f, in ldelf_syscall_map_bin() 385 if (!mobj) { in ldelf_syscall_map_bin() 391 mobj, 0, pad_begin, pad_end, 0); in ldelf_syscall_map_bin() 392 mobj_put(mobj); in ldelf_syscall_map_bin() [all …]
|
| H A D | pseudo_ta.c | 30 static bool validate_in_param(struct ts_session *s, struct mobj *mobj) in validate_in_param() argument 33 if (!mobj) in validate_in_param() 41 if (mobj_is_nonsec(mobj)) in validate_in_param() 48 struct mobj *mobj __unused) in validate_in_param() 77 if (!validate_in_param(s, mem->mobj)) in copy_in_param() 80 TEE_Result res = mobj_inc_map(mem->mobj); in copy_in_param() 85 va = mobj_get_va(mem->mobj, mem->offs, in copy_in_param() 136 res = mobj_dec_map(param->u[n].mem.mobj); in unmap_mapped_param()
|
| H A D | ree_fs_ta.c | 63 struct mobj *mobj; member 197 size_t *ta_size, struct mobj **mobj) in rpc_load() argument 202 if (!uuid || !ta || !mobj || !ta_size) in rpc_load() 214 *mobj = thread_rpc_alloc_payload(params[1].u.memref.size); in rpc_load() 215 if (!*mobj) in rpc_load() 218 *ta = mobj_get_va(*mobj, 0, params[1].u.memref.size); in rpc_load() 231 params[1].u.memref.mobj = *mobj; in rpc_load() 236 thread_rpc_free_payload(*mobj); in rpc_load() 248 struct mobj *mobj = NULL; in ree_fs_ta_open() local 266 res = rpc_load(uuid, &ta, &ta_size, &mobj); in ree_fs_ta_open() [all …]
|
| /optee_os/core/include/kernel/ |
| H A D | thread.h | 266 struct mobj *thread_rpc_alloc_payload(size_t size); 273 void thread_rpc_free_payload(struct mobj *mobj); 283 struct mobj *thread_rpc_alloc_kernel_payload(size_t size); 291 void thread_rpc_free_kernel_payload(struct mobj *mobj); 296 struct mobj *mobj; member 330 .mobj = (_mobj), .offs = (_offs), .size = (_size) } \ 358 struct mobj *thread_rpc_alloc_global_payload(size_t size); 366 void thread_rpc_free_global_payload(struct mobj *mobj); 404 size_t size, struct mobj **mobj);
|
| H A D | thread_private.h | 26 struct mobj *mobj; member 52 struct mobj *rpc_mobj;
|
| /optee_os/core/tee/ |
| H A D | tee_fs_rpc.c | 53 struct mobj *mobj = NULL; in operation_open_dfh() local 59 TEE_FS_NAME_MAX, &mobj); in operation_open_dfh() 70 [1] = THREAD_PARAM_MEMREF(IN, mobj, 0, TEE_FS_NAME_MAX), in operation_open_dfh() 111 struct mobj *mobj; in tee_fs_rpc_read_init() local 119 data_len, &mobj); in tee_fs_rpc_read_init() 127 [1] = THREAD_PARAM_MEMREF(OUT, mobj, 0, data_len), in tee_fs_rpc_read_init() 150 struct mobj *mobj; in tee_fs_rpc_write_init() local 158 data_len, &mobj); in tee_fs_rpc_write_init() 166 [1] = THREAD_PARAM_MEMREF(IN, mobj, 0, data_len), in tee_fs_rpc_write_init() 197 struct mobj *mobj = NULL; in tee_fs_rpc_remove_dfh() local [all …]
|
| H A D | entry_std.c | 39 static struct mobj *shm_mobj; 42 static struct mobj **sdp_mem_mobjs; 48 struct mobj *mobj, in param_mem_from_mobj() argument 54 if (mobj_get_pa(mobj, 0, 0, &b) != TEE_SUCCESS) in param_mem_from_mobj() 57 if (!core_is_buffer_inside(pa, MAX(sz, 1UL), b, mobj->size)) in param_mem_from_mobj() 60 mem->mobj = mobj_get(mobj); in param_mem_from_mobj() 75 mem->mobj = NULL; in set_fmem_param() 80 mem->mobj = mobj_ffa_get_by_cookie(global_id, in set_fmem_param() 82 if (!mem->mobj) in set_fmem_param() 94 mem->mobj->size < req_size) in set_fmem_param() [all …]
|
| H A D | tee_supp_plugin_rpc.c | 28 struct mobj *mobj = NULL; in tee_invoke_supp_plugin_rpc() local 45 mobj = thread_rpc_alloc_payload(len); in tee_invoke_supp_plugin_rpc() 46 if (!mobj) { in tee_invoke_supp_plugin_rpc() 51 va = mobj_get_va(mobj, 0, len); in tee_invoke_supp_plugin_rpc() 72 params[3] = THREAD_PARAM_MEMREF(INOUT, mobj, 0, len); in tee_invoke_supp_plugin_rpc() 88 thread_rpc_free_payload(mobj); in tee_invoke_supp_plugin_rpc()
|
| H A D | socket.c | 24 struct mobj *mobj = NULL; in socket_open() local 40 params[1].memref.size, &mobj); in socket_open() 54 tpm[2] = THREAD_PARAM_MEMREF(IN, mobj, 0, params[1].memref.size); in socket_open() 89 struct mobj *mobj = NULL; in socket_send() local 105 params[1].memref.size, &mobj); in socket_send() 116 tpm[1] = THREAD_PARAM_MEMREF(IN, mobj, 0, params[1].memref.size); in socket_send() 130 struct mobj *mobj = NULL; in socket_recv() local 147 params[1].memref.size, &mobj); in socket_recv() 154 tpm[1] = THREAD_PARAM_MEMREF(OUT, mobj, 0, params[1].memref.size); in socket_recv() 177 struct mobj *mobj = NULL; in socket_ioctl() local [all …]
|
| /optee_os/core/pta/ |
| H A D | gprof.c | 21 struct mobj *mobj; in gprof_send_rpc() local 25 mobj = thread_rpc_alloc_payload(sizeof(*uuid) + len); in gprof_send_rpc() 26 if (!mobj) in gprof_send_rpc() 29 va = mobj_get_va(mobj, 0, sizeof(*uuid) + len); in gprof_send_rpc() 37 params[1] = THREAD_PARAM_MEMREF(IN, mobj, 0, sizeof(*uuid)); in gprof_send_rpc() 38 params[2] = THREAD_PARAM_MEMREF(IN, mobj, sizeof(*uuid), len); in gprof_send_rpc() 46 thread_rpc_free_payload(mobj); in gprof_send_rpc()
|
| /optee_os/core/arch/riscv/include/kernel/ |
| H A D | thread_arch.h | 203 static inline void thread_get_user_kcode(struct mobj **mobj, size_t *offset, in thread_get_user_kcode() argument 206 *mobj = NULL; in thread_get_user_kcode() 212 static inline void thread_get_user_kdata(struct mobj **mobj, size_t *offset, in thread_get_user_kdata() argument 215 *mobj = NULL; in thread_get_user_kdata()
|
| /optee_os/core/arch/arm/include/kernel/ |
| H A D | thread_arch.h | 30 struct mobj; 458 void thread_get_user_kcode(struct mobj **mobj, size_t *offset, 461 static inline void thread_get_user_kcode(struct mobj **mobj, size_t *offset, in thread_get_user_kcode() argument 464 *mobj = NULL; in thread_get_user_kcode() 477 void thread_get_user_kdata(struct mobj **mobj, size_t *offset, 480 static inline void thread_get_user_kdata(struct mobj **mobj, size_t *offset, in thread_get_user_kdata() argument 483 *mobj = NULL; in thread_get_user_kdata()
|