ION: Fix sparse/compiler warning

Fix the following sparse and compiler warnings for ion:

drivers/gpu/ion/ion.c:511:45: warning: Using plain integer as NULL pointer
drivers/gpu/ion/ion.c:740:20: warning: symbol 'dma_buf_ops' was not declared.
Should it be static?

drivers/gpu/ion/ion_system_heap.c:59:6: warning: symbol 'ion_system_heap_free'
was not declared. Should it be static?
drivers/gpu/ion/ion_system_heap.c:72:17: warning: symbol
'ion_system_heap_map_dma' was not declared. Should it be static?
drivers/gpu/ion/ion_system_heap.c:78:6: warning: symbol
'ion_system_heap_unmap_dma' was not declared. Should it be static?
drivers/gpu/ion/ion_system_heap.c:84:6: warning: symbol
'ion_system_heap_map_kernel' was not declared. Should it be static?
drivers/gpu/ion/ion_system_heap.c:102:6: warning: symbol
'ion_system_heap_unmap_kernel' was not declared. Should it be static?
drivers/gpu/ion/ion_system_heap.c:108:5: warning: symbol
'ion_system_heap_map_user' was not declared. Should it be static?
drivers/gpu/ion/ion_system_heap.c:167:6: warning: symbol
'ion_system_contig_heap_free' was not declared. Should it be static?
drivers/gpu/ion/ion_system_heap.c:181:17: warning: symbol
'ion_system_contig_heap_map_dma' was not declared. Should it be static?
drivers/gpu/ion/ion_system_heap.c:200:5: warning: symbol
'ion_system_contig_heap_map_user' was not declared. Should it be static?

drivers/gpu/ion/ion_carveout_heap.c:87:20: warning: symbol
'ion_carveout_heap_map_dma' was not declared. Should it be static?
drivers/gpu/ion/ion_carveout_heap.c:93:6: warning: symbol
'ion_carveout_heap_unmap_dma' was not declared. Should it be static?
drivers/gpu/ion/ion_carveout_heap.c:102:29: warning: incorrect type in return
expression (different address spaces)
drivers/gpu/ion/ion_carveout_heap.c:102:29:    expected void *
drivers/gpu/ion/ion_carveout_heap.c:102:29:    got void [noderef] <asn:2>*
drivers/gpu/ion/ion_carveout_heap.c:99:6: warning: symbol
'ion_carveout_heap_map_kernel' was not declared. Should it be static?
drivers/gpu/ion/ion_carveout_heap.c:109:29: warning: incorrect type in argument
1 (different address spaces)
drivers/gpu/ion/ion_carveout_heap.c:109:29:    expected void volatile [noderef]
<asn:2>*addr
drivers/gpu/ion/ion_carveout_heap.c:109:29:    got void *vaddr
drivers/gpu/ion/ion_carveout_heap.c:106:6: warning: symbol
'ion_carveout_heap_unmap_kernel' was not declared. Should it be static?
drivers/gpu/ion/ion_carveout_heap.c:114:5: warning: symbol
'ion_carveout_heap_map_user' was not declared. Should it be static?
gpu: ion: omap: add cached buffers support

ION buffers caching support (ION, TILER 1D buffers).

ION map is enhanced to map ion buffers as cached pages
This patch also adds IOCTLs in ION to flush and invalidate
the cached buffers
Note: TILER 2D buffers cant be mapped as cached regions to
MPU due to DMM limitation

Change-Id: Iead5ce623d8f344ef5e3faf41d1b96189663342f
Signed-off-by: Kalpesh Patil <kalpeshpatil@ti.com>
Signed-off-by: Devaraj Rangasamy <dev@ti.com>
Signed-off-by: Lajos Molnar <lajos@ti.com>
Signed-off-by: Varadarajan, Charulatha <charu@ti.com>
Signed-off-by: Devaraj Rangasamy <dev@ti.com>

Conflicts:
	drivers/gpu/ion/ion.c
	drivers/gpu/ion/ion_priv.h
gpu: ion: Add omap support to ion

Add omap support to ion

Porting from K3.1 to K3.4 by Andy Gross <andy.gross@ti.com>

Change-Id: I9d476c9553ad14239f06e0ee32ddca5e0eb4e902
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: Lakshman Gowda <lakshman79@ti.com>
Signed-off-by: Andy Gross <andy.gross@ti.com>
Signed-off-by: Varadarajan, Charulatha <charu@ti.com>
Signed-off-by: Devaraj Rangasamy <dev@ti.com>
gpu: ion: export needed functions for PVR SGX

