gpu: ion: include msm-specific ion header

All msm_ion clients need to use <linux/msm_ion.h> instead of
<linux/ion.h>

Change-Id: I4f999e301d147ec3242a33ee75b10b6501d42a70
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
gpu: ion: move msm-specific ioctls to custom_ioctl

To avoid collisions with future ioctls that may be added to ion,
msm-specific ioctls should use the `custom_ioctl' interface provided
by struct ion_device, as originally intended.

Change-Id: I68d32b81c7691fd3f54f38acfdc17fee2573bc44
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
gpu: ion: Return error value when iommu map fails

When __ion_map_iommu returns a non-zero value (i.e.
error occured), properly propagate this error back
up to the client.

Change-Id: I6cd5ce8a723ad1cbbd6c42b712f5a19fa2ba719f
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
gpu: ion: IOCTL return success when error occurs

ION_IOC_IMPORT may return success when an error occurs. Add correct
error handling to ION_IOC_IMPORT.

Change-Id: I5aa552fae0e11b623fba4eed65b5c3c9c8b21597
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[mitchelh@codeaurora.org: re-adding patch that fell out]
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
ion: change ion buffer flags

This syncs up our ion buffer flags in ion.h with upstream (using
ION_FLAG_CACHED instead of CACHED and UNCACHED).

Change-Id: I0bca35210da403098a12747ddadb51fa399f8758
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
ion: Port heap mask change to ion

Heap mask field passes as argument at allocation time to specify ion
heap.

Change-Id: I8881dfc491dc0f8f70581ad97b35756a6a33dd6d
Signed-off-by: Hanumant Singh <hanumant@codeaurora.org>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/qdsp5v2/audio_amrnb_in.c
	arch/arm/mach-msm/qdsp5v2/audio_evrc_in.c
	arch/arm/mach-msm/qdsp5v2/audio_qcelp_in.c
	arch/arm/mach-msm/qdsp5v2/audio_wma.c
	arch/arm/mach-msm/qdsp6v2/adsprpc.c
	drivers/media/video/msm_vidc/msm_smem.c
	drivers/video/msm/mdss/mdss_mdp_wb.c
	sound/soc/msm/qdsp6v2/q6voice.c

Conflicts:

	drivers/media/video/msm_vidc/msm_smem.c
	drivers/video/msm/mdss/mdss_mdp_wb.c
	sound/soc/msm/qdsp6v2/q6voice.c
Add heap_mask to ion_allocation_data
ion: change ion kernel map function to not take flags argument

Buffer flags are going to be specified at allocation time rather than
map time. This removes the flags argument from the ion kernel map
function.

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

Conflicts:

	arch/arm/mach-msm/qdsp5v2/audio_amrnb_in.c
	arch/arm/mach-msm/qdsp5v2/audio_evrc_in.c
	arch/arm/mach-msm/qdsp5v2/audio_qcelp_in.c
	arch/arm/mach-msm/qdsp5v2/audio_wma.c
	arch/arm/mach-msm/qdsp6v2/adsprpc.c
	drivers/media/dvb/mpq/video/mpq_dvb_video.c
	drivers/media/video/msm_wfd/enc-venus-subdev.c
	drivers/media/video/msm_wfd/wfd-ioctl.c
	drivers/video/msm/mdss/mdss_mdp_wb.c
	sound/soc/msm/qdsp6v2/q6voice.c

Conflicts:

	drivers/media/video/msm_wfd/wfd-ioctl.c
	sound/soc/msm/qdsp6v2/q6voice.c
ion: remove ion_share_set_flags

Due to changes in the semantics of the `flags' field of `struct
ion_buffer', it is no longer necessary to set the flags when setting
up an ion share.

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

Conflicts:

	drivers/gpu/ion/ion.c
ion: isolate msm-specific ion extensions

This is another step in the process of isolating msm-specific ion
features from stock ion.

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

