ARM: dma-mapping: fix executability of CMA mappings merge

Change-Id: I2d548dd0e54e589283881b460b708cf8038bc88d
msm: kgsl: Update calculation for graphics IOMMU context IDs

Calculate graphics IOMMU context IDs using the 'label' property of
the device tree node of that context. Context IDs are independent
of the register addresses of the SMMU device and its contexts, which
change for every target.

Change-Id: I16825d7248081997a442d4fb59ca5b04b88e33fd
Signed-off-by: Lokesh Batra <lbatra@codeaurora.org>
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
Signed-off-by: Prabhat Awasthi <pawasthi@codeaurora.org>
msm: kgsl: get pm_qos_latency from device tree

pm_qos_latency parameter can be configured from
device tree as well. Will set to default value if
entry not found in target device tree.

Conflicts:
	include/linux/msm_kgsl.h

Change-Id: I76271f4fdc26e191431e5dfe2a6de9e2b3ab426f
Signed-off-by: Prakash Kamliya <pkamliya@codeaurora.org>
msm: kgsl: change pm_qos_latency to pm-qos-latency

Use hyphen symbol instead of underscore for pm-qos-latency
property name. Hyphen should be used instead of underscore
in device tree property name.

Change-Id: I23f720159b4ecb3d81cbd13b570cee8fc633253a
Signed-off-by: Prakash Kamliya <pkamliya@codeaurora.org>
msm: kgsl: Do not detect faults when GPU core is idle

Do not detect GPU faults when GPU hardware status is idle,
this leads to incorrect fault detection.

Conflicts:
	drivers/gpu/msm/adreno.h

Change-Id: I7a9f8c49eb819241698f99fd50aaed400aadd4f4
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: kgsl: Fix spinlock recursion in destroy pagetable

pagetable list is protected by ptlock. Few functions
while iterating over a pagetable list takes same ptlock,
kgsl_destroy_pagetable() also need same lock. This will
cause spinlock recursion if kgsl_destroy_pagetable()
called while iterating over a list. Created two versions
of same function one is with lock and other is without
lock.

CRs-Fixed: 621172
Change-Id: I61440f99022fce8629a57bb5661e2eef9613187b
Signed-off-by: Prakash Kamliya <pkamliya@codeaurora.org>
msm: kgsl: Remove sscanf() from kgsl_pwrctrl.c

Replace sscanf() in kgsl_pwrctrl.c with a generic function to safely
convert 32 bit unsigned ints.

CRs-fixed: 563585
Change-Id: Ic0dedbad10e2264ec8fccab622d094d123b49b77
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Add new API's to track device mutex owner

Add new API's kgsl_mutex_lock/unlock to track device mutex owner.
Mutex owner is an atomic variable and all operations set/clear on
it are also atomic to avoid any race conditions.

If a thread tries to acquire the mutex using new API, try to acquire
the mutex only if mutex owner is not same as current thread. This is
to prevent deadlocks which can happen if a thread tries to acquire
mutex with mutex held.

Change-Id: I3da4d0427ede5458f6a663043c57a4799b72d8fd
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>

Conflicts:
	drivers/gpu/msm/kgsl_iommu.c
msm: kgsl: Flush TLB when mapping to IOMMU pagetable

Flush TLB when mapping to IOMMU pagetable, this is a requirement
for current IOMMU hardware.

Change-Id: I82e766f4869c737c1f5b73934eacaada40d46e10
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>

Conflicts:
	drivers/gpu/msm/kgsl_iommu.c
msm: kgsl: allow creation of events from the future

For contexts created with the KGSL_CONTEXT_USER_GENERATED_TS,
allow events to be created for timestamps that have not
been issued yet. Presumably these contexts know what they
are doing.

Change-Id: Iccf2e549b38e1a11850d26ee64b7279ab0b8a1ae
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
msm: kgsl: Add a power constraints interface

Add an interface to hint the user specified power
constraint. User can specify a particular GPU power level
or a bandwidth vote. The power constraints are per context
or command batch. Power constraints are only for hinting
and should be used judiciously.

Change-Id: Ic10a5fff4abc88c51cd45a7d7ac58c0d4e5dcb25
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
Signed-off-by: Prabhat Awasthi <pawasthi@codeaurora.org>
msm: kgsl: Flush the UCHE when context changes

Add commands to flush the GPU UCHE when a new context submits
commands to GPU. The ensures that the new context does not use
stale data present in UCHE.

CRs-Fixed: 607976
Change-Id: I123a323be5f3fb9d1f9f96fed5bb68b8d0d27d76
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: kgsl: don't use sscanf()

Friends do not let friends use sscanf().

CRs-Fixed: 563605
Change-Id: Ic0dedbad56af5bbee4fc833701d8bc93b118efa9
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Ensure that power constraints run for a full interval

Make sure that a power constraint is given a full DCVS interval to
influence the GPU before having it adjusted back down

Change-Id: Ic0dedbad22e74ce6e62e26c386b900442d7bab40
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Fix the NULL context submission size

When submitting commands with a NULL context the size may not be
calculated properly. Fix this calculation.

Change-Id: Idcc37772349673da8a9b9d5127f88946ced8fff6
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
msm: kgsl: Treat 0x0 as valid GPU pagetable physical address

Iommu driver could be allocating a valid GPU pagetable at
physical address 0x0, remove assumption from GPU kernel driver
that 0x0 is invalid pagetable address.

Change-Id: I213c0fbc1d90a13bef83c7d7589ad9e5729771fd
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
msm: kgsl: Remove unnecessary profile close check

Remove an unnecessary profile close check in
adreno_profile_process_results(). The profile close
check was causing NULL pointer dereferencing in
other adreno profile functions. There should be
no danger of memory leak though since we clear the
buffer in adreno_profile_close() anyway.

CRs-fixed: 590766
Change-Id: I372ade0dc0ec0ed23dd743c6294d8bf0524f812f
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
driver: kgsl: fix merge

Change-Id: I0663136ff7da27ec188b8c4d25cc466eccb26d6a
Merge remote-tracking branch 'cm/cm-11.0' into cm-11.0-new