Make ion symbols visible to kernel modules. The SGX DDK
in modular form requires these symbols to be exported.

The reason for the code movement of ion structs is due to
EXPORT_SYMBOL.s requirement that the storage size of all
function parameters is known. This is so that the kernel can
sanity-check the size of data structures at module load time.

Change-Id: I8d1d5556f3ecdd38c02413e57da929808015a3e4
Signed-off-by: Rodrigo Obregon <robregon@ti.com>
Signed-off-by: Varadarajan, Charulatha <charu@ti.com>
Signed-off-by: Devaraj Rangasamy <dev@ti.com>

Conflicts:
	drivers/gpu/ion/ion.c
gpu: ion: omap: remove static qualifier to enable omap_ion_device export

The omap_ion_device needs to be exported and hence should not be declared
static. Fixing the same.

Also added a declaration in the omap_ion.h file to make sparse happy.

Change-Id: I94882e996b27bc39915b919cc22f0251971807af
Signed-off-by: Subramaniam Chanderashekarapuram <subramaniam.ca@ti.com>
Signed-off-by: Devaraj Rangasamy <dev@ti.com>
omap-ion: Interface to export ION handles from PVR fd

Exporting omap_ion_register_pvr_export through ion. This
helps when PVR is built as a module as the abstraction
uses an exported function pointer.

Change-Id: Ie2711e568dd00a5451e6c24757fba1158e4b0ee5
Signed-off-by: Rodrigo Obregon <robregon@ti.com>
Signed-off-by: Devaraj Rangasamy <dev@ti.com>
gpu: ion: omap: add api to export ion buffers from a pvr fd

A new api, omap_ion_share_fd_to_buffers, is added.

The new api retrieves the ion handles from the pvr fd and calls
ion_share on the ion handles to return the shared buffers. The
requestor can then call ion_import using its own ion client to get
its own ion handles.

Change-Id: I338abe0724dd67ff3e268430d305ef89d13c14dd
Signed-off-by: Tyler Luu <tluu@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Varadarajan, Charulatha <charu@ti.com>
Signed-off-by: Devaraj Rangasamy <dev@ti.com>
gpu: ion: Remove check for zero len in ion_alloc

For OMAP_ION_TILER_ALLOC, ion_alloc() function is called
to create ion handle for the allocation. In this case no
allocation is required and len can be zero. Hence remove
zero len check in ion_alloc().

Change-Id: I11284e1074dcafca51530eeda876880ad1d9f773
Signed-off-by: Varadarajan, Charulatha <charu@ti.com>
Signed-off-by: Devaraj Rangasamy <dev@ti.com>
gpu: ion: fix heaps definition
gpu: ion: fix incomplete type error
gpu: ion: carveout: implement map_dma/unmap_dma

[reimplemented after google merge]
Implement map_dma and unmap_dma for ION carveout heap

This is dervied from the patch:
http://review.omapzoom.org/#/c/22237/1

Signed-off-by: Varadarajan, Charulatha <charu@ti.com>
Signed-off-by: David Schleef <ds@ti.com>
Signed-off-by: Devaraj Rangasamy <dev@ti.com>
omap: ion: implement map/unmap_dma for tiler heap

Implement map_dma and unmap_dma for ION tiler heap

Change-Id: Ifef7a5bf1579879de474a9e1bdc21da9f20e85a4
Signed-off-by: Varadarajan, Charulatha <charu@ti.com>
Signed-off-by: Devaraj Rangasamy <dev@ti.com>
gpu: ion: omap: Add OMAP_ION_HEAP_SYSTEM enum

So that it can be used for compiling the PVR driver, even though
the system heap won't actually be used.

Change-Id: Iad85f0f790558fe1a2be84204126c7a5987f1340
Signed-off-by: David Schleef <ds@ti.com>
Signed-off-by: Rodrigo Obregon <robregon@ti.com>
Signed-off-by: Devaraj Rangasamy <dev@ti.com>
ARM: Enable SG chain

Enable ARM_HAS_SG_CHAIN to allow sg_alloc_table to allocate chain of
scatterlists

Change-Id: I42cf8b2cc337a5be24014508f398cea5560e93f2
Signed-off-by: Varadarajan, Charulatha <charu@ti.com>
Signed-off-by: Atanas (Tony) Zlatinski <zlatinski@gmail.com>