Lines Matching +full:memory +full:- +full:to +full:- +full:memory

1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (c) 2015-2016, Linaro Limited
19 * The file describes the API provided by the generic TEE driver to the
23 #define TEE_SHM_MAPPED BIT(0) /* Memory mapped by the kernel */
24 #define TEE_SHM_DMA_BUF BIT(1) /* Memory with dma-buf handle */
25 #define TEE_SHM_EXT_DMA_BUF BIT(2) /* Memory with dma-buf handle */
26 #define TEE_SHM_REGISTER BIT(3) /* Memory registered in secure world */
27 #define TEE_SHM_USER_MAPPED BIT(4) /* Memory mapped in user space */
28 #define TEE_SHM_POOL BIT(5) /* Memory allocated from pool */
29 #define TEE_SHM_KERNEL_MAPPED BIT(6) /* Memory mapped in kernel space */
37 * struct tee_context - driver specific context on file pointer data
38 * @teedev: pointer to this drivers struct tee_device
39 * @list_shm: List of shared memory object owned by this context
43 * It is needed to break circular dependency on context during
44 * shared memory release.
46 * wait for tee-supplicant daemon to be started if not present
49 * non-blocking in nature.
51 * memory buffer with a NULL pointer.
83 * struct tee_driver_ops - driver operations vtable
91 * @supp_revc: called for supplicant to get a command
92 * @supp_send: called for supplicant to send a response
93 * @shm_register: register shared memory buffer in TEE
94 * @shm_unregister: unregister shared memory buffer in TEE
120 * struct tee_desc - Describes the TEE driver to the subsystem
135 * tee_device_alloc() - Allocate a new struct tee_device instance
138 * @pool: Shared memory pool, NULL if not used
144 * @returns a pointer to a 'struct tee_device' or an ERR_PTR on failure
152 * tee_device_register() - Registers a TEE device
153 * @teedev: Device to register
155 * tee_device_unregister() need to be called to remove the @teedev if
163 * tee_device_unregister() - Removes a TEE device
164 * @teedev: Device to unregister
166 * This function should be called to remove the @teedev even if
173 * tee_session_calc_client_uuid() - Calculates client UUID for session
189 * struct tee_shm - shared memory object
191 * @paddr: physical address of the shared memory
192 * @kaddr: virtual address of the shared memory
193 * @size: size of shared memory
197 * @dmabuf: dmabuf used to for exporting to user space
199 * @id: unique id of a shared memory object on this device
201 * This pool is only supposed to be accessed directly from the TEE
218 * struct tee_shm_pool_mgr - shared memory manager
220 * @private_data: private data for the shared memory manager
228 * struct tee_shm_pool_mgr_ops - shared memory pool manager operations
229 * @alloc: called when allocating shared memory
230 * @free: called when freeing shared memory
241 * tee_shm_pool_alloc() - Create a shared memory pool from shm managers
242 * @priv_mgr: manager for driver private shared memory allocations
243 * @dmabuf_mgr: manager for dma-buf shared memory allocations
248 * @returns pointer to a 'struct tee_shm_pool' or an ERR_PTR on failure.
254 * tee_shm_pool_mgr_alloc_res_mem() - Create a shm manager for reserved
255 * memory
260 * @returns pointer to a 'struct tee_shm_pool_mgr' or an ERR_PTR on failure.
268 * tee_shm_pool_mgr_destroy() - Free a shared memory manager
272 poolm->ops->destroy_poolmgr(poolm); in tee_shm_pool_mgr_destroy()
276 * struct tee_shm_pool_mem_info - holds information needed to create a shared
277 * memory pool
289 * tee_shm_pool_alloc_res_mem() - Create a shared memory pool from reserved
290 * memory range
291 * @priv_info: Information for driver private shared memory pool
292 * @dmabuf_info: Information for dma-buf shared memory pool
299 * @returns pointer to a 'struct tee_shm_pool' or an ERR_PTR on failure.
306 * tee_shm_pool_free() - Free a shared memory pool
307 * @pool: The shared memory pool to free
309 * The must be no remaining shared memory allocated from this pool when
315 * tee_get_drvdata() - Return driver_data pointer
316 * @returns the driver_data pointer supplied to tee_register().
321 * tee_shm_alloc() - Allocate shared memory
322 * @ctx: Context that allocates the shared memory
323 * @size: Requested size of shared memory
324 * @flags: Flags setting properties for the requested shared memory.
326 * Memory allocated as global shared memory is automatically freed when the
329 * TEE_SHM_DMA_BUF global shared memory will be allocated and associated
330 * with a dma-buf handle, else driver private memory.
332 * @returns a pointer to 'struct tee_shm'
337 * tee_shm_register() - Register shared memory buffer
338 * @ctx: Context that registers the shared memory
341 * @flags: Flags setting properties for the requested shared memory.
343 * @returns a pointer to 'struct tee_shm'
349 * tee_shm_is_registered() - Check if shared memory object in registered in TEE
350 * @shm: Shared memory handle
355 return shm && (shm->flags & TEE_SHM_REGISTER); in tee_shm_is_registered()
359 * tee_shm_free() - Free shared memory
360 * @shm: Handle to shared memory to free
365 * tee_shm_put() - Decrease reference count on a shared memory handle
366 * @shm: Shared memory handle
371 * tee_shm_va2pa() - Get physical address of a virtual address
372 * @shm: Shared memory handle
373 * @va: Virtual address to tranlsate
380 * tee_shm_pa2va() - Get virtual address of a physical address
381 * @shm: Shared memory handle
382 * @pa: Physical address to tranlsate
389 * tee_shm_get_va() - Get virtual address of a shared memory plus an offset
390 * @shm: Shared memory handle
391 * @offs: Offset from start of this shared memory
392 * @returns virtual address of the shared memory + offs if offs is within
393 * the bounds of this shared memory, else an ERR_PTR
398 * tee_shm_get_pa() - Get physical address of a shared memory plus an offset
399 * @shm: Shared memory handle
400 * @offs: Offset from start of this shared memory
401 * @pa: Physical address to return
402 * @returns 0 if offs is within the bounds of this shared memory, else an
408 * tee_shm_get_size() - Get size of shared memory buffer
409 * @shm: Shared memory handle
410 * @returns size of shared memory
414 return shm->size; in tee_shm_get_size()
418 * tee_shm_get_pages() - Get list of pages that hold shared buffer
419 * @shm: Shared memory handle
421 * @returns pointer to pages array
426 *num_pages = shm->num_pages; in tee_shm_get_pages()
427 return shm->pages; in tee_shm_get_pages()
431 * tee_shm_get_page_offset() - Get shared buffer offset from page start
432 * @shm: Shared memory handle
437 return shm->offset; in tee_shm_get_page_offset()
441 * tee_shm_get_id() - Get id of a shared memory object
442 * @shm: Shared memory handle
447 return shm->id; in tee_shm_get_id()
451 * tee_shm_get_from_id() - Find shared memory object and increase reference
453 * @ctx: Context owning the shared memory
454 * @id: Id of shared memory object
455 * @returns a pointer to 'struct tee_shm' on success or an ERR_PTR on failure
460 * tee_client_open_context() - Open a TEE context
462 * @match: function to check TEE device
466 * This function does an operation similar to open("/dev/teeX") in user space.
479 * tee_client_close_context() - Close a TEE context
480 * @ctx: TEE context to close
488 * tee_client_get_version() - Query version of TEE
489 * @ctx: TEE context to TEE to query
490 * @vers: Pointer to version data
496 * tee_client_open_session() - Open a session to a Trusted Application
500 * @param: Parameters passed to the Trusted Application
502 * Returns < 0 on error else see @arg->ret for result. If @arg->ret
503 * is TEEC_SUCCESS the session identifier is available in @arg->session.
510 * tee_client_close_session() - Close a session to a Trusted Application
520 * tee_client_invoke_func() - Invoke a function in a Trusted Application
524 * @param: Parameters passed to the Trusted Application
526 * Returns < 0 on error else see @arg->ret for result.
533 * tee_client_cancel_req() - Request cancellation of the previous open-session
534 * or invoke-command operations in a Trusted Application
546 switch (param->attr & TEE_IOCTL_PARAM_ATTR_TYPE_MASK) { in tee_param_is_memref()
559 * struct tee_client_device - tee based device
571 * struct tee_client_driver - tee client driver