gpu: ion: Delay unmapping from IOMMU.
Due to limitations in the multimedia architecure
clients might not know when a buffer can be unmapped
from the IOMMU. In addition, the multimedia architecture
causes unnecessary mappings/unmappings for the same buffers
which reduces framerates.
Add logic to delay unmapping from the IOMMU
until buffer memory is freed and unmap any outstanding
mappings to avoid virtual memory address space leak.
Change-Id: Idaeae269d9ba623e25a0cb087a89b4cbb63915af
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
diff --git a/include/linux/ion.h b/include/linux/ion.h
index ca1f198..d761e1e 100644
--- a/include/linux/ion.h
+++ b/include/linux/ion.h
@@ -110,6 +110,12 @@
#define ION_IS_CACHED(__flags) ((__flags) & (1 << ION_CACHE_SHIFT))
+/*
+ * This flag allows clients when mapping into the IOMMU to specify to
+ * defer un-mapping from the IOMMU until the buffer memory is freed.
+ */
+#define ION_IOMMU_UNMAP_DELAYED 1
+
#ifdef __KERNEL__
#include <linux/err.h>
#include <mach/ion.h>
@@ -407,6 +413,7 @@
* @iova - pointer to store the iova address
* @buffer_size - pointer to store the size of the buffer
* @flags - flags for options to map
+ * @iommu_flags - flags specific to the iommu.
*
* Maps the handle into the iova space specified via domain number. Iova
* will be allocated from the partition specified via partition_num.
@@ -416,7 +423,7 @@
int domain_num, int partition_num, unsigned long align,
unsigned long iova_length, unsigned long *iova,
unsigned long *buffer_size,
- unsigned long flags);
+ unsigned long flags, unsigned long iommu_flags);
/**
@@ -588,7 +595,8 @@
int partition_num, unsigned long align,
unsigned long iova_length, unsigned long *iova,
unsigned long *buffer_size,
- unsigned long flags)
+ unsigned long flags,
+ unsigned long iommu_flags)
{
return -ENODEV;
}