Lines Matching refs:mobj

20 struct mobj {  struct
28 void *(*get_va)(struct mobj *mobj, size_t offs, size_t len); argument
29 TEE_Result (*get_pa)(struct mobj *mobj, size_t offs, size_t granule,
31 size_t (*get_phys_offs)(struct mobj *mobj, size_t granule);
32 TEE_Result (*get_cattr)(struct mobj *mobj, uint32_t *cattr);
33 bool (*matches)(struct mobj *mobj, enum buf_is_attr attr);
34 void (*free)(struct mobj *mobj);
35 uint64_t (*get_cookie)(struct mobj *mobj);
36 struct fobj *(*get_fobj)(struct mobj *mobj);
37 TEE_Result (*inc_map)(struct mobj *mobj);
38 TEE_Result (*dec_map)(struct mobj *mobj);
41 extern struct mobj mobj_virt;
42 extern struct mobj *mobj_sec_ddr;
43 extern struct mobj *mobj_tee_ram_rx;
44 extern struct mobj *mobj_tee_ram_rw;
56 static inline void *mobj_get_va(struct mobj *mobj, size_t offset, size_t len) in mobj_get_va() argument
58 if (mobj && mobj->ops && mobj->ops->get_va) in mobj_get_va()
59 return mobj->ops->get_va(mobj, offset, len); in mobj_get_va()
63 static inline TEE_Result mobj_get_pa(struct mobj *mobj, size_t offs, in mobj_get_pa() argument
66 if (mobj && mobj->ops && mobj->ops->get_pa) in mobj_get_pa()
67 return mobj->ops->get_pa(mobj, offs, granule, pa); in mobj_get_pa()
71 static inline size_t mobj_get_phys_offs(struct mobj *mobj, size_t granule) in mobj_get_phys_offs() argument
73 if (mobj && mobj->ops && mobj->ops->get_phys_offs) in mobj_get_phys_offs()
74 return mobj->ops->get_phys_offs(mobj, granule); in mobj_get_phys_offs()
78 static inline TEE_Result mobj_get_cattr(struct mobj *mobj, uint32_t *cattr) in mobj_get_cattr() argument
80 if (mobj && mobj->ops && mobj->ops->get_cattr) in mobj_get_cattr()
81 return mobj->ops->get_cattr(mobj, cattr); in mobj_get_cattr()
85 static inline bool mobj_matches(struct mobj *mobj, enum buf_is_attr attr) in mobj_matches() argument
87 if (mobj && mobj->ops && mobj->ops->matches) in mobj_matches()
88 return mobj->ops->matches(mobj, attr); in mobj_matches()
102 static inline TEE_Result mobj_inc_map(struct mobj *mobj) in mobj_inc_map() argument
104 if (mobj && mobj->ops) { in mobj_inc_map()
105 if (mobj->ops->inc_map) in mobj_inc_map()
106 return mobj->ops->inc_map(mobj); in mobj_inc_map()
122 static inline TEE_Result mobj_dec_map(struct mobj *mobj) in mobj_dec_map() argument
124 if (mobj && mobj->ops) { in mobj_dec_map()
125 if (mobj->ops->dec_map) in mobj_dec_map()
126 return mobj->ops->dec_map(mobj); in mobj_dec_map()
140 static inline struct mobj *mobj_get(struct mobj *mobj) in mobj_get() argument
142 if (mobj && !refcount_inc(&mobj->refc)) in mobj_get()
145 return mobj; in mobj_get()
155 static inline void mobj_put(struct mobj *mobj) in mobj_put() argument
157 if (mobj && refcount_dec(&mobj->refc)) in mobj_put()
158 mobj->ops->free(mobj); in mobj_put()
167 static inline void mobj_put_wipe(struct mobj *mobj) in mobj_put_wipe() argument
169 if (mobj) { in mobj_put_wipe()
170 void *buf = mobj_get_va(mobj, 0, mobj->size); in mobj_put_wipe()
173 memzero_explicit(buf, mobj->size); in mobj_put_wipe()
174 mobj_put(mobj); in mobj_put_wipe()
178 static inline uint64_t mobj_get_cookie(struct mobj *mobj) in mobj_get_cookie() argument
180 if (mobj && mobj->ops && mobj->ops->get_cookie) in mobj_get_cookie()
181 return mobj->ops->get_cookie(mobj); in mobj_get_cookie()
190 static inline struct fobj *mobj_get_fobj(struct mobj *mobj) in mobj_get_fobj() argument
192 if (mobj && mobj->ops && mobj->ops->get_fobj) in mobj_get_fobj()
193 return mobj->ops->get_fobj(mobj); in mobj_get_fobj()
198 static inline bool mobj_is_nonsec(struct mobj *mobj) in mobj_is_nonsec() argument
200 return mobj_matches(mobj, CORE_MEM_NON_SEC); in mobj_is_nonsec()
203 static inline bool mobj_is_secure(struct mobj *mobj) in mobj_is_secure() argument
205 return mobj_matches(mobj, CORE_MEM_SEC); in mobj_is_secure()
208 static inline bool mobj_is_sdp_mem(struct mobj *mobj) in mobj_is_sdp_mem() argument
210 return mobj_matches(mobj, CORE_MEM_SDP_MEM); in mobj_is_sdp_mem()
213 static inline size_t mobj_get_phys_granule(struct mobj *mobj) in mobj_get_phys_granule() argument
215 if (mobj->phys_granule) in mobj_get_phys_granule()
216 return mobj->phys_granule; in mobj_get_phys_granule()
217 return mobj->size; in mobj_get_phys_granule()
220 static inline bool mobj_check_offset_and_len(struct mobj *mobj, size_t offset, in mobj_check_offset_and_len() argument
226 end_offs < mobj->size; in mobj_check_offset_and_len()
229 struct mobj *mobj_mm_alloc(struct mobj *mobj_parent, size_t size,
232 struct mobj *mobj_phys_alloc(paddr_t pa, size_t size, uint32_t cattr,
236 struct mobj *mobj_ffa_get_by_cookie(uint64_t cookie,
244 void mobj_ffa_sel1_spmc_delete(struct mobj_ffa *mobj);
250 void mobj_ffa_sel2_spmc_delete(struct mobj_ffa *mobj);
253 uint64_t mobj_ffa_get_cookie(struct mobj_ffa *mobj);
254 TEE_Result mobj_ffa_add_pages_at(struct mobj_ffa *mobj, unsigned int *idx,
256 uint64_t mobj_ffa_push_to_inactive(struct mobj_ffa *mobj);
260 struct mobj *mobj_reg_shm_alloc(paddr_t *pages, size_t num_pages,
273 struct mobj *mobj_reg_shm_get_by_cookie(uint64_t cookie);
286 void mobj_reg_shm_unguard(struct mobj *mobj);
292 struct mobj *mobj_mapped_shm_alloc(paddr_t *pages, size_t num_pages,
297 static inline struct mobj *mobj_mapped_shm_alloc(paddr_t *pages __unused, in mobj_mapped_shm_alloc()
306 struct mobj *mobj_shm_alloc(paddr_t pa, size_t size, uint64_t cookie);
309 bool mobj_is_paged(struct mobj *mobj);
311 static inline bool mobj_is_paged(struct mobj *mobj __unused) in mobj_is_paged()
317 struct mobj *mobj_seccpy_shm_alloc(size_t size);
319 struct mobj *mobj_with_fobj_alloc(struct fobj *fobj, struct file *file);