Lines Matching refs:mobj
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);
44 TEE_Result (*dec_map)(struct mobj *mobj);
47 extern struct mobj mobj_virt;
48 extern struct mobj *mobj_tee_ram_rx;
49 extern struct mobj *mobj_tee_ram_rw;
61 static inline void *mobj_get_va(struct mobj *mobj, size_t offset, size_t len) in mobj_get_va() argument
63 if (mobj && mobj->ops && mobj->ops->get_va) in mobj_get_va()
64 return mobj->ops->get_va(mobj, offset, len); in mobj_get_va()
68 static inline TEE_Result mobj_get_pa(struct mobj *mobj, size_t offs, in mobj_get_pa() argument
71 if (mobj && mobj->ops && mobj->ops->get_pa) in mobj_get_pa()
72 return mobj->ops->get_pa(mobj, offs, granule, pa); in mobj_get_pa()
76 static inline size_t mobj_get_phys_offs(struct mobj *mobj, size_t granule) in mobj_get_phys_offs() argument
78 if (mobj && mobj->ops && mobj->ops->get_phys_offs) in mobj_get_phys_offs()
79 return mobj->ops->get_phys_offs(mobj, granule); in mobj_get_phys_offs()
83 static inline TEE_Result mobj_get_mem_type(struct mobj *mobj, uint32_t *mt) in mobj_get_mem_type() argument
85 if (mobj && mobj->ops && mobj->ops->get_mem_type) in mobj_get_mem_type()
86 return mobj->ops->get_mem_type(mobj, mt); in mobj_get_mem_type()
90 static inline bool mobj_matches(struct mobj *mobj, enum buf_is_attr attr) in mobj_matches() argument
92 if (mobj && mobj->ops && mobj->ops->matches) in mobj_matches()
93 return mobj->ops->matches(mobj, attr); in mobj_matches()
107 static inline TEE_Result mobj_inc_map(struct mobj *mobj) in mobj_inc_map() argument
109 if (mobj && mobj->ops) { in mobj_inc_map()
110 if (mobj->ops->inc_map) in mobj_inc_map()
111 return mobj->ops->inc_map(mobj); in mobj_inc_map()
127 static inline TEE_Result mobj_dec_map(struct mobj *mobj) in mobj_dec_map() argument
129 if (mobj && mobj->ops) { in mobj_dec_map()
130 if (mobj->ops->dec_map) in mobj_dec_map()
131 return mobj->ops->dec_map(mobj); in mobj_dec_map()
145 static inline struct mobj *mobj_get(struct mobj *mobj) in mobj_get() argument
147 if (mobj && !refcount_inc(&mobj->refc)) in mobj_get()
150 return mobj; in mobj_get()
160 static inline void mobj_put(struct mobj *mobj) in mobj_put() argument
162 if (mobj && refcount_dec(&mobj->refc)) in mobj_put()
163 mobj->ops->free(mobj); in mobj_put()
172 static inline void mobj_put_wipe(struct mobj *mobj) in mobj_put_wipe() argument
174 if (mobj) { in mobj_put_wipe()
175 void *buf = mobj_get_va(mobj, 0, mobj->size); in mobj_put_wipe()
178 memzero_explicit(buf, mobj->size); in mobj_put_wipe()
179 mobj_put(mobj); in mobj_put_wipe()
183 static inline uint64_t mobj_get_cookie(struct mobj *mobj) in mobj_get_cookie() argument
185 if (mobj && mobj->ops && mobj->ops->get_cookie) in mobj_get_cookie()
186 return mobj->ops->get_cookie(mobj); in mobj_get_cookie()
195 static inline struct fobj *mobj_get_fobj(struct mobj *mobj) in mobj_get_fobj() argument
197 if (mobj && mobj->ops && mobj->ops->get_fobj) in mobj_get_fobj()
198 return mobj->ops->get_fobj(mobj); in mobj_get_fobj()
203 static inline bool mobj_is_nonsec(struct mobj *mobj) in mobj_is_nonsec() argument
205 return mobj_matches(mobj, CORE_MEM_NON_SEC); in mobj_is_nonsec()
208 static inline bool mobj_is_secure(struct mobj *mobj) in mobj_is_secure() argument
210 return mobj_matches(mobj, CORE_MEM_SEC); in mobj_is_secure()
213 static inline bool mobj_is_sdp_mem(struct mobj *mobj) in mobj_is_sdp_mem() argument
215 return mobj_matches(mobj, CORE_MEM_SDP_MEM); in mobj_is_sdp_mem()
218 static inline size_t mobj_get_phys_granule(struct mobj *mobj) in mobj_get_phys_granule() argument
220 if (mobj->phys_granule) in mobj_get_phys_granule()
221 return mobj->phys_granule; in mobj_get_phys_granule()
222 return mobj->size; in mobj_get_phys_granule()
225 static inline bool mobj_check_offset_and_len(struct mobj *mobj, size_t offset, in mobj_check_offset_and_len() argument
231 end_offs < mobj->size; in mobj_check_offset_and_len()
234 struct mobj *mobj_phys_alloc(paddr_t pa, size_t size, uint32_t cattr,
238 struct mobj *mobj_ffa_get_by_cookie(uint64_t cookie,
248 void mobj_ffa_sel1_spmc_delete(struct mobj_ffa *mobj);
253 void mobj_ffa_spmc_delete(struct mobj_ffa *mobj);
256 uint64_t mobj_ffa_get_cookie(struct mobj_ffa *mobj);
257 TEE_Result mobj_ffa_add_pages_at(struct mobj_ffa *mobj, unsigned int *idx,
259 TEE_Result mobj_ffa_push_to_inactive(struct mobj_ffa *mobj);
264 struct mobj *mobj_ffa_protmem_get_by_pa(paddr_t pa, paddr_size_t size);
269 struct mobj *mobj_reg_shm_alloc(paddr_t *pages, size_t num_pages,
282 struct mobj *mobj_reg_shm_get_by_cookie(uint64_t cookie);
295 void mobj_reg_shm_unguard(struct mobj *mobj);
301 struct mobj *mobj_mapped_shm_alloc(paddr_t *pages, size_t num_pages,
305 struct mobj *mobj_protmem_alloc(paddr_t pa, paddr_size_t size, uint64_t cookie,
308 struct mobj *mobj_protmem_get_by_pa(paddr_t pa, paddr_size_t size);
314 static inline struct mobj *mobj_mapped_shm_alloc(paddr_t *pages __unused, in mobj_mapped_shm_alloc()
322 static inline struct mobj *mobj_reg_shm_get_by_cookie(uint64_t cookie __unused) in mobj_reg_shm_get_by_cookie()
329 static inline struct mobj *
343 static inline struct mobj *mobj_protmem_get_by_pa(paddr_t pa __unused, in mobj_protmem_get_by_pa()
351 static inline struct mobj *
366 static inline struct mobj *
374 struct mobj *mobj_shm_alloc(paddr_t pa, size_t size, uint64_t cookie);
377 bool mobj_is_paged(struct mobj *mobj);
379 static inline bool mobj_is_paged(struct mobj *mobj __unused) in mobj_is_paged()
385 struct mobj *mobj_with_fobj_alloc(struct fobj *fobj, struct file *file,