msm: kgsl: Changing to kref_get_unless_zero for process refcount

Do not allow anything to get a refcount to the process_private
structure if its refcount has gone down to 0.

Change-Id: I7cd6f731286aebfc84c288284599b47f666dcd47
Signed-off-by: Shrenuj Bansal <shrenujb@codeaurora.org>
msm: kgsl: Reject free waittimestamp calls on incorrect parameters

Reject free waittimestamp calls when user supplies incorrect
type for timestamp.

Change-Id: Ib6c9a348e5de1d80617d336391e721f72523e51e
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
msm: kgsl: store process comm name in kgsl_process_private

Now that contexts keep a reference on their owning
kgsl_process_private, look up pid and process from there.
If the process is exiting while hanging the GPU, the
process name might not be available anymore by the time
we make the snapshot.

Change-Id: If05ae2096dd7d25bfe9931e949759e11ba3cd262
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
msm: kgsl: Change print specifier in kgsl_setup_ashmem

Change print specifier from %d to %zd for printing a size_t type
variable.

Change-Id: Ife20c4a79c8a810e37a5dd5fb27c2b6d007c134a
Signed-off-by: Shrenuj Bansal <shrenujb@codeaurora.org>
msm: kgsl: don't use sscanf()

sscanf() is really hard to get right with different variable types
and it shouldn't be used when kstrtoul works just as well (and is
way safer).

Change-Id: Ic0dedbad56af5bbee4fc833701d8bc93b118efa9
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Change local vars being assigned from size_t to size_t

A size_t variable being assigned to an integer variable results in
truncation which is problematic. Fix this by changing all those to
size_t.

Change-Id: I144f9b5b862ab10e968e1422ed7a7e5d9566af6a
Signed-off-by: Shrenuj Bansal <shrenujb@codeaurora.org>
msm: kgsl: Print TTBR0 in the page fault message

Print the raw TTBR0 value in the page fault message to try to
catch situations where the TTBR0 is obviously corrupted.

Change-Id: Ic0dedbad53a29be4fbf6da5d43e8cdab2bd1b925
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Assign maximum address range for CFF

Assign the maximum address range for CFF in which the GPU
address may lie. The GPU address will lie within this
range regardless of which MMU type is used.

Change-Id: I068e1a6f2ed9c3f9e30e20b93bd1cbfac2f534c0
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
msm: kgsl: Hardcode pt_base value instead of using PAGE_OFFSET

The PAGE_OFFSET macro value provided by the kernel differs for
arm64 and is far beyond the range of GPU virtual addresses. Hence,
create a macro for the per process pt_base value which is
applicable to our code.

Change-Id: Ia60c8f4d26067faa26f305e6a5563f0bb7dc4962
Signed-off-by: Shrenuj Bansal <shrenujb@codeaurora.org>