aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRebecca Schultz Zavin <rebecca@android.com>2012-06-14 15:08:53 -0700
committerArve Hjønnevåg <arve@android.com>2013-07-01 13:40:51 -0700
commit2007551fcd948147411012310cbf98eeed40c9d5 (patch)
tree88980e4359733fa5158091ca2f243ed9dd1238f8 /include
parentf3851c7cdfe285f5eeefadf03359fd617019baf0 (diff)
gpu: ion: Add cache maintenance to ion.
This patch adds cache maintenance operations to ion. As per mailing list discussions regarding dma_buf, cache operations are done implicitly. At buffer allocaiton time the user can select whether he'd like mappings (both kernel and user) to be cached. When cached mappings are selected, no mappings will be created for a buffer at mmap time. Instead pages will be faulted in one at a time so we can track which pages require flushing before dma. When the buffers are mapped for dma (via the dma_buf apis) any pages which were touched will be synced for device. Change-Id: Id5d6894e8bb52af038c91dd895143bf3b4203b0b Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/ion.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/include/linux/ion.h b/include/linux/ion.h
index ba09e704c19..90aaa30d4bf 100644
--- a/include/linux/ion.h
+++ b/include/linux/ion.h
@@ -44,6 +44,15 @@ enum ion_heap_type {
#define ION_HEAP_SYSTEM_CONTIG_MASK (1 << ION_HEAP_TYPE_SYSTEM_CONTIG)
#define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT)
+/**
+ * heap flags - the lower 16 bits are used by core ion, the upper 16
+ * bits are reserved for use by the heaps themselves.
+ */
+#define ION_FLAG_CACHED 1 /* mappings of this buffer should be
+ cached, ion will do cache
+ maintenance when the buffer is
+ mapped for dma */
+
#ifdef __KERNEL__
struct ion_device;
struct ion_heap;
@@ -123,14 +132,18 @@ void ion_client_destroy(struct ion_client *client);
* @len: size of the allocation
* @align: requested allocation alignment, lots of hardware blocks have
* alignment requirements of some kind
- * @flags: mask of heaps to allocate from, if multiple bits are set
+ * @heap_mask: mask of heaps to allocate from, if multiple bits are set
* heaps will be tried in order from lowest to highest order bit
+ * @flags: heap flags, the low 16 bits are consumed by ion, the high 16
+ * bits are passed on to the respective heap and can be heap
+ * custom
*
* Allocate memory in one of the heaps provided in heap mask and return
* an opaque handle to it.
*/
struct ion_handle *ion_alloc(struct ion_client *client, size_t len,
- size_t align, unsigned int flags);
+ size_t align, unsigned int heap_mask,
+ unsigned int flags);
/**
* ion_free - free a handle
@@ -220,6 +233,7 @@ struct ion_handle *ion_import_dma_buf(struct ion_client *client, int fd);
* struct ion_allocation_data - metadata passed from userspace for allocations
* @len: size of the allocation
* @align: required alignment of the allocation
+ * @heap_mask: mask of heaps to allocate from
* @flags: flags passed to heap
* @handle: pointer that will be populated with a cookie to use to refer
* to this allocation
@@ -229,6 +243,7 @@ struct ion_handle *ion_import_dma_buf(struct ion_client *client, int fd);
struct ion_allocation_data {
size_t len;
size_t align;
+ unsigned int heap_mask;
unsigned int flags;
struct ion_handle *handle;
};