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 */
30 #define TEE_SHM_PRIV BIT(7) /* Memory private to TEE driver */
38 * struct tee_context - driver specific context on file pointer data
39 * @teedev: pointer to this drivers struct tee_device
40 * @list_shm: List of shared memory object owned by this context
44 * It is needed to break circular dependency on context during
45 * shared memory release.
47 * wait for tee-supplicant daemon to be started if not present
50 * non-blocking in nature.
52 * memory buffer with a NULL pointer.
84 * struct tee_driver_ops - driver operations vtable
92 * @supp_revc: called for supplicant to get a command
93 * @supp_send: called for supplicant to send a response
94 * @shm_register: register shared memory buffer in TEE
95 * @shm_unregister: unregister shared memory buffer in TEE
121 * struct tee_desc - Describes the TEE driver to the subsystem
136 * tee_device_alloc() - Allocate a new struct tee_device instance
139 * @pool: Shared memory pool, NULL if not used
145 * @returns a pointer to a 'struct tee_device' or an ERR_PTR on failure
153 * tee_device_register() - Registers a TEE device
154 * @teedev: Device to register
156 * tee_device_unregister() need to be called to remove the @teedev if
164 * tee_device_unregister() - Removes a TEE device
165 * @teedev: Device to unregister
167 * This function should be called to remove the @teedev even if
174 * tee_session_calc_client_uuid() - Calculates client UUID for session
190 * struct tee_shm - shared memory object
192 * @paddr: physical address of the shared memory
193 * @kaddr: virtual address of the shared memory
194 * @size: size of shared memory
200 * @id: unique id of a shared memory object on this device
202 * This pool is only supposed to be accessed directly from the TEE
219 * struct tee_shm_pool_mgr - shared memory manager
221 * @private_data: private data for the shared memory manager
229 * struct tee_shm_pool_mgr_ops - shared memory pool manager operations
230 * @alloc: called when allocating shared memory
231 * @free: called when freeing shared memory
242 * tee_shm_pool_alloc() - Create a shared memory pool from shm managers
243 * @priv_mgr: manager for driver private shared memory allocations
244 * @dmabuf_mgr: manager for dma-buf shared memory allocations
249 * @returns pointer to a 'struct tee_shm_pool' or an ERR_PTR on failure.
255 * tee_shm_pool_mgr_alloc_res_mem() - Create a shm manager for reserved
256 * memory
261 * @returns pointer to a 'struct tee_shm_pool_mgr' or an ERR_PTR on failure.
269 * tee_shm_pool_mgr_destroy() - Free a shared memory manager
273 poolm->ops->destroy_poolmgr(poolm); in tee_shm_pool_mgr_destroy()
277 * struct tee_shm_pool_mem_info - holds information needed to create a shared
278 * memory pool
290 * tee_shm_pool_alloc_res_mem() - Create a shared memory pool from reserved
291 * memory range
292 * @priv_info: Information for driver private shared memory pool
293 * @dmabuf_info: Information for dma-buf shared memory pool
300 * @returns pointer to a 'struct tee_shm_pool' or an ERR_PTR on failure.
307 * tee_shm_pool_free() - Free a shared memory pool
308 * @pool: The shared memory pool to free
310 * The must be no remaining shared memory allocated from this pool when
316 * tee_get_drvdata() - Return driver_data pointer
317 * @returns the driver_data pointer supplied to tee_register().
322 * tee_shm_alloc() - Allocate shared memory
323 * @ctx: Context that allocates the shared memory
324 * @size: Requested size of shared memory
325 * @flags: Flags setting properties for the requested shared memory.
327 * Memory allocated as global shared memory is automatically freed when the
330 * TEE_SHM_DMA_BUF global shared memory will be allocated and associated
331 * with a dma-buf handle, else driver private memory.
333 * @returns a pointer to 'struct tee_shm'
339 * tee_shm_register() - Register shared memory buffer
340 * @ctx: Context that registers the shared memory
343 * @flags: Flags setting properties for the requested shared memory.
345 * @returns a pointer to 'struct tee_shm'
351 * tee_shm_is_registered() - Check if shared memory object in registered in TEE
352 * @shm: Shared memory handle
357 return shm && (shm->flags & TEE_SHM_REGISTER); in tee_shm_is_registered()
361 * tee_shm_free() - Free shared memory
362 * @shm: Handle to shared memory to free
367 * tee_shm_put() - Decrease reference count on a shared memory handle
368 * @shm: Shared memory handle
373 * tee_shm_va2pa() - Get physical address of a virtual address
374 * @shm: Shared memory handle
375 * @va: Virtual address to tranlsate
382 * tee_shm_pa2va() - Get virtual address of a physical address
383 * @shm: Shared memory handle
384 * @pa: Physical address to tranlsate
391 * tee_shm_get_va() - Get virtual address of a shared memory plus an offset
392 * @shm: Shared memory handle
393 * @offs: Offset from start of this shared memory
394 * @returns virtual address of the shared memory + offs if offs is within
395 * the bounds of this shared memory, else an ERR_PTR
400 * tee_shm_get_pa() - Get physical address of a shared memory plus an offset
401 * @shm: Shared memory handle
402 * @offs: Offset from start of this shared memory
403 * @pa: Physical address to return
404 * @returns 0 if offs is within the bounds of this shared memory, else an
410 * tee_shm_get_size() - Get size of shared memory buffer
411 * @shm: Shared memory handle
412 * @returns size of shared memory
416 return shm->size; in tee_shm_get_size()
420 * tee_shm_get_pages() - Get list of pages that hold shared buffer
421 * @shm: Shared memory handle
423 * @returns pointer to pages array
428 *num_pages = shm->num_pages; in tee_shm_get_pages()
429 return shm->pages; in tee_shm_get_pages()
433 * tee_shm_get_page_offset() - Get shared buffer offset from page start
434 * @shm: Shared memory handle
439 return shm->offset; in tee_shm_get_page_offset()
443 * tee_shm_get_id() - Get id of a shared memory object
444 * @shm: Shared memory handle
449 return shm->id; in tee_shm_get_id()
453 * tee_shm_get_from_id() - Find shared memory object and increase reference
455 * @ctx: Context owning the shared memory
456 * @id: Id of shared memory object
457 * @returns a pointer to 'struct tee_shm' on success or an ERR_PTR on failure
462 * tee_client_open_context() - Open a TEE context
464 * @match: function to check TEE device
468 * This function does an operation similar to open("/dev/teeX") in user space.
481 * tee_client_close_context() - Close a TEE context
482 * @ctx: TEE context to close
490 * tee_client_get_version() - Query version of TEE
491 * @ctx: TEE context to TEE to query
492 * @vers: Pointer to version data
498 * tee_client_open_session() - Open a session to a Trusted Application
502 * @param: Parameters passed to the Trusted Application
504 * Returns < 0 on error else see @arg->ret for result. If @arg->ret
505 * is TEEC_SUCCESS the session identifier is available in @arg->session.
512 * tee_client_close_session() - Close a session to a Trusted Application
522 * tee_client_invoke_func() - Invoke a function in a Trusted Application
526 * @param: Parameters passed to the Trusted Application
528 * Returns < 0 on error else see @arg->ret for result.
535 * tee_client_cancel_req() - Request cancellation of the previous open-session
536 * or invoke-command operations in a Trusted Application
548 switch (param->attr & TEE_IOCTL_PARAM_ATTR_TYPE_MASK) { in tee_param_is_memref()
561 * struct tee_client_device - tee based device
573 * struct tee_client_driver - tee client driver