gpu: ion: Factor out secure buffer code

The code for securing buffers may be used across multiple heaps.
Factor this code out to avoid duplication.

Change-Id: I2b602615f5a48f312f47dbe6ed1ef0872deaa7ed
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
msm: iommu: re-use existing buffers for `extra' mappings

There is a bug on some hardware that requires us to overmap Iommu
mappings by 2x. Currently, we set aside a dummy buffer onto which we
map all of these dummy mappings. In general, for large mappings it's
nice to use the more efficient iommu_map_range instead of calling
iommu_map repeatedly. However, with our current approach in
msm_iommu_map_extra we can't use iommu_map_range for page_sizes larger
than the dummy buffer. To avoid wasting memory by increasing the size
of the dummy buffer, we can simply remap on top of the the buffer
being mapped in the first place. Since the second mapping should never
be used (besides by the buggy hardware) this should not be a problem.

Re-use existing buffers for all `extra' mappings. Essentially, map the
same physical address range twice. To be extra safe, make the second
mapping read-only.

Change-Id: I35462ad50de8da1f2befa3e3f0895925535cdc98
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/include/mach/iommu_domains.h
	arch/arm/mach-msm/iommu_domains.c
	arch/arm/mach-msm/subsystem_map.c
	drivers/gpu/ion/ion_carveout_heap.c
	drivers/gpu/ion/ion_system_heap.c
gpu: ion: Abstract out secure heap restrictions

Multiple heaps may be allowed to allocate secure memory and
secure heaps and buffers. Create a function to determine if
a heap is permitted to do secure functions.

Change-Id: Ib3ec9b2d5620c18ba579ea56253235ca9be6d6a8
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
gpu: ion: Add secure CMA heap

CMA can now be used for large contiguous allocations. Add
a dedicated heap for secure use cases. This heap intentionally
removes some functionality such as mmaping to userspace for
secure requirements.

Change-Id: I7de94499bd005b405fed546826dae44ae8bc4e20
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>

Conflicts:
	drivers/gpu/ion/ion_heap.c
	drivers/gpu/ion/ion_priv.h