Conflicts:

	include/linux/ion.h

Conflicts:

	include/linux/ion.h
j1: isolate msm-specific ion extensions

This is another step in the process of isolating msm-specific ion
features from stock ion.

Change-Id: Ic2979d6f822bcfc9b61eec3e889a8ebe605d4a45

Conflicts:

	arch/arm/mach-msm/lge/mako/board-mako.c
msm: display: include msm-specific ion header

All msm_ion clients need to use <linux/msm_ion.h> instead of
<linux/ion.h>

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

Conflicts:

	drivers/video/msm/mdss/mdss.h
	drivers/video/msm/mdss/mdss_mdp_util.c

Conflicts:

	drivers/char/msm_rotator.c
	drivers/video/msm/mdss/mdss_mdp_util.c
ion: remove obsolete ion flags

The symbols CACHED and UNCACHED have been replaced by ION_FLAG_CACHED
upstream. This removes them from the kernel.

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

Conflicts:

	drivers/media/video/msm/msm_mctl_buf.c
	drivers/media/video/msm/msm_mem.c
	drivers/media/video/msm/vfe/msm_vfe_stats_buf.c
	drivers/media/video/videobuf2-msm-mem.c
	drivers/video/msm/vidc/1080p/ddl/vcd_ddl_utils.c
	drivers/video/msm/vidc/1080p/resource_tracker/vcd_res_tracker.c
	drivers/video/msm/vidc/common/dec/vdec.c
	drivers/video/msm/vidc/common/enc/venc_internal.c
	drivers/video/msm/vidc/common/vcd/vcd_sub.c
gpu: ion: Add response to secure scm call

The API for securing buffers now requires a response buffer.
Pass in the appropriate buffer and size.

Change-Id: I25ed77f539e775b089c71a96120edf37132acd0d
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
gpu: ion: Add extra metadata for secure buffers

Newer versions of content protection allow for securing of individual
buffers instead of the full heap range. Add extra metadata about
each allocated buffer for tracking information related to secure
state.

Change-Id: I326ce35a17cd27b61831b0bde4e7423f1ac3d106
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
gpu: ion: Make secure buffers 1MB chunks

Secure buffers have a requirement to be generated in 1MB
chunks. Change the sg_table generated to be an sg list of
1MB chunks of the contiguous buffer if the secure flag
is indicated.

Change-Id: Ia03d283cddfb978fc9e15975c2d80f138269b5ce
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
gpu: ion: Add support for securing indiviudal buffers

Newer protection APIs allow individual allocations to be secured
instead of the entire heap. Add APIs to support securing individual
Ion handles. These APIs include a flag option to support delaying
the unsecure until the buffer itself is actually freed.

Change-Id: I01e2bc921a342e4bb6191a642942264a9613d6f9
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
gpu: ion: Factor out common code on first alloc/last free

Currently, fmem must be transitioned on first allocation/
last free. Going forward, there may be other use cases to
call functions on first allocation/last free. Factor some of
this code out to avoid duplication.

Change-Id: I2649309318bc65aa2d0401c90e71ade4cc14c729
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
gpu: ion: Rename request/release region

request_region and release_region are macro names defined
in the linux kernel. Under some circumstances, the C compiler
can't differentiate between the macro name and the field name.
Changing the field name is the easiest way to prevent this
problem.

Change-Id: I2c8d61bdaa20e332e0215f0bb3237e8332f0f3ac
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
msm: Add support for relocatable pil ion heap

To specify the address and the size of memory which has been removed
add bindings for fixed memory. This specifies the size and the address
of the memory which has been previously removed by memblock remove.

Enable relocatable PIL heaps using ion framework. There are two PIL
heaps to meet the different set of requirements of the PIL firmawares.

Change-Id: Ief27c45f5d20f8afde121b838a5cd228d5b32e5d
Signed-off-by: Neeti Desai <neetid@codeaurora.org>