msm: display: include msm-specific ion header

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

(cherry picked from commit 6c7b2d322826aaf12b7682079cadb8ac9179fbce)

Change-Id: I5ea11254adc7a9f1ae4c9afbcfc20f9c78d789bb
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
msm: board-8064: include msm-specific ion header

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

(cherry picked from commit cc827ace8a6d523156ebd3b2a882310a41a0973a)

Change-Id: If8d862c0b93c1c8c045da5aa8083b49e53a3cc7d
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
msm: board-8930: include msm-specific ion header

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

(cherry picked from commit d0b5da0404e57339dd15a2e5748403e5d284931f)

Change-Id: Ied606d380d4dbcb92886458d04c4e427f16b159d
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
gpu: ion: include msm-specific ion header

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

(cherry picked from commit af2e5c54827a85efc3662df70ff8a4e42f91747c)

Change-Id: I5f02785623eaf622fd4143d5a1f476b3c7f1a801
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.

(cherry picked from commit d88b8eb288bd2d4c5da827d546c4ce56ff169bfb)

Change-Id: If5b190d703c25b3f287a7d4a4f66500bb83f6618
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
gpu: ion: Add compatibility with future changes

Several changes are pending to be pulled in which are
not compatible with our changes:

* a new field to the allocation ioctl is added
* the ioctl numbers for cache flushing need to be changed.
* the size of the structure passed to ION_IOC_IMPORT
has changed

Add these changes now until full changes can be pulled
in the future.

(cherry picked from commit 0eec15100e6fc46e7ae5b7cd18dfe3a329661a1f)

Change-Id: I571a6096ebbf59c80a5730480da3a5c704e27edc
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
ion: remove ion_validate_buffer_flag

ion_validate_buffer_flag is no longer needed since its only callers
are moving to a new format for buffer flags.

(cherry picked from commit b6e920c1e371d940f2e3824ffaf157132b95284c)

Change-Id: Id7336257fd8339c3097d73f36a58a0e7ce4abbc0
Signed-off-by: Mitchel Humpherys <mitchelh@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.

[mitchelh@codeaurora.org: re-adding patch that fell out]
(cherry picked from commit 865e97f4943d9bf0c11763b694569fb4797c52b0)

Change-Id: I170f8a7dfc6e00e837530d14d6a14dbd40d28726
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
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).

[lauraa@codeaurora.org: Remove file not in tree]
(cherry picked from commit d117f2544498e98c62436237d6da88e89f4c7e0b)

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

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

[lauraa@codeaurora.org: Remove non-existent functions/files]
(cherry picked from commit af182ba479e042fefc0edb0ce3747ad51258871f)

Change-Id: I868a0e01ecd19827f7e5223e8bc7e1888ec04b81
Signed-off-by: Hanumant Singh <hanumant@codeaurora.org>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
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.

[lauraa@codeaurora.org: Remove non-existent functions/files]
(cherry picked from commit 23a4aa5bb76dfde84eb2234903910cd73221a0a9)

Change-Id: Ife8d3b84ff82801a96ee15f88e576e89451ffb79
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
ion: remove obsolete ion flags

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

[lauraa@codeaurora.org: Small argument change]
(cherry picked from commit 256e4ca6eb6c2caf040f9e3a8be3ee6afab547c4)

Change-Id: I46164420f4c80a76acfa80c4b9a85109ea840387
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
ion: isolate msm-specific ion extensions

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

(cherry picked from commit 362b52b141cd63b1b8a43ec37905b688daa18dce)

Change-Id: I52330e25b79a1d5a0757917af2c830ba310b98c2
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
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.

(cherry picked from commit 036494e80da7a6330e549413c3c22bc03d3eda6e)

Change-Id: I0f8261e7d93be9a19061e5201a1e1d7afdb7382f
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
msm: vidc: port heap mask change to ion for secure session

Changes to pass ION_SECURE in the correct argument field
while calling ion_alloc. Without this change secure session
fails.

[lauraa@codeaurora.org: minor context fixups]
(cherry picked from commit 4738f62b5e69e6d3703e59fbf9fb598fe73d0942)

Change-Id: Ie63377d54f08dbf7c942e28132ecc6a001fbafd6
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
common: DMA-mapping: add DMA_ATTR_NO_KERNEL_MAPPING attribute

This patch adds DMA_ATTR_NO_KERNEL_MAPPING attribute which lets the
platform to avoid creating a kernel virtual mapping for the allocated
buffer. On some architectures creating such mapping is non-trivial task
and consumes very limited resources (like kernel virtual address space
or dma consistent address space). Buffers allocated with this attribute
can be only passed to user space by calling dma_mmap_attrs().

(cherry picked from commit fdf1f8b820d649e760a075b08027fba038c400ed)

Change-Id: Ic626484def0965682c5a46ed89d1fdfc7cdd9201
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
common: DMA-mapping: Add strongly ordered memory attribute

Strongly ordered memory is occasionally needed for some DMA
allocations for specialized use cases. Add the corresponding
DMA attribute.

(cherry picked from commit 09241a54483ee8a3222c5fd35a4adfdeda4f0a8a)

Change-Id: I1c49cba2e055573602cc5739f1b86a4e2baba301
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
arm: dma: Expand the page protection attributes

Currently, the decision on which page protection to use
is limited to writecombine and coherent. Expand to include
strongly ordered memory and non consistent memory.

(cherry picked from commit b203402177d2528f290943b224a21a7d6b2b5723)

Change-Id: I63d8188dfa5bc60d18798247fad18f5a05526c38
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
arm: dma-mapping: Add APIs for other memory types

Currently, the only attributes supported for DMA memory are
writecombine and coherent. Both of these allow speculative
prefetches to occur. For certain use cases (e.g. content
protection) there are requirements to disallow prefetching.
Relatedly, there may be cases where buffering is not enough
for high performance use cases and the full cache should
be used. Add appropriate APIs for the strongly ordered and
cached memory types for the needed use cases.

(cherry picked from commit e78ee491b0bdebc214bbb06f687518f983700d2a)

Change-Id: I7684a3607aade4a01640d49bbbcc972d1f472e6d
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
arm: dma: Allow CMA pages to not have a kernel mapping.

Currently, there are use cases where not having any kernel
mapping is required; if the CMA memory needs to be used as
a pool which can have both cached and uncached mappings we
need to remove the mapping to avoid the multiple mapping
problem. Extend the dma APIs to use the DMA_ATTR_NO_KERNEL_MAPPING
with CMA. This doesn't end up saving any virtual address space
but the mapping will still not be present.

(cherry picked from commit 4f5b9debd2a5050b5a1c36c54911376ff7ecb408)

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