Home
last modified time | relevance | path

Searched full:shm (Results 1 – 25 of 158) sorted by relevance

1234567

/linux-6.8/drivers/tee/
Dtee_shm.c33 static void release_registered_pages(struct tee_shm *shm) in release_registered_pages() argument
35 if (shm->pages) { in release_registered_pages()
36 if (shm->flags & TEE_SHM_USER_MAPPED) in release_registered_pages()
37 unpin_user_pages(shm->pages, shm->num_pages); in release_registered_pages()
39 shm_put_kernel_pages(shm->pages, shm->num_pages); in release_registered_pages()
41 kfree(shm->pages); in release_registered_pages()
45 static void tee_shm_release(struct tee_device *teedev, struct tee_shm *shm) in tee_shm_release() argument
47 if (shm->flags & TEE_SHM_POOL) { in tee_shm_release()
48 teedev->pool->ops->free(teedev->pool, shm); in tee_shm_release()
49 } else if (shm->flags & TEE_SHM_DYNAMIC) { in tee_shm_release()
[all …]
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()
Dtee_core.c294 struct tee_shm *shm; in tee_ioctl_shm_alloc() local
303 shm = tee_shm_alloc_user_buf(ctx, data.size); in tee_ioctl_shm_alloc()
304 if (IS_ERR(shm)) in tee_ioctl_shm_alloc()
305 return PTR_ERR(shm); in tee_ioctl_shm_alloc()
307 data.id = shm->id; in tee_ioctl_shm_alloc()
308 data.size = shm->size; in tee_ioctl_shm_alloc()
313 ret = tee_shm_get_fd(shm); in tee_ioctl_shm_alloc()
320 tee_shm_put(shm); in tee_ioctl_shm_alloc()
330 struct tee_shm *shm; in tee_ioctl_shm_register() local
339 shm = tee_shm_register_user_buf(ctx, data.addr, data.length); in tee_ioctl_shm_register()
[all …]
/linux-6.8/drivers/tee/optee/
Dcore.c20 int optee_pool_op_alloc_helper(struct tee_shm_pool *pool, struct tee_shm *shm, in optee_pool_op_alloc_helper() argument
23 struct tee_shm *shm, in optee_pool_op_alloc_helper()
37 shm->kaddr = alloc_pages_exact(nr_pages * PAGE_SIZE, in optee_pool_op_alloc_helper()
39 if (!shm->kaddr) in optee_pool_op_alloc_helper()
42 shm->paddr = virt_to_phys(shm->kaddr); in optee_pool_op_alloc_helper()
43 shm->size = nr_pages * PAGE_SIZE; in optee_pool_op_alloc_helper()
52 pages[i] = virt_to_page((u8 *)shm->kaddr + i * PAGE_SIZE); in optee_pool_op_alloc_helper()
54 shm->pages = pages; in optee_pool_op_alloc_helper()
55 shm->num_pages = nr_pages; in optee_pool_op_alloc_helper()
58 rc = shm_register(shm->ctx, shm, pages, nr_pages, in optee_pool_op_alloc_helper()
[all …]
Dffa_abi.c41 struct tee_shm *shm; member
61 struct tee_shm *shm = NULL; in optee_shm_from_ffa_handle() local
68 shm = r->shm; in optee_shm_from_ffa_handle()
71 return shm; in optee_shm_from_ffa_handle()
74 static int optee_shm_add_ffa_handle(struct optee *optee, struct tee_shm *shm, in optee_shm_add_ffa_handle() argument
83 r->shm = shm; in optee_shm_add_ffa_handle()
126 struct tee_shm *shm = NULL; in from_msg_param_ffa_mem() local
135 shm = optee_shm_from_ffa_handle(optee, mp->u.fmem.global_id); in from_msg_param_ffa_mem()
136 p->u.memref.shm = shm; in from_msg_param_ffa_mem()
138 if (shm) { in from_msg_param_ffa_mem()
[all …]
Dsmc_abi.c49 * A typical OP-TEE private shm allocation is 224 bytes (argument struct
85 struct tee_shm *shm; in from_msg_param_tmp_mem() local
92 shm = (struct tee_shm *)(unsigned long)mp->u.tmem.shm_ref; in from_msg_param_tmp_mem()
93 if (!shm) { in from_msg_param_tmp_mem()
95 p->u.memref.shm = NULL; in from_msg_param_tmp_mem()
99 rc = tee_shm_get_pa(shm, 0, &pa); in from_msg_param_tmp_mem()
104 p->u.memref.shm = shm; in from_msg_param_tmp_mem()
112 struct tee_shm *shm; in from_msg_param_reg_mem() local
117 shm = (struct tee_shm *)(unsigned long)mp->u.rmem.shm_ref; in from_msg_param_reg_mem()
119 if (shm) { in from_msg_param_reg_mem()
[all …]
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 …]
Drpc.c88 msg.buf = params[2].u.memref.shm->kaddr; in handle_rpc_func_cmd_i2c_transfer()
215 struct tee_shm *shm; in optee_rpc_cmd_alloc_suppl() local
228 shm = tee_shm_get_from_id(optee->supp.ctx, param.u.value.c); in optee_rpc_cmd_alloc_suppl()
230 return shm; in optee_rpc_cmd_alloc_suppl()
233 void optee_rpc_cmd_free_suppl(struct tee_context *ctx, struct tee_shm *shm) in optee_rpc_cmd_free_suppl() argument
239 param.u.value.b = tee_shm_get_id(shm); in optee_rpc_cmd_free_suppl()
253 tee_shm_put(shm); in optee_rpc_cmd_free_suppl()
/linux-6.8/drivers/tee/amdtee/
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()
Dcore.c153 u32 get_buffer_id(struct tee_shm *shm) in get_buffer_id() argument
155 struct amdtee_context_data *ctxdata = shm->ctx->data; in get_buffer_id()
161 if (shmdata->kaddr == shm->kaddr) { in get_buffer_id()
341 int amdtee_map_shmem(struct tee_shm *shm) in amdtee_map_shmem() argument
349 if (!shm) in amdtee_map_shmem()
357 shmem.kaddr = shm->kaddr; in amdtee_map_shmem()
358 shmem.size = shm->size; in amdtee_map_shmem()
371 shmnode->kaddr = shm->kaddr; in amdtee_map_shmem()
373 ctxdata = shm->ctx->data; in amdtee_map_shmem()
383 void amdtee_unmap_shmem(struct tee_shm *shm) in amdtee_unmap_shmem() argument
[all …]
/linux-6.8/include/linux/
Dtee_drv.h63 struct tee_shm *shm; member
113 int (*shm_register)(struct tee_context *ctx, struct tee_shm *shm,
116 int (*shm_unregister)(struct tee_context *ctx, struct tee_shm *shm);
206 * subsystem and from drivers that implements their own shm pool manager.
239 int (*alloc)(struct tee_shm_pool *pool, struct tee_shm *shm,
241 void (*free)(struct tee_shm_pool *pool, struct tee_shm *shm);
246 * tee_shm_pool_alloc_res_mem() - Create a shm manager for reserved memory
283 * @shm: Shared memory handle
286 static inline bool tee_shm_is_dynamic(struct tee_shm *shm) in tee_shm_is_dynamic() argument
288 return shm && (shm->flags & TEE_SHM_DYNAMIC); in tee_shm_is_dynamic()
[all …]
/linux-6.8/drivers/media/platform/samsung/s5p-mfc/
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-6.8/drivers/rtc/
Drtc-optee.c44 * @shm: Memory pool shared with RTC device.
51 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()
[all …]
/linux-6.8/drivers/nvmem/
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-6.8/Documentation/devicetree/bindings/spi/
Dnuvoton,wpcm450-fiu.yaml35 nuvoton,shm:
37 description: a phandle to the SHM block (see ../arm/nuvoton,shm.yaml)
55 nuvoton,shm = <&shm>;
63 shm: syscon@c8001000 {
64 compatible = "nuvoton,wpcm450-shm", "syscon";
/linux-6.8/sound/usb/usx2y/
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 …]
/linux-6.8/tools/testing/selftests/futex/functional/
Dfutex_wait.c9 #include <sys/shm.h>
54 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-6.8/drivers/char/tpm/
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()
Dtpm_ftpm_tee.h29 * @shm: Memory pool shared with fTPM TA in TEE.
37 struct tee_shm *shm; member
/linux-6.8/security/keys/trusted-keys/
Dtrusted_tee.c76 dev_err(pvt_data.dev, "shm register failed\n"); in trusted_tee_seal()
85 param[0].u.memref.shm = reg_shm; in trusted_tee_seal()
89 param[1].u.memref.shm = reg_shm; in trusted_tee_seal()
123 dev_err(pvt_data.dev, "shm register failed\n"); in trusted_tee_unseal()
132 param[0].u.memref.shm = reg_shm; in trusted_tee_unseal()
136 param[1].u.memref.shm = reg_shm; in trusted_tee_unseal()
169 dev_err(pvt_data.dev, "key shm register failed\n"); in trusted_tee_get_random()
178 param[0].u.memref.shm = reg_shm; in trusted_tee_get_random()
/linux-6.8/ipc/
Dshm.c3 * linux/ipc/shm.c
7 * Fixed the shm swap deallocation (shm_unuse()), August 1998 Andrea Arcangeli.
9 * /proc/sysvipc/shm support (c) 1999 Dragos Acostachioaie <dragos@iname.com>
11 * SMP thread shm, Jean-Luc Boyard <jean-luc.boyard@siemens.fr>
31 #include <linux/shm.h>
32 #include <uapi/linux/shm.h>
67 * The task created the shm object, for
158 ipc_init_proc_interface("sysvipc/shm", in shm_init()
301 /* This is called by fork, once for every shm attach. */
347 * shm_may_destroy - identifies whether shm segment should be destroyed now
[all …]
/linux-6.8/include/uapi/linux/
Dshm.h24 #define SHMALL (ULONG_MAX - (1UL << 24)) /* max shm system wide (pages) */
103 __kernel_ulong_t shm_tot; /* total allocated shm */
104 __kernel_ulong_t shm_rss; /* total resident shm */
105 __kernel_ulong_t shm_swp; /* total swapped shm */
/linux-6.8/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/
Dr535.c115 mqe = (void *)((u8 *)gsp->shm.msgq.ptr + 0x1000 + rptr * 0x1000); in r535_gsp_msgq_wait()
137 mqe = (void *)((u8 *)gsp->shm.msgq.ptr + 0x1000 + 0 * 0x1000); in r535_gsp_msgq_wait()
197 cqe = (void *)((u8 *)gsp->shm.cmdq.ptr + 0x1000 + wptr * 0x1000); in r535_gsp_cmdq_push()
1666 gsp->shm.cmdq.size = 0x40000; in r535_gsp_shared_init()
1667 gsp->shm.msgq.size = 0x40000; in r535_gsp_shared_init()
1669 gsp->shm.ptes.nr = (gsp->shm.cmdq.size + gsp->shm.msgq.size) >> GSP_PAGE_SHIFT; in r535_gsp_shared_init()
1670 gsp->shm.ptes.nr += DIV_ROUND_UP(gsp->shm.ptes.nr * sizeof(u64), GSP_PAGE_SIZE); in r535_gsp_shared_init()
1671 gsp->shm.ptes.size = ALIGN(gsp->shm.ptes.nr * sizeof(u64), GSP_PAGE_SIZE); in r535_gsp_shared_init()
1673 ret = nvkm_gsp_mem_ctor(gsp, gsp->shm.ptes.size + in r535_gsp_shared_init()
1674 gsp->shm.cmdq.size + in r535_gsp_shared_init()
[all …]
/linux-6.8/tools/testing/selftests/mm/
Dwrite_to_hugetlbfs.c16 #include <sys/shm.h>
24 SHM, enumerator
196 case SHM: in main()
197 printf("Allocating using SHM.\n"); in main()
/linux-6.8/tools/testing/selftests/proc/
Dsetns-sysvipc.c33 #include <sys/shm.h>
101 (void)open("/proc/sysvipc/shm", O_RDONLY); in main()
115 fd = open("/proc/sysvipc/shm", O_RDONLY); in main()

1234567