Home
last modified time | relevance | path

Searched refs:shm (Results 1 – 25 of 58) sorted by relevance

123

/linux/drivers/tee/
H A Dtee_shm.c34 static void release_registered_pages(struct tee_shm *shm) in release_registered_pages() argument
36 if (shm->pages) { in release_registered_pages()
37 if (shm->flags & TEE_SHM_USER_MAPPED) in release_registered_pages()
38 unpin_user_pages(shm->pages, shm->num_pages); in release_registered_pages()
40 shm_put_kernel_pages(shm->pages, shm->num_pages); in release_registered_pages()
42 kfree(shm->pages); in release_registered_pages()
46 static void tee_shm_release(struct tee_device *teedev, struct tee_shm *shm) in tee_shm_release() argument
48 if (shm->flags & TEE_SHM_POOL) { in tee_shm_release()
49 teedev->pool->ops->free(teedev->pool, shm); in tee_shm_release()
50 } else if (shm->flags & TEE_SHM_DYNAMIC) { in tee_shm_release()
[all …]
H A Dtee_shm_pool.c12 static int pool_op_gen_alloc(struct tee_shm_pool *pool, struct tee_shm *shm, in pool_op_gen_alloc() argument
26 shm->kaddr = (void *)va; in pool_op_gen_alloc()
27 shm->paddr = gen_pool_virt_to_phys(genpool, va); in pool_op_gen_alloc()
28 shm->size = s; in pool_op_gen_alloc()
33 shm->flags &= ~TEE_SHM_DYNAMIC; in pool_op_gen_alloc()
37 static void pool_op_gen_free(struct tee_shm_pool *pool, struct tee_shm *shm) in pool_op_gen_free() argument
39 gen_pool_free(pool->private_data, (unsigned long)shm->kaddr, in pool_op_gen_free()
40 shm->size); in pool_op_gen_free()
41 shm->kaddr = NULL; in pool_op_gen_free()
H A Dtee_core.c291 struct tee_shm *shm; in tee_ioctl_shm_alloc() local
300 shm = tee_shm_alloc_user_buf(ctx, data.size); in tee_ioctl_shm_alloc()
301 if (IS_ERR(shm)) in tee_ioctl_shm_alloc()
302 return PTR_ERR(shm); in tee_ioctl_shm_alloc()
304 data.id = shm->id; in tee_ioctl_shm_alloc()
305 data.size = shm->size; in tee_ioctl_shm_alloc()
310 ret = tee_shm_get_fd(shm); in tee_ioctl_shm_alloc()
317 tee_shm_put(shm); in tee_ioctl_shm_alloc()
327 struct tee_shm *shm; in tee_ioctl_shm_register() local
336 shm = tee_shm_register_user_buf(ctx, data.addr, data.length); in tee_ioctl_shm_register()
[all …]
/linux/drivers/tee/amdtee/
H A Dshm_pool.c11 static int pool_op_alloc(struct tee_shm_pool *pool, struct tee_shm *shm, in pool_op_alloc() argument
26 shm->kaddr = (void *)va; in pool_op_alloc()
27 shm->paddr = __psp_pa((void *)va); in pool_op_alloc()
28 shm->size = PAGE_SIZE << order; in pool_op_alloc()
31 rc = amdtee_map_shmem(shm); in pool_op_alloc()
34 shm->kaddr = NULL; in pool_op_alloc()
41 static void pool_op_free(struct tee_shm_pool *pool, struct tee_shm *shm) in pool_op_free() argument
44 amdtee_unmap_shmem(shm); in pool_op_free()
45 free_pages((unsigned long)shm->kaddr, get_order(shm->size)); in pool_op_free()
46 shm->kaddr = NULL; in pool_op_free()
H A Dcore.c152 u32 get_buffer_id(struct tee_shm *shm) in get_buffer_id() argument
154 struct amdtee_context_data *ctxdata = shm->ctx->data; in get_buffer_id()
160 if (shmdata->kaddr == shm->kaddr) { in get_buffer_id()
340 int amdtee_map_shmem(struct tee_shm *shm) in amdtee_map_shmem() argument
348 if (!shm) in amdtee_map_shmem()
356 shmem.kaddr = shm->kaddr; in amdtee_map_shmem()
357 shmem.size = shm->size; in amdtee_map_shmem()
370 shmnode->kaddr = shm->kaddr; in amdtee_map_shmem()
372 ctxdata = shm->ctx->data; in amdtee_map_shmem()
382 void amdtee_unmap_shmem(struct tee_shm *shm) in amdtee_unmap_shmem() argument
[all …]
H A Damdtee_private.h148 int amdtee_map_shmem(struct tee_shm *shm);
150 void amdtee_unmap_shmem(struct tee_shm *shm);
171 u32 get_buffer_id(struct tee_shm *shm);
/linux/drivers/tee/optee/
H A Dffa_abi.c42 struct tee_shm *shm; member
62 struct tee_shm *shm = NULL; in optee_shm_from_ffa_handle() local
69 shm = r->shm; in optee_shm_from_ffa_handle()
72 return shm; in optee_shm_from_ffa_handle()
75 static int optee_shm_add_ffa_handle(struct optee *optee, struct tee_shm *shm, in optee_shm_add_ffa_handle() argument
84 r->shm = shm; in optee_shm_add_ffa_handle()
127 struct tee_shm *shm = NULL; in from_msg_param_ffa_mem() local
136 shm = optee_shm_from_ffa_handle(optee, mp->u.fmem.global_id); in from_msg_param_ffa_mem()
137 p->u.memref.shm = shm; in from_msg_param_ffa_mem()
139 if (shm) { in from_msg_param_ffa_mem()
[all …]
H A Dsmc_abi.c86 struct tee_shm *shm; in from_msg_param_tmp_mem() local
93 shm = (struct tee_shm *)(unsigned long)mp->u.tmem.shm_ref; in from_msg_param_tmp_mem()
94 if (!shm) { in from_msg_param_tmp_mem()
96 p->u.memref.shm = NULL; in from_msg_param_tmp_mem()
100 rc = tee_shm_get_pa(shm, 0, &pa); in from_msg_param_tmp_mem()
105 p->u.memref.shm = shm; in from_msg_param_tmp_mem()
113 struct tee_shm *shm; in from_msg_param_reg_mem() local
118 shm = (struct tee_shm *)(unsigned long)mp->u.rmem.shm_ref; in from_msg_param_reg_mem()
120 if (shm) { in from_msg_param_reg_mem()
122 p->u.memref.shm = shm; in from_msg_param_reg_mem()
[all …]
H A Dcall.c38 struct tee_shm *shm; member
238 tee_shm_free(entry->shm); in optee_shm_arg_cache_uninit()
311 entry->shm = res; in optee_get_msg_arg()
317 res = tee_shm_get_va(entry->shm, offs); in optee_get_msg_arg()
325 *shm_ret = entry->shm; in optee_get_msg_arg()
369 struct tee_shm *shm; in optee_open_session() local
378 &entry, &shm, &offs); in optee_open_session()
413 if (optee->ops->do_call_with_arg(ctx, shm, offs, in optee_open_session()
473 struct tee_shm *shm; in optee_close_session_helper() local
476 msg_arg = optee_get_msg_arg(ctx, 0, &entry, &shm, &offs); in optee_close_session_helper()
[all …]
H A Drpc.c89 msg.buf = params[2].u.memref.shm->kaddr; in handle_rpc_func_cmd_i2c_transfer()
222 struct tee_shm *shm; in optee_rpc_cmd_alloc_suppl() local
235 shm = tee_shm_get_from_id(optee->supp.ctx, param.u.value.c); in optee_rpc_cmd_alloc_suppl()
237 return shm; in optee_rpc_cmd_alloc_suppl()
240 void optee_rpc_cmd_free_suppl(struct tee_context *ctx, struct tee_shm *shm) in optee_rpc_cmd_free_suppl() argument
246 param.u.value.b = tee_shm_get_id(shm); in optee_rpc_cmd_free_suppl()
260 tee_shm_put(shm); in optee_rpc_cmd_free_suppl()
333 buf = tee_shm_get_va(params[1].u.memref.shm, in handle_rpc_func_rpmb_probe_next()
394 p0 = tee_shm_get_va(params[0].u.memref.shm, in handle_rpc_func_rpmb_frames()
396 p1 = tee_shm_get_va(params[1].u.memref.shm, in handle_rpc_func_rpmb_frames()
/linux/include/linux/
H A Dtee_core.h98 int (*shm_register)(struct tee_context *ctx, struct tee_shm *shm,
101 int (*shm_unregister)(struct tee_context *ctx, struct tee_shm *shm);
202 int (*alloc)(struct tee_shm_pool *pool, struct tee_shm *shm,
204 void (*free)(struct tee_shm_pool *pool, struct tee_shm *shm);
247 int tee_dyn_shm_alloc_helper(struct tee_shm *shm, size_t size, size_t align,
249 struct tee_shm *shm,
253 void tee_dyn_shm_free_helper(struct tee_shm *shm,
255 struct tee_shm *shm));
262 static inline bool tee_shm_is_dynamic(struct tee_shm *shm) in tee_shm_is_dynamic() argument
264 return shm && (shm->flags & TEE_SHM_DYNAMIC); in tee_shm_is_dynamic()
[all …]
H A Dtee_drv.h82 struct tee_shm *shm; member
123 void tee_shm_free(struct tee_shm *shm);
132 void *tee_shm_get_va(struct tee_shm *shm, size_t offs);
142 int tee_shm_get_pa(struct tee_shm *shm, size_t offs, phys_addr_t *pa);
149 static inline size_t tee_shm_get_size(struct tee_shm *shm) in tee_shm_get_size() argument
151 return shm->size; in tee_shm_get_size()
160 static inline struct page **tee_shm_get_pages(struct tee_shm *shm, in tee_shm_get_pages() argument
163 *num_pages = shm->num_pages; in tee_shm_get_pages()
164 return shm->pages; in tee_shm_get_pages()
172 static inline size_t tee_shm_get_page_offset(struct tee_shm *shm) in tee_shm_get_page_offset() argument
[all …]
/linux/drivers/nvmem/
H A Dstm32-bsec-optee-ta.c142 struct tee_shm *shm; in stm32_bsec_optee_ta_read() local
168 shm = tee_shm_alloc_kernel_buf(ctx, num_bytes); in stm32_bsec_optee_ta_read()
169 if (IS_ERR(shm)) { in stm32_bsec_optee_ta_read()
170 ret = PTR_ERR(shm); in stm32_bsec_optee_ta_read()
175 param[1].u.memref.shm = shm; in stm32_bsec_optee_ta_read()
186 shm_buf = tee_shm_get_va(shm, 0); in stm32_bsec_optee_ta_read()
196 tee_shm_free(shm); in stm32_bsec_optee_ta_read()
207 { struct tee_shm *shm; in stm32_bsec_optee_ta_write() local
233 shm = tee_shm_alloc_kernel_buf(ctx, bytes); in stm32_bsec_optee_ta_write()
234 if (IS_ERR(shm)) { in stm32_bsec_optee_ta_write()
[all …]
/linux/drivers/media/platform/samsung/s5p-mfc/
H A Ds5p_mfc_opr_v5.c224 ctx->shm.size = buf_size->shm; in s5p_mfc_alloc_instance_buffer_v5()
225 ret = s5p_mfc_alloc_priv_buf(dev, BANK_L_CTX, &ctx->shm); in s5p_mfc_alloc_instance_buffer_v5()
233 ctx->shm.ofs = ctx->shm.dma - dev->dma_base[BANK_L_CTX]; in s5p_mfc_alloc_instance_buffer_v5()
234 BUG_ON(ctx->shm.ofs & ((1 << MFC_BANK1_ALIGN_ORDER) - 1)); in s5p_mfc_alloc_instance_buffer_v5()
236 memset(ctx->shm.virt, 0, buf_size->shm); in s5p_mfc_alloc_instance_buffer_v5()
245 s5p_mfc_release_priv_buf(ctx->dev, &ctx->shm); in s5p_mfc_release_instance_buffer_v5()
263 *(u32 *)(ctx->shm.virt + ofs) = data; in s5p_mfc_write_info_v5()
271 return *(u32 *)(ctx->shm.virt + ofs); in s5p_mfc_read_info_v5()
358 mfc_write(dev, ctx->shm.ofs, S5P_FIMV_SI_CH0_HOST_WR_ADR); in s5p_mfc_set_shared_buffer()
681 unsigned int shm; in s5p_mfc_set_enc_params() local
[all …]
/linux/drivers/tee/tstee/
H A Dcore.c167 struct tee_shm *shm = NULL; in tstee_invoke_func() local
194 shm = tee_shm_get_from_id(ctx, shm_id); in tstee_invoke_func()
195 if (IS_ERR(shm)) in tstee_invoke_func()
196 return PTR_ERR(shm); in tstee_invoke_func()
198 if (shm->size < req_len) { in tstee_invoke_func()
205 handle = shm->sec_world_id; in tstee_invoke_func()
232 if (shm && shm->size >= ffa_args[TS_RPC_SERVICE_RESP_LEN]) in tstee_invoke_func()
236 if (shm) in tstee_invoke_func()
237 tee_shm_put(shm); in tstee_invoke_func()
242 static int tstee_shm_register(struct tee_context *ctx, struct tee_shm *shm, in tstee_shm_register() argument
[all …]
/linux/drivers/rtc/
H A Drtc-optee.c51 struct tee_shm *shm; member
69 param[0].u.memref.shm = priv->shm; in optee_rtc_readtime()
76 optee_tm = tee_shm_get_va(priv->shm, 0); in optee_rtc_readtime()
117 param[0].u.memref.shm = priv->shm; in optee_rtc_settime()
120 rtc_data = tee_shm_get_va(priv->shm, 0); in optee_rtc_settime()
204 param[0].u.memref.shm = priv->shm; in optee_rtc_read_info()
211 info = tee_shm_get_va(priv->shm, 0); in optee_rtc_read_info()
247 struct tee_shm *shm; in optee_rtc_probe() local
277 shm = tee_shm_alloc_kernel_buf(priv->ctx, sizeof(struct optee_rtc_info)); in optee_rtc_probe()
278 if (IS_ERR(shm)) { in optee_rtc_probe()
[all …]
/linux/drivers/char/tpm/
H A Dtpm_ftpm_tee.c81 struct tee_shm *shm = pvt_data->shm; in ftpm_tee_tpm_op_send() local
105 .shm = shm, in ftpm_tee_tpm_op_send()
111 temp_buf = tee_shm_get_va(shm, 0); in ftpm_tee_tpm_op_send()
123 .shm = shm, in ftpm_tee_tpm_op_send()
137 temp_buf = tee_shm_get_va(shm, command_params[1].u.memref.shm_offs); in ftpm_tee_tpm_op_send()
256 pvt_data->shm = tee_shm_alloc_kernel_buf(pvt_data->ctx, in ftpm_tee_probe()
259 if (IS_ERR(pvt_data->shm)) { in ftpm_tee_probe()
289 tee_shm_free(pvt_data->shm); in ftpm_tee_probe()
323 tee_shm_free(pvt_data->shm); in ftpm_tee_remove()
351 tee_shm_free(pvt_data->shm); in ftpm_plat_tee_shutdown()
/linux/sound/usb/usx2y/
H A Dusx2yhwdeppcm.c107 struct snd_usx2y_hwdep_pcm_shm *shm = usx2y->hwdep_pcm_shm; in usx2y_hwdep_urb_play_prepare() local
110 if (shm->playback_iso_start < 0) { in usx2y_hwdep_urb_play_prepare()
111 shm->playback_iso_start = shm->captured_iso_head - in usx2y_hwdep_urb_play_prepare()
113 if (shm->playback_iso_start < 0) in usx2y_hwdep_urb_play_prepare()
114 shm->playback_iso_start += ARRAY_SIZE(shm->captured_iso); in usx2y_hwdep_urb_play_prepare()
115 shm->playback_iso_head = shm->playback_iso_start; in usx2y_hwdep_urb_play_prepare()
121 counts = shm->captured_iso[shm->playback_iso_head].length / usx2y->stride; in usx2y_hwdep_urb_play_prepare()
127 urb->iso_frame_desc[pack].offset = shm->captured_iso[shm->playback_iso_head].offset; in usx2y_hwdep_urb_play_prepare()
128 urb->iso_frame_desc[pack].length = shm->captured_iso[shm->playback_iso_head].length; in usx2y_hwdep_urb_play_prepare()
132 if (++shm->playback_iso_head >= ARRAY_SIZE(shm->captured_iso)) in usx2y_hwdep_urb_play_prepare()
[all …]
H A DusX2Yhwdep.c67 struct us428ctls_sharedmem *shm = us428->us428ctls_sharedmem; in snd_us428ctls_poll() local
74 if (shm && shm->ctl_snapshot_last != shm->ctl_snapshot_red) in snd_us428ctls_poll()
/linux/tools/testing/selftests/futex/functional/
H A Dfutex_wait.c54 void *shm; in main() local
137 shm = mmap(NULL, sizeof(f_private), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); in main()
138 if (shm == MAP_FAILED) { in main()
143 memcpy(shm, &f_private, sizeof(f_private)); in main()
145 futex = shm; in main()
154 res = futex_wake(shm, 1, 0); in main()
165 munmap(shm, sizeof(f_private)); in main()
/linux/security/keys/trusted-keys/
H A Dtrusted_tee.c85 param[0].u.memref.shm = reg_shm; in trusted_tee_seal()
89 param[1].u.memref.shm = reg_shm; in trusted_tee_seal()
132 param[0].u.memref.shm = reg_shm; in trusted_tee_unseal()
136 param[1].u.memref.shm = reg_shm; in trusted_tee_unseal()
178 param[0].u.memref.shm = reg_shm; in trusted_tee_get_random()
/linux/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/
H A Dr535.c120 mqe = (void *)((u8 *)gsp->shm.msgq.ptr + 0x1000 + rptr * 0x1000); in r535_gsp_msgq_wait()
140 mqe = (void *)((u8 *)gsp->shm.msgq.ptr + 0x1000 + 0 * 0x1000); in r535_gsp_msgq_wait()
200 cqe = (void *)((u8 *)gsp->shm.cmdq.ptr + 0x1000 + wptr * 0x1000); in r535_gsp_cmdq_push()
2003 gsp->shm.cmdq.size = 0x40000; in r535_gsp_shared_init()
2004 gsp->shm.msgq.size = 0x40000; in r535_gsp_shared_init()
2006 gsp->shm.ptes.nr = (gsp->shm.cmdq.size + gsp->shm.msgq.size) >> GSP_PAGE_SHIFT; in r535_gsp_shared_init()
2007 gsp->shm.ptes.nr += DIV_ROUND_UP(gsp->shm.ptes.nr * sizeof(u64), GSP_PAGE_SIZE); in r535_gsp_shared_init()
2008 gsp->shm.ptes.size = ALIGN(gsp->shm.ptes.nr * sizeof(u64), GSP_PAGE_SIZE); in r535_gsp_shared_init()
2010 ret = nvkm_gsp_mem_ctor(gsp, gsp->shm.ptes.size + in r535_gsp_shared_init()
2011 gsp->shm.cmdq.size + in r535_gsp_shared_init()
[all …]
/linux/Documentation/translations/zh_CN/filesystems/
H A Dtmpfs.rst36 2) glibc 2.2及更高版本期望将tmpfs挂载在/dev/shm上以用于POSIX共享内存
39 tmpfs /dev/shm tmpfs defaults 0 0
44 tmpfs的前身(shm fs)才能使用SYSV共享内存)
/linux/Documentation/translations/zh_TW/filesystems/
H A Dtmpfs.rst36 2) glibc 2.2及更高版本期望將tmpfs掛載在/dev/shm上以用於POSIX共享內存
39 tmpfs /dev/shm tmpfs defaults 0 0
44 tmpfs的前身(shm fs)才能使用SYSV共享內存)
/linux/drivers/firmware/efi/stmm/
H A Dtee_stmm_efi.c58 struct tee_shm *shm = NULL; in tee_mm_communicate() local
70 shm = tee_shm_register_kernel_buf(pvt_data.ctx, comm_buf, buf_size); in tee_mm_communicate()
71 if (IS_ERR(shm)) { in tee_mm_communicate()
84 param[0].u.memref.shm = shm; in tee_mm_communicate()
90 tee_shm_free(shm); in tee_mm_communicate()

123