Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf5849c6 authored by Neeti Desai's avatar Neeti Desai Committed by Matt Wagantall
Browse files

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: default avatarNeeti Desai <neetid@codeaurora.org>
parent 2ca6c5c3
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -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;

+4 −3
Original line number Diff line number Diff line
@@ -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);

+1 −0
Original line number Diff line number Diff line
@@ -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"

+0 −23
Original line number Diff line number Diff line
@@ -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
+47 −0
Original line number Diff line number Diff line
/*
 * 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