tee: shm: add page accessor functions
authorVolodymyr Babchuk <vlad.babchuk@gmail.com>
Wed, 29 Nov 2017 12:48:28 +0000 (14:48 +0200)
committerJens Wiklander <jens.wiklander@linaro.org>
Fri, 15 Dec 2017 12:32:30 +0000 (13:32 +0100)
In order to register a shared buffer in TEE, we need accessor
function that return list of pages for that buffer.

Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
include/linux/tee_drv.h

index 6838f25..0f86a48 100644 (file)
@@ -403,6 +403,19 @@ static inline size_t tee_shm_get_size(struct tee_shm *shm)
        return shm->size;
 }
 
+/**
+ * tee_shm_get_pages() - Get list of pages that hold shared buffer
+ * @shm:       Shared memory handle
+ * @num_pages: Number of pages will be stored there
+ * @returns pointer to pages array
+ */
+static inline struct page **tee_shm_get_pages(struct tee_shm *shm,
+                                             size_t *num_pages)
+{
+       *num_pages = shm->num_pages;
+       return shm->pages;
+}
+
 /**
  * tee_shm_get_page_offset() - Get shared buffer offset from page start
  * @shm:       Shared memory handle