msm: pil: Add pil driver for video core

Add support to boot a securely signed image
on the video core.

Change-Id: I5e85ef23b34480b2598dcbe0b6b0a78626fcba72
Signed-off-by: Vinay Kalia <vkalia@codeaurora.org>
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>

Conflicts:

	arch/arm/configs/msm8960_defconfig
msm: pil: Allow pil_put() to shutdown peripherals

Remove the temporary hack to prevent peripherals from shutting down
when pil_put() is called and the reference count goes to 0.

Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
(cherry picked from commit 39f90cbfbe87eb4195c0206f7db617723025fdb9)

Change-Id: Iaba64a03e3ae4793fa801c691a83a685b4c4d03c
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
msm_fb: display: Assign proper destination rectangles to mdp blit

Add check for (90 + Flip Horizontal) and Flip Vertical cases to assign
proper destination rectangle parameters to avoid corrupted frame
buffer content.

CRs-Fixed: 344807
Change-Id: I7e7b0b8d26f08f63a6f9c55eedd37f31cf0348d7
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
msm_fb: Enable overlay downscale check for Samsung panel

Change-Id: Id2b002720bb9ca7c910a90462aa41b3fe0388652
msm_fb: display: Flush pipe registers before staging for Mixer 0 or 1

For Mixer 2, register flush need not be called. Flushing is done
only for pipes on mixer 0 and 1.

Signed-off-by: Ravishangar Kalyanam <rkalya@codeaurora.org>
Change-Id: I54758f79552790de2ad936703ba6140ac57b76c4
gpu: ion: Add check for overlapping heaps

During bootup add check to ensure heap addresses are not overlapping
with each other. If a heap is found to be overlapping with another
heap boot will be stopped with a call to panic.

Change-Id: Id37aefa2e09aa165ec376e241e282faf5f3c5737
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
gpu: ion: Ensure ioctl return correct error codes

Under certain error conditions the following ION ioctl's would return
success even when the operation failed:

-ION_IOC_CLEAN_CACHES
-ION_IOC_INV_CACHES
-ION_IOC_CLEAN_INV_CACHES

Add return of correct error codes when an error occurs.

Change-Id: Ie8824bfecbb423c23d32c6a3d7058f06d8322906
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
gpu: ion: IOCTL return success when error occurs

ION_IOC_MAP, ION_IOC_SHARE, and ION_IOC_IMPORT may return
success when an error occurs.

Add correct error handling to ION_IOC_MAP, ION_IOC_SHARE, and
ION_IOC_IMPORT.

Change-Id: Idb7e58c94dab53fd82dd49150af9eaec78430c40
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
gpu: ion: Check for null name argument

Add check for null argument to avoid dereferencing
a null-pointer.

Change-Id: Icb452d0764e375bf2684e013c51d260de98e8583
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
gpu: ion: Add more debug info to client debugfs IF

Add logging of buffer physical address (if allocation
is from physically contiguous heap) and iommu mapping
information to the ion client debug interface.

Change-Id: Id3a77c1b5e3c5d15b11b3612f07d10092922cdff
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
gpu: ion: Add lock around debug routine

Access to rb tree of user and kernel ION clients
must be protected by a mutex.

Change-Id: Ie27eba65f8cab3a7c20c041eb46429ba62c5c00f
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
gpu: ion: Add dump of memory map

Add dump of physical memory map, showing allocated and
free areas, to debugfs interface for heaps with carveout memory.

Change-Id: I9bda9f3e555e55570c95e652616ca1fcc25eb0ab
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
msm: iommu: Use threaded IRQ handler for page faults

A threaded interrupt handler for IOMMU page faults will
allow the use of the new clock APIs from the interrupt
handler.

Change-Id: I381df3974daa7fbc4bc4ec0558434959597b4f24
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
msm: iommu: Enable use of TTBR1 register of IOMMU

Add a new platform data in iommu devices to indicate whether ttbr1
should be used which also dictates how the address space should be
split between ttbr0 and ttbr1.

Change-Id: Iab3aac74256bd4d49f47f89e6638f014e6e539e9
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
msm: iommu: Support mapping attributes

Add support for the IOMMU_READ and IOMMU_WRITE attributes
for mappings. Read-only and read-write mappings are fully
supported. Write-only mappings are not supported in
hardware and will fall back to read-write. Specifying
neither attribute in iommu_map will result in a warning on
the first call, and the mapping will be treated as
read-write.

Change-Id: Ibe9bd340d0743f37c91580c7db4f199fb4afba8b
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
msm: Move subsystem map specific code to the subsystem map file

Code to translate between the old style subsystem map ids and
newer domain/partition numbers is no longer dependent on anything
in iommu_domains.c. Move it to the subsystem_map file to better
separate the old code from the new code.

Change-Id: I899a3215f17b7b8c55969086389b89c4401bea3f
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
msm: iommu: Use ttbr1 for graphics 2d devices

Split the virtual address between ttbr0 and ttbr1 for
2d devices of graphics

Change-Id: I6f5751c0586cfd16e01f2e324b544463efdd54d2
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
msm: Add simple APIs to map contiguous buffer

Typicall, most iommu mapping happens through Ion or another
API. There may be other cases when clients need a simple
API to map a contiguous physical address into an iommu.
Add apis to support mapping and unmapping a physical range
into the iommu. The client is responsible for any reference
counting that needs to occur.

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

Conflicts:

	arch/arm/mach-msm/include/mach/iommu_domains.h
msm: iommu: Clean newly-allocated page tables

If L2 redirection is disabled, clean page tables upon
allocation to prevent hardware table walks into unmapped
areas from accessing stale data.

Change-Id: If1e70bfa52f86d9ddc5a001a699050667b075631
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
msm: iommu: Refactor cache cleaning functionality

Refactor clean_pte to accept a redirection attribute, which
allows for cleaner code at the caller.

Change-Id: Iff77abdced1fa6ea295a4bf6ec76f644b9922e63
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>