xref: /linux/drivers/tee/tee_private.h (revision b615879dbfea6cf1236acbc3f2fb25ae84e07071)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2015-2016, Linaro Limited
4  */
5 #ifndef TEE_PRIVATE_H
6 #define TEE_PRIVATE_H
7 
8 #include <linux/cdev.h>
9 #include <linux/completion.h>
10 #include <linux/device.h>
11 #include <linux/dma-buf.h>
12 #include <linux/kref.h>
13 #include <linux/mutex.h>
14 #include <linux/types.h>
15 
16 /* extra references appended to shm object for registered shared memory */
17 struct tee_shm_dmabuf_ref {
18 	struct tee_shm shm;
19 	size_t offset;
20 	struct dma_buf *dmabuf;
21 	struct tee_shm *parent_shm;
22 };
23 
24 int tee_shm_get_fd(struct tee_shm *shm);
25 
26 struct tee_shm *tee_shm_alloc_user_buf(struct tee_context *ctx, size_t size);
27 struct tee_shm *tee_shm_register_user_buf(struct tee_context *ctx,
28 					  unsigned long addr, size_t length);
29 
30 int tee_heap_update_from_dma_buf(struct tee_device *teedev,
31 				 struct dma_buf *dmabuf, size_t *offset,
32 				 struct tee_shm *shm,
33 				 struct tee_shm **parent_shm);
34 
35 #endif /*TEE_PRIVATE_H*/
36