iommu: Fix flags passed to iommu map functions.

iommu map functions requires clients to specify whether
the mappings should be read only or read-write (write only
is not supported). Ensure clients specify the appropriate
flags when calling map functions.

Change-Id: If42b4b0367b4311aa36d3063979ef04af3a43fc6
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit bcf5ae04a9bf744a7a3d119c93d439a682404877)
gpu: ion: Remove extra iova free call

IOMMU virtual address (iova) is allocated locally in IOMMU mapping
functions per heap type. When an error happens the iova's are
freed in the same function as it was allocated. However, there
is an extra free call in the ion wrapper function that calls
these IOMMU mapping functions.

Remove the extra iova free call which can cause kernel panic.

Change-Id: Ic8978cf05202b29a42da7374e2c8c1e590b2d2a8
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit b343e0593e5f574cd1483497807a6cf10b7aee8e)
gpu: ion: Map everything into IOMMU with 64K pages.

Due to performance issues with 4K pages and the IOMMU we should use
64K pages. However, minimum allocation from ION is 4K so instead of
mapping on demand we need to map the full heap into the IOMMU when
the first request for mapping comes. Only unmap everything from the
IOMMU when the last buffer is freed.

CRs-fixed: 348606
Change-Id: Ic1793f5caaff2f69bf1fb7e8c8b3bd03378131b8
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit 5027688e1d4cf244f84b525c76a000b9408c62a5)

Conflicts:

	arch/arm/mach-msm/board-msm8x60.c
gpu: ion: Fix incorrect argument to map call

An incorrect argument is passed to a local ion heap
function call. This is causing incorrect flags to be
passed to iommu map call. The side effect is that the
flags passed to the iommu map call is defaulted to
read-write and uncached.

Change-Id: Ia2a7e64818dc8f251dadfb545f9b218a5e3cfc42
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit 3d79eec14b8fdb99832a907a0ae29042eaba7f07)
msm_fb: display: Add IOMMU support to MDP and rotator driver

Add IOMMU support to MDP and rotator driver for operating with
virtual addresses instead of physical addresses

Change-Id: Ia5afcf33220e0e75e92948649c2bd4d7ef32917d
Signed-off-by: Ravishangar Kalyanam <rkalya@codeaurora.org>
msm_fb: display: Unstage video from primary mixer H/W on unset

Resolve video playback suspend/resume IOMMU page fault by
unstaging video layer on VG pipes from primary mixer H/W during
overlay_unset calls immediately at the next vsync boundary

CRs-Fixed: 350371
CRs-Fixed: 354236
Signed-off-by: Ravishangar Kalyanam <rkalya@codeaurora.org>
Change-Id: I7fe10989a7bc3d7f379adfd18010c5e8cd655368
msm_fb: Correct mdp_iommu array size to avoid scribbling

The mdp_iommu array was undersized. This resulted in scribbling of
nearby data structures which, through a long series of events,
lead to invalid pointer dereferences in the workqueue framework's
process_one_work() function on (at least) the 8930 SoC.

CRs-Fixed: 357011
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
Change-Id: Idb360e687c4cf050b6e73e575a13eba4b9d3c150
msm_fb: display: Flush pipe registers before staging the pipe

Flush pipe registers before staging the pipe for the Mixer with
pull mode panel interfaces. This fixes the IOMMU page fault/underrun
caused by pipe fetching previously unmapped buffers due to missing flush
calls

CRs-Fixed: 356484
Change-Id: I6bc2e49746a7c3773708796bc1709c75a8afaa4b
Signed-off-by: Ravishangar Kalyanam <rkalya@codeaurora.org>
msm: Make IOMMU domains unique

4 domains have been defined for the IOMMU. However, they are all
aliased to each other.

Change so that the domains have unique value for video, camera,
display, and rotator.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/include/mach/iommu_domains.h

Change-Id: I5b09c1d98e04c63c718bbbf0a0dd2e3d1cc21c25
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>