gpu: ion: Add support for cached mappings that don't fault

We have found that faulting in the mappings for cached
allocations has a significant performance impact and is
only a benefit if only a small part of the buffer is
touched by the cpu (an uncommon case for software rendering).
This patch introduces a ION_FLAG_CACHED_NEEDS_SYNC
which determines whether a mapping should be created by
faulting or at mmap time.  If this flag is set,
userspace must manage the caches explictly using the SYNC ioctl.

Change-Id: I227561f49e0f382a481728fb55ac5c930fc26025
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Git-commit: 71545d66cc5afa4c930523810e62ba8ce391f621
Git-repo: https://android.googlesource.com/kernel/common
[mitchelh@codeaurora.org: merge conflicts in ion_buffer]
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
diff --git a/include/linux/ion.h b/include/linux/ion.h
index 2941d7a..7c54004 100644
--- a/include/linux/ion.h
+++ b/include/linux/ion.h
@@ -59,6 +59,9 @@
 					   cached, ion will do cache
 					   maintenance when the buffer is
 					   mapped for dma */
+#define ION_FLAG_CACHED_NEEDS_SYNC 2	/* mappings of this buffer will created
+					   at mmap time, if this is set
+					   caches must be managed manually */
 
 #ifdef __KERNEL__
 #include <linux/err.h>