summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeeti Desai <neetid@codeaurora.org>2015-03-17 18:20:35 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 11:04:32 -0700
commitaa786020dea1f0d4cf7d33f7d04851ffd649a149 (patch)
treec4ccc7b5bf39666442571474eb7fcd88b91f915b
parent44c62ba19941f46f20ff81081edd81c96def4fb9 (diff)
msm: move types and declarations to header file
Move all function declarations and types to the header file to make the macros and definitions available even when the CONFIG_MSM_SECURE_BUFFER is not enabled. Rename rid of the msm_ion_secure_table and msm_ion_unsecure_table to something more generic. Change-Id: Ia5ca0c52f971a67c7936c64b42cd2522aa1773fa Signed-off-by: Neeti Desai <neetid@codeaurora.org>
-rw-r--r--drivers/soc/qcom/secure_buffer.c8
-rw-r--r--drivers/staging/android/ion/ion_cma_secure_heap.c7
-rw-r--r--drivers/staging/android/ion/ion_system_secure_heap.c1
-rw-r--r--drivers/staging/android/ion/msm/msm_ion.h23
-rw-r--r--include/soc/qcom/secure_buffer.h47
5 files changed, 55 insertions, 31 deletions
diff --git a/drivers/soc/qcom/secure_buffer.c b/drivers/soc/qcom/secure_buffer.c
index 4d188a270005..94b137669368 100644
--- a/drivers/soc/qcom/secure_buffer.c
+++ b/drivers/soc/qcom/secure_buffer.c
@@ -16,12 +16,11 @@
#include <linux/highmem.h>
#include <linux/kernel.h>
#include <linux/kref.h>
-#include <linux/msm_ion.h>
#include <linux/mutex.h>
#include <linux/scatterlist.h>
#include <linux/slab.h>
#include <soc/qcom/scm.h>
-
+#include <soc/qcom/secure_buffer.h>
DEFINE_MUTEX(secure_buffer_mutex);
@@ -48,7 +47,6 @@ struct info_list {
u64 list_size;
};
-
#define MEM_PROT_ASSIGN_ID 0x16
#define MEM_PROTECT_LOCK_ID2 0x0A
#define MEM_PROTECT_LOCK_ID2_FLAT 0x11
@@ -162,7 +160,7 @@ static int secure_buffer_change_table(struct sg_table *table, int lock)
return ret;
}
-int msm_ion_secure_table(struct sg_table *table)
+int msm_secure_table(struct sg_table *table)
{
int ret;
@@ -174,7 +172,7 @@ int msm_ion_secure_table(struct sg_table *table)
}
-int msm_ion_unsecure_table(struct sg_table *table)
+int msm_unsecure_table(struct sg_table *table)
{
int ret;
diff --git a/drivers/staging/android/ion/ion_cma_secure_heap.c b/drivers/staging/android/ion/ion_cma_secure_heap.c
index fbe799c6b37a..d945b9251437 100644
--- a/drivers/staging/android/ion/ion_cma_secure_heap.c
+++ b/drivers/staging/android/ion/ion_cma_secure_heap.c
@@ -3,7 +3,7 @@
*
* Copyright (C) Linaro 2012
* Author: <benjamin.gaignard@linaro.org> for ST-Ericsson.
- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@@ -25,6 +25,7 @@
#include <linux/msm_ion.h>
#include <trace/events/kmem.h>
+#include <soc/qcom/secure_buffer.h>
#include <asm/cacheflush.h>
/* for ion_heap_ops structure */
@@ -695,7 +696,7 @@ static int ion_secure_cma_allocate(struct ion_heap *heap,
} else {
trace_ion_cp_secure_buffer_start(heap->name, len, align,
flags);
- ret = msm_ion_secure_table(buf->table);
+ ret = msm_secure_table(buf->table);
trace_ion_cp_secure_buffer_end(heap->name, len, align,
flags);
}
@@ -722,7 +723,7 @@ static void ion_secure_cma_free(struct ion_buffer *buffer)
dev_dbg(sheap->dev, "Release buffer %p\n", buffer);
if (msm_secure_v2_is_supported())
- ret = msm_ion_unsecure_table(info->table);
+ ret = msm_unsecure_table(info->table);
atomic_sub(buffer->size, &sheap->total_allocated);
BUG_ON(atomic_read(&sheap->total_allocated) < 0);
diff --git a/drivers/staging/android/ion/ion_system_secure_heap.c b/drivers/staging/android/ion/ion_system_secure_heap.c
index b7f765715980..fbdc57952fde 100644
--- a/drivers/staging/android/ion/ion_system_secure_heap.c
+++ b/drivers/staging/android/ion/ion_system_secure_heap.c
@@ -15,6 +15,7 @@
#include <linux/slab.h>
#include <linux/msm_ion.h>
+#include <soc/qcom/secure_buffer.h>
#include "ion.h"
#include "ion_priv.h"
diff --git a/drivers/staging/android/ion/msm/msm_ion.h b/drivers/staging/android/ion/msm/msm_ion.h
index d492e421a5b6..03ed13cc4e96 100644
--- a/drivers/staging/android/ion/msm/msm_ion.h
+++ b/drivers/staging/android/ion/msm/msm_ion.h
@@ -150,12 +150,6 @@ int ion_handle_get_size(struct ion_client *client, struct ion_handle *handle,
int msm_ion_do_cache_op(struct ion_client *client, struct ion_handle *handle,
void *vaddr, unsigned long len, unsigned int cmd);
-int msm_ion_secure_table(struct sg_table *table);
-
-int msm_ion_unsecure_table(struct sg_table *table);
-int msm_ion_hyp_assign_call(struct sg_table *table,
- u32 *source_vm_list, u32 source_list_size,
- u32 *dest_vm_list, u32 dest_list_size);
#else
static inline struct ion_client *msm_ion_client_create(const char *name)
{
@@ -175,23 +169,6 @@ static inline int msm_ion_do_cache_op(struct ion_client *client,
return -ENODEV;
}
-static inline int msm_ion_secure_table(struct sg_table *table)
-{
- return -ENODEV;
-}
-
-static inline int msm_ion_unsecure_table(struct sg_table *table)
-{
- return -ENODEV;
-}
-
-static inline int msm_ion_hyp_assign_call(struct sg_table *table,
- u32 *source_vm_list, u32 source_list_size,
- u32 *dest_vm_list, u32 dest_list_size)
-{
- return -ENODEV;
-}
-
#endif /* CONFIG_ION */
#endif
diff --git a/include/soc/qcom/secure_buffer.h b/include/soc/qcom/secure_buffer.h
new file mode 100644
index 000000000000..8d168fdc1f3d
--- /dev/null
+++ b/include/soc/qcom/secure_buffer.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2015, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MSM_SECURE_BUFFER_H__
+#define __MSM_SECURE_BUFFER_H__
+
+
+#ifdef CONFIG_MSM_SECURE_BUFFER
+int msm_secure_table(struct sg_table *table);
+int msm_unsecure_table(struct sg_table *table);
+int msm_ion_hyp_assign_call(struct sg_table *table,
+ u32 *source_vm_list, u32 source_list_size,
+ u32 *dest_vm_list, u32 dest_list_size);
+bool msm_secure_v2_is_supported(void);
+
+#else
+static inline int msm_secure_table(struct sg_table *table)
+{
+ return -EINVAL;
+}
+static inline int msm_unsecure_table(struct sg_table *table)
+{
+ return -EINVAL;
+}
+static inline int hyp_assign_call(struct sg_table *table,
+ u32 *source_vm_list, u32 source_list_size,
+ u32 *dest_vm_list, u32 dest_list_size);
+{
+ return -EINVAL;
+}
+static inline bool msm_secure_v2_is_supported(void)
+{
+ return false;
+}
+#endif
+#endif