msm: kgsl: Only return tlb flush flag if bit is set for given device

We should only return the tlb flush flag if the bit corresponding
to the given device is set in the tlb flags. Earlier we were returning
the flush flag always if the tlb flags had the flush bit set for any
device.

Change-Id: Ia598694b295e650ce97dde83ccd89c99e5811d06
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
msm: kgsl: Report error if regulator enable fails

In function kgsl_pwrctrl_pwrrail check if call to enable the
regulator fails or not and report an error message on failure.

CRs-Fixed: 340649
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit e86ba5ca2814cbbcb803c154bda0c14851d33d37)

Change-Id: Id77422bd73c6a0f5f8106834419cfa13e8e807bd
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>
msm: kgsl: Check whether the ops pointer is valid.

Check that the ops pointer is valid before using it, otherwise we
may fault.

CRs-fixed: 360810
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit be9799810e79340362978979ce1ff2d9f185904e)

Conflicts:

	drivers/gpu/msm/kgsl.h

Change-Id: I59d5ee123c66b044e8d9c502ed6e641e51bf62fa
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: kgsl: Pass correct datatype to kgsl_mmu_ptpool_destroy()

This fixes a crash due to NULL pointer access when allocation of DMA
Coherent memory fails.

Change-Id: I7ea7405713682aaa7cd660ef341a968342dc0880
Signed-off-by: Ranjhith Kalisamy <ranjhith@codeaurora.org>
msm: kgsl: Follow reverse sequence of init procedure during exit

Fixes kernel warnings about sysfs entries being unavailable when they
are removed during exit.

Change-Id: I6caaaff935b31d3f39a3610cdd2b048baf2f1a97
Signed-off-by: Ranjhith Kalisamy <ranjhith@codeaurora.org>
msm: kgsl: Modify kgsl_core_exit to release resources carefully.

kgsl_core_exit() should not call kgsl_sharedmem_uninit_sysfs() and
device_unregister() if those resources have not been allocated.
We check this by seeing if kgsl_driver.virtdev has been
populated or not.

CRs-fixed: 359477
Change-Id: Ic040667b29bd4e006e6f29a50809d94a2bb4b469
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
msm: kgsl: Add draw workaround commands after every 50 context switches

We need to add a draw workaround command sequence after every 50 context
switches if the gmem has not been saved in those 50 switches. This
workaround is required to prevent the GPU from deadlocking. Since gmem
save commands have draw calls in them we only need to execute this
workaround if the gmem has not been saved. The number 50 was chosen
empirically.

CRs-fixed: 362302
Change-Id: I1a659c85736c47fe6f45030b20ce7a12851b0815
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>

Conflicts:

	drivers/gpu/msm/adreno.h
	drivers/gpu/msm/adreno_a3xx.c

Signed-off-by: Anshuman Dani <adani@codeaurora.org>
msm: kgsl: Issue packet to set shader bases on A20x/220 GPU

When GMEM save is not performed, the events to reuse shader space
can get dropped. This make the CP block to wait indefinitely
causing a hang. To unblock this, issue a packet to set shader bases.
This applies only to A20x/220 GPU.

CRs-fixed: 365465
Signed-off-by: Ranjhith Kalisamy <ranjhith@codeaurora.org>
(cherry picked from commit d71cfd6ee15626dfd66e2b94ed524fbd2488fe91)

Change-Id: I9a4bb72de7922e22f5c9a2d7972062e5ec15a187
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm: kgsl: Add TLB flush for each submit in case of 8x25/7x2xa

Add TLB flush for each submit to prevent target freeze
in case of 8x25/7x27a/7x25a targets.

CRs-fixed: 379991
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>
(cherry picked from commit 22a06d18c6eb100419616ddf7a2c4ac403420a9e)

Change-Id: I7c34660128c791c9329b41246af39879625d64d3
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>