diff options
author | Jens Wiklander <jens.wiklander@linaro.org> | 2016-04-27 21:56:52 +0200 |
---|---|---|
committer | Jens Wiklander <jens.wiklander@linaro.org> | 2016-06-02 11:15:14 +0200 |
commit | 4f73fa5db9e10a361768fc25d9f1b2d1cef83a8b (patch) | |
tree | 96db7912af11537595c4bbfd8ddebe4e6e99445b | |
parent | 8b2151b416935a32572334536b8f16e6ad0e5e2a (diff) |
[v10 delta] tee: generic TEE subsystem
V10 delta for "tee: generic TEE subsystem"
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
-rw-r--r-- | drivers/tee/tee.c | 79 | ||||
-rw-r--r-- | drivers/tee/tee_private.h | 56 | ||||
-rw-r--r-- | drivers/tee/tee_shm.c | 91 | ||||
-rw-r--r-- | drivers/tee/tee_shm_pool.c | 30 | ||||
-rw-r--r-- | include/linux/tee_drv.h | 23 | ||||
-rw-r--r-- | include/uapi/linux/tee.h | 9 |
6 files changed, 224 insertions, 64 deletions
diff --git a/drivers/tee/tee.c b/drivers/tee/tee.c index dbacc3e46e10..119e18ebd6b5 100644 --- a/drivers/tee/tee.c +++ b/drivers/tee/tee.c @@ -11,13 +11,13 @@ * GNU General Public License for more details. * */ -#include <linux/device.h> #include <linux/cdev.h> +#include <linux/device.h> #include <linux/fs.h> #include <linux/idr.h> #include <linux/slab.h> -#include <linux/uaccess.h> #include <linux/tee_drv.h> +#include <linux/uaccess.h> #include "tee_private.h" #define TEE_NUM_DEVICES 32 @@ -75,7 +75,7 @@ static int tee_release(struct inode *inode, struct file *filp) } static int tee_ioctl_version(struct tee_context *ctx, - struct tee_ioctl_version_data __user *uvers) + struct tee_ioctl_version_data __user *uvers) { struct tee_ioctl_version_data vers; @@ -86,7 +86,7 @@ static int tee_ioctl_version(struct tee_context *ctx, } static int tee_ioctl_shm_alloc(struct tee_context *ctx, - struct tee_ioctl_shm_alloc_data __user *udata) + struct tee_ioctl_shm_alloc_data __user *udata) { long ret; struct tee_ioctl_shm_alloc_data data; @@ -125,7 +125,8 @@ static int tee_ioctl_shm_alloc(struct tee_context *ctx, } static int params_from_user(struct tee_context *ctx, struct tee_param *params, - size_t num_params, struct tee_ioctl_param __user *uparams) + size_t num_params, + struct tee_ioctl_param __user *uparams) { size_t n; @@ -180,7 +181,7 @@ static int params_from_user(struct tee_context *ctx, struct tee_param *params, } static int params_to_user(struct tee_ioctl_param __user *uparams, - size_t num_params, struct tee_param *params) + size_t num_params, struct tee_param *params) { size_t n; @@ -220,7 +221,7 @@ static bool param_is_memref(struct tee_param *param) } static int tee_ioctl_open_session(struct tee_context *ctx, - struct tee_ioctl_buf_data __user *ubuf) + struct tee_ioctl_buf_data __user *ubuf) { int rc; size_t n; @@ -252,7 +253,7 @@ static int tee_ioctl_open_session(struct tee_context *ctx, if (arg.num_params) { params = kcalloc(arg.num_params, sizeof(struct tee_param), - GFP_KERNEL); + GFP_KERNEL); if (!params) return -ENOMEM; uparams = (struct tee_ioctl_param __user *)(uarg + 1); @@ -294,7 +295,7 @@ out: } static int tee_ioctl_invoke(struct tee_context *ctx, - struct tee_ioctl_buf_data __user *ubuf) + struct tee_ioctl_buf_data __user *ubuf) { int rc; size_t n; @@ -324,7 +325,7 @@ static int tee_ioctl_invoke(struct tee_context *ctx, if (arg.num_params) { params = kcalloc(arg.num_params, sizeof(struct tee_param), - GFP_KERNEL); + GFP_KERNEL); if (!params) return -ENOMEM; uparams = (struct tee_ioctl_param __user *)(uarg + 1); @@ -355,9 +356,8 @@ out: return rc; } - static int tee_ioctl_cancel(struct tee_context *ctx, - struct tee_ioctl_cancel_arg __user *uarg) + struct tee_ioctl_cancel_arg __user *uarg) { struct tee_ioctl_cancel_arg arg; @@ -386,8 +386,8 @@ static int tee_ioctl_close_session(struct tee_context *ctx, } static int params_to_supp(struct tee_context *ctx, - struct tee_ioctl_param __user *uparams, - size_t num_params, struct tee_param *params) + struct tee_ioctl_param __user *uparams, + size_t num_params, struct tee_param *params) { size_t n; @@ -428,7 +428,7 @@ static int params_to_supp(struct tee_context *ctx, } static int tee_ioctl_supp_recv(struct tee_context *ctx, - struct tee_ioctl_buf_data __user *ubuf) + struct tee_ioctl_buf_data __user *ubuf) { int rc; struct tee_ioctl_buf_data buf; @@ -477,8 +477,8 @@ out: return rc; } -static int params_from_supp(struct tee_param *params, - size_t num_params, struct tee_ioctl_param __user *uparams) +static int params_from_supp(struct tee_param *params, size_t num_params, + struct tee_ioctl_param __user *uparams) { size_t n; @@ -524,7 +524,7 @@ static int params_from_supp(struct tee_param *params, } static int tee_ioctl_supp_send(struct tee_context *ctx, - struct tee_ioctl_buf_data __user *ubuf) + struct tee_ioctl_buf_data __user *ubuf) { long rc; struct tee_ioctl_buf_data buf; @@ -569,7 +569,6 @@ out: return rc; } - static long tee_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { struct tee_context *ctx = filp->private_data; @@ -615,9 +614,22 @@ static void tee_release_device(struct device *dev) kfree(teedev); } +/** + * tee_device_alloc() - Allocate a new struct tee_device instance + * @teedesc: Descriptor for this driver + * @dev: Parent device for this device + * @pool: Shared memory pool, NULL if not used + * @driver_data: Private driver data for this device + * + * Allocates a new struct tee_device instance. The device is + * removed by tee_device_unregister(). + * + * @returns a pointer to a 'struct tee_device' or an ERR_PTR on failure + */ struct tee_device *tee_device_alloc(const struct tee_desc *teedesc, - struct device *dev, struct tee_shm_pool *pool, - void *driver_data) + struct device *dev, + struct tee_shm_pool *pool, + void *driver_data) { struct tee_device *teedev; void *ret; @@ -694,7 +706,7 @@ err: EXPORT_SYMBOL_GPL(tee_device_alloc); static ssize_t implementation_id_show(struct device *dev, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, char *buf) { struct tee_device *teedev = container_of(dev, struct tee_device, dev); struct tee_ioctl_version_data vers; @@ -713,6 +725,15 @@ static const struct attribute_group tee_dev_group = { .attrs = tee_dev_attrs, }; +/** + * tee_device_register() - Registers a TEE device + * @teedev: Device to register + * + * tee_device_unregister() need to be called to remove the @teedev if + * this function fails. + * + * @returns < 0 on failure + */ int tee_device_register(struct tee_device *teedev) { int rc; @@ -760,7 +781,6 @@ err_sysfs_create_group: err_device_add: cdev_del(&teedev->cdev); return rc; - } EXPORT_SYMBOL_GPL(tee_device_register); @@ -790,6 +810,14 @@ bool tee_device_get(struct tee_device *teedev) return true; } +/** + * tee_device_unregister() - Removes a TEE device + * @teedev: Device to unregister + * + * This function should be called to remove the @teedev even if + * tee_device_register() hasn't been called yet. Does nothing if + * @teedev is NULL. + */ void tee_device_unregister(struct tee_device *teedev) { if (!teedev) @@ -815,6 +843,11 @@ void tee_device_unregister(struct tee_device *teedev) } EXPORT_SYMBOL_GPL(tee_device_unregister); +/** + * tee_get_drvdata() - Return driver_data pointer + * @teedev: Device containing the driver_data pointer + * @returns the driver_data pointer supplied to tee_register(). + */ void *tee_get_drvdata(struct tee_device *teedev) { return dev_get_drvdata(&teedev->dev); diff --git a/drivers/tee/tee_private.h b/drivers/tee/tee_private.h index 95717f8c46db..549945aa4ca5 100644 --- a/drivers/tee/tee_private.h +++ b/drivers/tee/tee_private.h @@ -14,15 +14,25 @@ #ifndef TEE_PRIVATE_H #define TEE_PRIVATE_H -#include <linux/types.h> -#include <linux/device.h> #include <linux/cdev.h> #include <linux/completion.h> -#include <linux/mutex.h> +#include <linux/device.h> #include <linux/kref.h> +#include <linux/mutex.h> +#include <linux/types.h> struct tee_device; +/** + * struct tee_shm - shared memory object + * @teedev: device used to allocate the object + * @paddr: physical address of the shared memory + * @kaddr: virtual address of the shared memory + * @size: size of shared memory + * @dmabuf: dmabuf used to for exporting to user space + * @flags: defined by TEE_SHM_* in tee_drv.h + * @id: unique id of a shared memory object on this device + */ struct tee_shm { struct tee_device *teedev; phys_addr_t paddr; @@ -34,17 +44,36 @@ struct tee_shm { }; struct tee_shm_pool_mgr; + +/** + * struct tee_shm_pool_mgr_ops - shared memory pool manager operations + * @alloc: called when allocating shared memory + * @free: called when freeing shared memory + */ struct tee_shm_pool_mgr_ops { int (*alloc)(struct tee_shm_pool_mgr *poolmgr, struct tee_shm *shm, size_t size); void (*free)(struct tee_shm_pool_mgr *poolmgr, struct tee_shm *shm); }; +/** + * struct tee_shm_pool_mgr - shared memory manager + * @ops: operations + * @private_data: private data for the shared memory manager + */ struct tee_shm_pool_mgr { const struct tee_shm_pool_mgr_ops *ops; void *private_data; }; +/** + * struct tee_shm_pool - shared memory pool + * @private_mgr: pool manager for shared memory only between kernel + * and secure world + * @dma_buf_mgr: pool manager for shared memory exported to user space + * @destroy: called when destroying the pool + * @private_data: private data for the pool + */ struct tee_shm_pool { struct tee_shm_pool_mgr private_mgr; struct tee_shm_pool_mgr dma_buf_mgr; @@ -55,6 +84,20 @@ struct tee_shm_pool { #define TEE_DEVICE_FLAG_REGISTERED 0x1 #define TEE_MAX_DEV_NAME_LEN 32 +/** + * struct tee_device - TEE Device representation + * @name: name of device + * @desc: description of device + * @id: unique id of device + * @flags: represented by TEE_DEVICE_FLAG_REGISTERED above + * @dev: embedded basic device structure + * @cdev: embedded cdev + * @num_users: number of active users of this device + * @c_no_user: completion used when unregistering the device + * @mutex: mutex protecting @num_users and @idr + * @idr: register of shared memory object allocated on this device + * @pool: shared memory pool + */ struct tee_device { char name[TEE_MAX_DEV_NAME_LEN]; const struct tee_desc *desc; @@ -66,7 +109,7 @@ struct tee_device { size_t num_users; struct completion c_no_users; - struct mutex mutex; + struct mutex mutex; /* protects num_users and idr */ struct idr idr; struct tee_shm_pool *pool; @@ -74,11 +117,6 @@ struct tee_device { int tee_shm_init(void); -/** - * tee_shm_get_fd() - Increase reference count and return file descriptor - * @shm: Shared memory handle - * @returns user space file descriptor to shared memory - */ int tee_shm_get_fd(struct tee_shm *shm); bool tee_device_get(struct tee_device *teedev); diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c index 7c36728548b5..f8b1e79115f5 100644 --- a/drivers/tee/tee_shm.c +++ b/drivers/tee/tee_shm.c @@ -12,11 +12,11 @@ * */ #include <linux/device.h> +#include <linux/dma-buf.h> #include <linux/fdtable.h> +#include <linux/idr.h> #include <linux/sched.h> -#include <linux/dma-buf.h> #include <linux/slab.h> -#include <linux/idr.h> #include <linux/tee_drv.h> #include "tee_private.h" @@ -47,7 +47,8 @@ static struct sg_table *tee_shm_op_map_dma_buf(struct dma_buf_attachment } static void tee_shm_op_unmap_dma_buf(struct dma_buf_attachment *attach, - struct sg_table *table, enum dma_data_direction dir) + struct sg_table *table, + enum dma_data_direction dir) { } @@ -58,8 +59,7 @@ static void tee_shm_op_release(struct dma_buf *dmabuf) tee_shm_release(shm); } -static void *tee_shm_op_kmap_atomic(struct dma_buf *dmabuf, - unsigned long pgnum) +static void *tee_shm_op_kmap_atomic(struct dma_buf *dmabuf, unsigned long pgnum) { return NULL; } @@ -69,8 +69,7 @@ static void *tee_shm_op_kmap(struct dma_buf *dmabuf, unsigned long pgnum) return NULL; } -static int tee_shm_op_mmap(struct dma_buf *dmabuf, - struct vm_area_struct *vma) +static int tee_shm_op_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma) { struct tee_shm *shm = dmabuf->priv; size_t size = vma->vm_end - vma->vm_start; @@ -88,8 +87,21 @@ static struct dma_buf_ops tee_shm_dma_buf_ops = { .mmap = tee_shm_op_mmap, }; -struct tee_shm *tee_shm_alloc(struct tee_device *teedev, size_t size, - u32 flags) +/** + * tee_shm_alloc() - Allocate shared memory + * @teedev: Driver that allocates the shared memory + * @size: Requested size of shared memory + * @flags: Flags setting properties for the requested shared memory. + * + * Memory allocated as global shared memory is automatically freed when the + * TEE file pointer is closed. The @flags field uses the bits defined by + * TEE_SHM_* above. TEE_SHM_MAPPED must currently always be set. If + * TEE_SHM_DMA_BUF global shared memory will be allocated and associated + * with a dma-buf handle, else driver private memory. + * + * @returns a pointer to 'struct tee_shm' + */ +struct tee_shm *tee_shm_alloc(struct tee_device *teedev, size_t size, u32 flags) { struct tee_shm_pool_mgr *poolm = NULL; struct tee_shm *shm; @@ -102,7 +114,7 @@ struct tee_shm *tee_shm_alloc(struct tee_device *teedev, size_t size, return ERR_PTR(-EINVAL); } - if ((flags & ~(TEE_SHM_MAPPED|TEE_SHM_DMA_BUF))) { + if ((flags & ~(TEE_SHM_MAPPED | TEE_SHM_DMA_BUF))) { dev_err(teedev->dev.parent, "invalid shm flags 0x%x", flags); return ERR_PTR(-EINVAL); } @@ -116,7 +128,7 @@ struct tee_shm *tee_shm_alloc(struct tee_device *teedev, size_t size, goto err_dev_put; } - shm = kzalloc(sizeof(struct tee_shm), GFP_KERNEL); + shm = kzalloc(sizeof(*shm), GFP_KERNEL); if (!shm) { ret = ERR_PTR(-ENOMEM); goto err_dev_put; @@ -135,7 +147,6 @@ struct tee_shm *tee_shm_alloc(struct tee_device *teedev, size_t size, goto err_kfree; } - mutex_lock(&teedev->mutex); shm->id = idr_alloc(&teedev->idr, shm, 1, 0, GFP_KERNEL); mutex_unlock(&teedev->mutex); @@ -151,11 +162,9 @@ struct tee_shm *tee_shm_alloc(struct tee_device *teedev, size_t size, ret = ERR_CAST(shm->dmabuf); goto err_rem; } - } return shm; - err_rem: mutex_lock(&teedev->mutex); idr_remove(&teedev->idr, shm->id); @@ -170,6 +179,11 @@ err_dev_put: } EXPORT_SYMBOL_GPL(tee_shm_alloc); +/** + * tee_shm_get_fd() - Increase reference count and return file descriptor + * @shm: Shared memory handle + * @returns user space file descriptor to shared memory + */ int tee_shm_get_fd(struct tee_shm *shm) { u32 req_flags = TEE_SHM_MAPPED | TEE_SHM_DMA_BUF; @@ -184,9 +198,12 @@ int tee_shm_get_fd(struct tee_shm *shm) return fd; } +/** + * tee_shm_free() - Free shared memory + * @shm: Handle to shared memory to free + */ void tee_shm_free(struct tee_shm *shm) { - /* * dma_buf_put() decreases the dmabuf reference counter and will * call tee_shm_release() when the last reference is gone. @@ -201,6 +218,13 @@ void tee_shm_free(struct tee_shm *shm) } EXPORT_SYMBOL_GPL(tee_shm_free); +/** + * tee_shm_va2pa() - Get physical address of a virtual address + * @shm: Shared memory handle + * @va: Virtual address to tranlsate + * @pa: Returned physical address + * @returns 0 on success and < 0 on failure + */ int tee_shm_va2pa(struct tee_shm *shm, void *va, phys_addr_t *pa) { /* Check that we're in the range of the shm */ @@ -214,6 +238,13 @@ int tee_shm_va2pa(struct tee_shm *shm, void *va, phys_addr_t *pa) } EXPORT_SYMBOL_GPL(tee_shm_va2pa); +/** + * tee_shm_pa2va() - Get virtual address of a physical address + * @shm: Shared memory handle + * @pa: Physical address to tranlsate + * @va: Returned virtual address + * @returns 0 on success and < 0 on failure + */ int tee_shm_pa2va(struct tee_shm *shm, phys_addr_t pa, void **va) { /* Check that we're in the range of the shm */ @@ -233,6 +264,13 @@ int tee_shm_pa2va(struct tee_shm *shm, phys_addr_t pa, void **va) } EXPORT_SYMBOL_GPL(tee_shm_pa2va); +/** + * tee_shm_get_va() - Get virtual address of a shared memory plus an offset + * @shm: Shared memory handle + * @offs: Offset from start of this shared memory + * @returns virtual address of the shared memory + offs if offs is within + * the bounds of this shared memory, else an ERR_PTR + */ void *tee_shm_get_va(struct tee_shm *shm, size_t offs) { if (offs >= shm->size) @@ -241,6 +279,14 @@ void *tee_shm_get_va(struct tee_shm *shm, size_t offs) } EXPORT_SYMBOL_GPL(tee_shm_get_va); +/** + * tee_shm_get_pa() - Get physical address of a shared memory plus an offset + * @shm: Shared memory handle + * @offs: Offset from start of this shared memory + * @pa: Physical address to return + * @returns 0 if offs is within the bounds of this shared memory, else an + * error code. + */ int tee_shm_get_pa(struct tee_shm *shm, size_t offs, phys_addr_t *pa) { if (offs >= shm->size) @@ -251,6 +297,12 @@ int tee_shm_get_pa(struct tee_shm *shm, size_t offs, phys_addr_t *pa) } EXPORT_SYMBOL_GPL(tee_shm_get_pa); +/** + * tee_shm_get_from_id() - Find shared memory object and increase referece count + * @teedev: Driver owning the shared mmemory + * @id: Id of shared memory object + * @returns a pointer to 'struct tee_shm' on success or an ERR_PTR on failure + */ struct tee_shm *tee_shm_get_from_id(struct tee_device *teedev, int id) { struct tee_shm *shm; @@ -266,12 +318,21 @@ struct tee_shm *tee_shm_get_from_id(struct tee_device *teedev, int id) } EXPORT_SYMBOL_GPL(tee_shm_get_from_id); +/** + * tee_shm_get_id() - Get id of a shared memory object + * @shm: Shared memory handle + * @returns id + */ int tee_shm_get_id(struct tee_shm *shm) { return shm->id; } EXPORT_SYMBOL_GPL(tee_shm_get_id); +/** + * tee_shm_put() - Decrease reference count on a shared memory handle + * @shm: Shared memory handle + */ void tee_shm_put(struct tee_shm *shm) { if (shm->flags & TEE_SHM_DMA_BUF) diff --git a/drivers/tee/tee_shm_pool.c b/drivers/tee/tee_shm_pool.c index 2ef22bc5ef4d..ce5162be06a6 100644 --- a/drivers/tee/tee_shm_pool.c +++ b/drivers/tee/tee_shm_pool.c @@ -13,13 +13,13 @@ */ #include <linux/device.h> #include <linux/dma-buf.h> -#include <linux/slab.h> #include <linux/genalloc.h> +#include <linux/slab.h> #include <linux/tee_drv.h> #include "tee_private.h" static int pool_op_gen_alloc(struct tee_shm_pool_mgr *poolm, - struct tee_shm *shm, size_t size) + struct tee_shm *shm, size_t size) { unsigned long va; struct gen_pool *genpool = poolm->private_data; @@ -35,7 +35,7 @@ static int pool_op_gen_alloc(struct tee_shm_pool_mgr *poolm, } static void pool_op_gen_free(struct tee_shm_pool_mgr *poolm, - struct tee_shm *shm) + struct tee_shm *shm) { gen_pool_free(poolm->private_data, (unsigned long)shm->kaddr, shm->size); @@ -54,7 +54,8 @@ static void pool_res_mem_destroy(struct tee_shm_pool *pool) } static int pool_res_mem_mgr_init(struct tee_shm_pool_mgr *mgr, - struct tee_shm_pool_mem_info *info, int min_alloc_order) + struct tee_shm_pool_mem_info *info, + int min_alloc_order) { size_t page_mask = PAGE_SIZE - 1; struct gen_pool *genpool = NULL; @@ -84,6 +85,20 @@ static int pool_res_mem_mgr_init(struct tee_shm_pool_mgr *mgr, return 0; } +/** + * tee_shm_pool_alloc_res_mem() - Create a shared memory pool from reserved + * memory range + * @dev: Device allocating the pool + * @priv_info: Information for driver private shared memory pool + * @dmabuf_info: Information for dma-buf shared memory pool + * + * Start and end of pools will must be page aligned. + * + * Allocation with the flag TEE_SHM_DMA_BUF set will use the range supplied + * in @dmabuf, others will use the range provided by @priv. + * + * @returns pointer to a 'struct tee_shm_pool' or an ERR_PTR on failure. + */ struct tee_shm_pool *tee_shm_pool_alloc_res_mem(struct device *dev, struct tee_shm_pool_mem_info *priv_info, struct tee_shm_pool_mem_info *dmabuf_info) @@ -125,6 +140,13 @@ err: } EXPORT_SYMBOL_GPL(tee_shm_pool_alloc_res_mem); +/** + * tee_shm_pool_free() - Free a shared memory pool + * @pool: The shared memory pool to free + * + * There must be no remaining shared memory allocated from this pool when + * this function is called. + */ void tee_shm_pool_free(struct tee_shm_pool *pool) { pool->destroy(pool); diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h index 92e0d5fae3ec..b1d822734cef 100644 --- a/include/linux/tee_drv.h +++ b/include/linux/tee_drv.h @@ -67,24 +67,30 @@ struct tee_param { * @get_version: returns version of driver * @open: called when the device file is opened * @release: release this open file + * @open_session: open a new session + * @close_session: close a session + * @invoke_func: invoke a trusted function + * @cancel_req: request cancel of an ongoing invoke or open + * @supp_revc: called for supplicant to get a command + * @supp_send: called for supplicant to send a response */ struct tee_driver_ops { void (*get_version)(struct tee_device *teedev, - struct tee_ioctl_version_data *vers); + struct tee_ioctl_version_data *vers); int (*open)(struct tee_context *ctx); void (*release)(struct tee_context *ctx); int (*open_session)(struct tee_context *ctx, - struct tee_ioctl_open_session_arg *arg, - struct tee_param *param); + struct tee_ioctl_open_session_arg *arg, + struct tee_param *param); int (*close_session)(struct tee_context *ctx, u32 session); int (*invoke_func)(struct tee_context *ctx, - struct tee_ioctl_invoke_arg *arg, - struct tee_param *param); + struct tee_ioctl_invoke_arg *arg, + struct tee_param *param); int (*cancel_req)(struct tee_context *ctx, u32 cancel_id, u32 session); int (*supp_recv)(struct tee_context *ctx, u32 *func, u32 *num_params, - struct tee_param *param); + struct tee_param *param); int (*supp_send)(struct tee_context *ctx, u32 ret, u32 num_params, - struct tee_param *param); + struct tee_param *param); }; /** @@ -102,7 +108,6 @@ struct tee_desc { u32 flags; }; - /** * tee_device_alloc() - Allocate a new struct tee_device instance * @teedesc: Descriptor for this driver @@ -199,7 +204,7 @@ void *tee_get_drvdata(struct tee_device *teedev); * @returns a pointer to 'struct tee_shm' */ struct tee_shm *tee_shm_alloc(struct tee_device *teedev, size_t size, - u32 flags); + u32 flags); /** * tee_shm_free() - Free shared memory diff --git a/include/uapi/linux/tee.h b/include/uapi/linux/tee.h index 76b52ccf365b..b2bcb2394dbe 100644 --- a/include/uapi/linux/tee.h +++ b/include/uapi/linux/tee.h @@ -38,7 +38,6 @@ * data passed back and forth using TEE_IOC_CMD. */ - /* Helpers to make the ioctl defines */ #define TEE_IOC_MAGIC 0xa4 #define TEE_IOC_BASE 0 @@ -76,6 +75,7 @@ struct tee_ioctl_version_data { __u32 impl_caps; __u32 gen_caps; }; + /** * TEE_IOC_VERSION - query version of TEE * @@ -100,6 +100,7 @@ struct tee_ioctl_shm_alloc_data { __u32 flags; __s32 id; }; + /** * TEE_IOC_SHM_ALLOC - allocate shared memory * @@ -127,7 +128,6 @@ struct tee_ioctl_buf_data { __u64 buf_len; }; - /* * Attributes for struct tee_ioctl_param, selects field in the union */ @@ -303,6 +303,7 @@ struct tee_ioctl_cancel_arg { __u32 cancel_id; __u32 session; }; + /** * TEE_IOC_CANCEL - Cancels an open session or invoke */ @@ -316,6 +317,7 @@ struct tee_ioctl_cancel_arg { struct tee_ioctl_close_session_arg { __u32 session; }; + /** * TEE_IOC_CLOSE_SESSION - Closes a session */ @@ -345,6 +347,7 @@ struct tee_iocl_supp_recv_arg { * struct tee_ioctl_param params[num_params]; */ } __aligned(8); + /** * TEE_IOC_SUPPL_RECV - Receive a request for a supplicant function * @@ -354,7 +357,6 @@ struct tee_iocl_supp_recv_arg { #define TEE_IOC_SUPPL_RECV _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 6, \ struct tee_ioctl_buf_data) - /** * struct tee_iocl_supp_send_arg - Send a response to a received request * @ret: [out] return value @@ -383,7 +385,6 @@ struct tee_iocl_supp_send_arg { #define TEE_IOC_SUPPL_SEND _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 7, \ struct tee_ioctl_buf_data) - /* * Five syscalls are used when communicating with the TEE driver. * open(): opens the device associated with the driver |