gpu: ion: Add flag for forcing contiguous allocations

Previously, a parameter was added to secure heaps to only
allow secure allocations. Some clients still require
non-secure contiguous allocations even though the SMMU is
supported. Add support for those clients to force contiguous
allocations to go through.

Change-Id: I0d18d8a9ed3ab267b55c84c4ad160f8cec2c2b32
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
This commit is contained in:
Laura Abbott 2013-01-03 14:20:16 -08:00 committed by Stephen Boyd
parent 2599837db3
commit 7229a452a3
2 changed files with 12 additions and 3 deletions

View file

@ -2,7 +2,7 @@
* drivers/gpu/ion/ion_cp_heap.c
*
* Copyright (C) 2011 Google, Inc.
* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2013, 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
@ -310,6 +310,7 @@ ion_phys_addr_t ion_cp_allocate(struct ion_heap *heap,
{
unsigned long offset;
unsigned long secure_allocation = flags & ION_SECURE;
unsigned long force_contig = flags & ION_FORCE_CONTIGUOUS;
struct ion_cp_heap *cp_heap =
container_of(heap, struct ion_cp_heap, heap);
@ -322,7 +323,8 @@ ion_phys_addr_t ion_cp_allocate(struct ion_heap *heap,
return ION_CP_ALLOCATE_FAIL;
}
if (!secure_allocation && cp_heap->disallow_non_secure_allocation) {
if (!force_contig && !secure_allocation &&
cp_heap->disallow_non_secure_allocation) {
mutex_unlock(&cp_heap->lock);
pr_debug("%s: non-secure allocation disallowed from this heap\n",
__func__);

View file

@ -1,6 +1,6 @@
/*
*
* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
* Copyright (c) 2012-2013, Code Aurora Forum. 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
@ -72,6 +72,13 @@ enum cp_mem_usage {
*/
#define ION_SECURE (1 << ION_HEAP_ID_RESERVED)
/**
* Flag for clients to force contiguous memort allocation
*
* Use of this flag is carefully monitored!
*/
#define ION_FORCE_CONTIGUOUS (1 << 30)
/**
* Macro should be used with ion_heap_ids defined above.
*/