summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/android/ion/ion_cma_heap.c6
-rw-r--r--drivers/staging/android/ion/ion_cma_secure_heap.c4
-rw-r--r--drivers/staging/android/ion/ion_system_secure_heap.c14
-rw-r--r--drivers/staging/android/ion/msm/msm_ion.c18
4 files changed, 24 insertions, 18 deletions
diff --git a/drivers/staging/android/ion/ion_cma_heap.c b/drivers/staging/android/ion/ion_cma_heap.c
index bd481af4035c..ad3fdf8aa15b 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -4,6 +4,8 @@
* Copyright (C) Linaro 2012
* Author: <benjamin.gaignard@linaro.org> for ST-Ericsson.
*
+ * Copyright (c) 2020, 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
* may be copied, distributed, and modified under those terms.
@@ -221,7 +223,7 @@ struct ion_heap *ion_cma_heap_create(struct ion_platform_heap *data)
/* set device as private heaps data, later it will be
* used to make the link with reserved CMA memory */
heap->priv = data->priv;
- heap->type = ION_HEAP_TYPE_DMA;
+ heap->type = (enum ion_heap_type)ION_HEAP_TYPE_DMA;
cma_heap_has_outer_cache = data->has_outer_cache;
return heap;
}
@@ -363,7 +365,7 @@ struct ion_heap *ion_cma_secure_heap_create(struct ion_platform_heap *data)
* used to make the link with reserved CMA memory
*/
heap->priv = data->priv;
- heap->type = ION_HEAP_TYPE_HYP_CMA;
+ heap->type = (enum ion_heap_type)ION_HEAP_TYPE_HYP_CMA;
cma_heap_has_outer_cache = data->has_outer_cache;
return heap;
}
diff --git a/drivers/staging/android/ion/ion_cma_secure_heap.c b/drivers/staging/android/ion/ion_cma_secure_heap.c
index 6102b1765182..6fde2a5105c4 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-2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017, 2020, 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
@@ -854,7 +854,7 @@ struct ion_heap *ion_secure_cma_heap_create(struct ion_platform_heap *data)
mutex_init(&sheap->chunk_lock);
mutex_init(&sheap->alloc_lock);
sheap->heap.ops = &ion_secure_cma_ops;
- sheap->heap.type = ION_HEAP_TYPE_SECURE_DMA;
+ sheap->heap.type = (enum ion_heap_type)ION_HEAP_TYPE_SECURE_DMA;
sheap->npages = data->size >> PAGE_SHIFT;
sheap->base = data->base;
sheap->heap_size = data->size;
diff --git a/drivers/staging/android/ion/ion_system_secure_heap.c b/drivers/staging/android/ion/ion_system_secure_heap.c
index c7585118a41c..53662683d0e1 100644
--- a/drivers/staging/android/ion/ion_system_secure_heap.c
+++ b/drivers/staging/android/ion/ion_system_secure_heap.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2018, 2020, 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
@@ -49,10 +49,10 @@ struct prefetch_info {
static bool is_cp_flag_present(unsigned long flags)
{
- return flags && (ION_FLAG_CP_TOUCH ||
- ION_FLAG_CP_BITSTREAM ||
- ION_FLAG_CP_PIXEL ||
- ION_FLAG_CP_NON_PIXEL ||
+ return flags & (ION_FLAG_CP_TOUCH |
+ ION_FLAG_CP_BITSTREAM |
+ ION_FLAG_CP_PIXEL |
+ ION_FLAG_CP_NON_PIXEL |
ION_FLAG_CP_CAMERA);
}
@@ -117,7 +117,7 @@ static int ion_system_secure_heap_allocate(struct ion_heap *heap,
heap);
if (!ion_heap_is_system_secure_heap_type(secure_heap->heap.type) ||
- !is_cp_flag_present(flags)) {
+ !(is_cp_flag_present(flags) || (flags & ION_FLAG_SECURE))) {
pr_info("%s: Incorrect heap type or incorrect flags\n",
__func__);
return -EINVAL;
@@ -392,7 +392,7 @@ struct ion_heap *ion_system_secure_heap_create(struct ion_platform_heap *unused)
if (!heap)
return ERR_PTR(-ENOMEM);
heap->heap.ops = &system_secure_heap_ops;
- heap->heap.type = ION_HEAP_TYPE_SYSTEM_SECURE;
+ heap->heap.type = (enum ion_heap_type)ION_HEAP_TYPE_SYSTEM_SECURE;
heap->sys_heap = get_ion_heap(ION_SYSTEM_HEAP_ID);
heap->destroy_heap = false;
diff --git a/drivers/staging/android/ion/msm/msm_ion.c b/drivers/staging/android/ion/msm/msm_ion.c
index d3069fe4dd78..1a3aca407c9e 100644
--- a/drivers/staging/android/ion/msm/msm_ion.c
+++ b/drivers/staging/android/ion/msm/msm_ion.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2018, 2020, 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
@@ -809,13 +809,15 @@ long msm_ion_custom_ioctl(struct ion_client *client,
int ret;
ret = ion_walk_heaps(client, data.prefetch_data.heap_id,
- ION_HEAP_TYPE_SECURE_DMA,
- (void *)data.prefetch_data.len,
- ion_secure_cma_prefetch);
+ (enum ion_heap_type)
+ ION_HEAP_TYPE_SECURE_DMA,
+ (void *)data.prefetch_data.len,
+ ion_secure_cma_prefetch);
if (ret)
return ret;
ret = ion_walk_heaps(client, data.prefetch_data.heap_id,
+ (enum ion_heap_type)
ION_HEAP_TYPE_SYSTEM_SECURE,
(void *)&data.prefetch_data,
ion_system_secure_heap_prefetch);
@@ -828,14 +830,16 @@ long msm_ion_custom_ioctl(struct ion_client *client,
int ret;
ret = ion_walk_heaps(client, data.prefetch_data.heap_id,
- ION_HEAP_TYPE_SECURE_DMA,
- (void *)data.prefetch_data.len,
- ion_secure_cma_drain_pool);
+ (enum ion_heap_type)
+ ION_HEAP_TYPE_SECURE_DMA,
+ (void *)data.prefetch_data.len,
+ ion_secure_cma_drain_pool);
if (ret)
return ret;
ret = ion_walk_heaps(client, data.prefetch_data.heap_id,
+ (enum ion_heap_type)
ION_HEAP_TYPE_SYSTEM_SECURE,
(void *)&data.prefetch_data,
ion_system_secure_heap_drain);