gpu: msm: Add new Adreno driver

* Temporary place for this.

Change-Id: I83b5d75fbd201c352d011ed43f21ebe3576e058c
msm: kgsl: Add separate GPU shader memory mapping

Add separate kernel memory mapping for GPU shader memory.
Previously, both the register and the shader memory were mapped
as one entity, with the mapping length being equal to combined
size of register memory and shader memory. Now, we separate the
shader memory mapping to help in cases of GPU devices where the
shader and register memory may not be adjacent. This helps to
dump the shader memory in the postmortem snapshot. By having a
separate mapping for shader memory, the snapshot dump routine
simply reads in the shader memory range specified and dumps.

Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>

Conflicts:
	drivers/gpu/msm/adreno_a3xx_snapshot.c

Change-Id: Ia51cdbc6a682abe6505bcc53c997ef9c9192f9e6
msm: kgsl: Add intermediate power levels

Make use of the two independent power domains to
add intermediate levels.  Attempt to just increase
the bus frequency before also raising the GPU
frequency.

Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>

Conflicts:
	arch/arm/boot/dts/msm8974-gpu.dtsi
	arch/arm/boot/dts/msm8974-v2.dtsi
	drivers/gpu/msm/kgsl_pwrctrl.c
	drivers/gpu/msm/kgsl_pwrctrl.h

Change-Id: Ibe85d1c02941430c5da83a75a09d5bc0ec5f8ec0

Conflicts:

	drivers/gpu/msm/kgsl_pwrscale_trustzone.c
iommu/core: pass a user-provided token to fault handlers

Sometimes a single IOMMU user may have to deal with several
different IOMMU devices (e.g. remoteproc).

When an IOMMU fault happens, such users have to regain their
context in order to deal with the fault.

Users can't use the private fields of neither the iommu_domain nor
the IOMMU device, because those are already used by the IOMMU core
and low level driver (respectively).

This patch just simply allows users to pass a private token (most
notably their own context pointer) to iommu_set_fault_handler(),
and then makes sure it is provided back to the users whenever
an IOMMU fault happens.

The patch also adopts remoteproc to the new fault handling
interface, but the real functionality using this (recovery of
remote processors) will only be added later in a subsequent patch
set.

Cc: Fernando Guzman Lugo <fernando.lugo@ti.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
[ohaugan@codeaurora.org: Resolved compilation and merge issues]
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_mdp.c

Change-Id: I610966aeb936e0d026c6ef35a56453337e1b3c76
msm: Fix mem leak when using per-process pages

When GPU is using per process page tables the code creates
a new page table (domain) for every process. There is also
some associated structures allocated to keep track of each
domain. However, when cleaning up the memory used for a page
table only the domain is freed and not the associated structures.

Add a function to allow a client to properly unregister a domain
which will free all the memory associated with a domain.
Call the unregister function from kgsl driver code.

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

Conflicts:
	arch/arm/mach-msm/iommu_domains.c

Change-Id: I78365cac8afb900450b512527f0cb71da5e9ddb2
ARM: Add support for 64 bit register reads/writes

Add macros to read and write to 64 bit registers.

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

Conflicts:
	arch/arm/include/asm/io.h

Change-Id: Ied2b38e6a3803377cd271fe7b13f6cf0fc586e70
msm: scm: Add scm_call_atomic3

Some drivers need to pass three arguments atomically. Add support
for it.

Change-Id: I0077d26eeab0e6a3828f994fd4aabc4d73d48b31
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
driver core: Add iommu_group tracking to struct device

IOMMU groups allow IOMMU drivers to represent DMA visibility
and isolation of devices.  Multiple devices may be grouped
together for the purposes of DMA.  Placing a pointer on
struct device enable easy access for things like streaming
DMA programming and drivers like VFIO.

Change-Id: I0a92a94aea0ac699676914a033477243a70dd0b0
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
fix derps

Change-Id: I327cecbd3159621b7655f51033f14f87589c03ed
msm: We are using the msm2 gpu driver, not msm

Fix references that are incorrectly pointing at drivers/gpu/msm
instead of msm2.

The incorrect includes cause linaro gcc 4.8 with -O3 to produce
an unbootable kernel on the DLX.

While it doesn't seem to be affecting our normal builds, not
fixing it will likely bite us in the future in some other
mysterious way.

Change-Id: I3c51062ca6a66ddb9782365d2c51c5e485556c1b