msm: kgsl: Make tlb flags common for all MMU types

Remove tlb flags variable from gpu MMU specific structure and
declare it in common MMU structure since it can be used by both
MMU types i.e GPUMMU and IOMMU

Change-Id: Ia8bea65bc9acf257dc1277c98cd358963c291fd7
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Signed-off-by: nobodyAtall <tsogkas@ceid.upatras.gr>
msm: kgsl: Fix when GMEM is saved for A2xx

Saving GMEM is set when doing context switching and should not
be set when creating the gmem shadow.

Signed-off-by: nobodyAtall <tsogkas@ceid.upatras.gr>
msm: kgsl: fix format of the rbbm read error message

It is much more useful to get the dword offset of the
failing register than the byte offset because it is
consistent with the #defines and other register
logging in postmortem dump and snapshot.

Change-Id: Ie257475a8e2224729e4d1ac14af13a8027974027
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: nobodyAtall <tsogkas@ceid.upatras.gr>
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>
Signed-off-by: nobodyAtall <tsogkas@ceid.upatras.gr>
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>
Signed-off-by: nobodyAtall <tsogkas@ceid.upatras.gr>
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: Iedae82a5f54a17396bd12b3dd704ade0eb4a07f0
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Signed-off-by: nobodyAtall <tsogkas@ceid.upatras.gr>
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>
Signed-off-by: nobodyAtall <tsogkas@ceid.upatras.gr>
msm: kgsl: Align busy times with the end times of samples

Make sure that the busy times are calculated at the end of the
current sample and before the next sample starts. This prevents
false alarms of busy timer events being triggered. Applies only
to devices with idlestats power policy.

Change-Id: I1e28fff4128b72c25e8073d845d519867d67a9ca
Signed-off-by: Ranjhith Kalisamy <ranjhith@codeaurora.org>
Signed-off-by: nobodyAtall <tsogkas@ceid.upatras.gr>