msm: kgsl: Add support for VBIF and VBIF_PWR performance counters

These 2 counter groups are also "special cases" that require
different programming sequences.

Change-Id: I73e3e76b340e6c5867c0909b3e0edc78aa62b9ee
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
msm: kgsl: Only allow two counters for VBIF performance counters

There are only two VBIF counter groups so validate that the user
doesn't pass in > 1 and clean up the if/else clause.

Change-Id: Ic0dedbad3d5a54e4ceb1a7302762d6bf13b25da1
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Avoid an array overrun in the perfcounter API

Make sure the passed group is less than the size of the list of
performance counters.

Change-Id: Ic0dedbadf77edf35db78939d1b55a05830979f85
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Don't go to slumber if active_count is non zero

If active_cnt happens to be set when we go into
kgsl_early_suspend_driver() then don't go to SLUMBER.  This
avoids trouble if we come back and and try to access the
hardware while it is off.

Change-Id: Ic0dedbadb13514a052af6199c8ad1982d7483b3f
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Enable HLSQ registers in snapshot when available

Reading the HLSQ registers during a GPU hang recovery might cause
the device to hang depending on the state of the HLSQ block.
Enable the HLSQ register reads when we know that they will
succeed.

Change-Id: I69f498e6f67a15328d1d41cc64c43d6c44c54bad
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
msm: kgsl: snapshot: Don't keep parsing indirect buffers on failure

Stop parsing an indirect buffer if an error is encountered (such as
a missing buffer). This is a pretty good indication that the buffers
are not reliable and the further the parser goes with a unreliable
buffer the more likely it is to get confused.

Change-Id: Ic0dedbadf28ef374c9afe70613048d3c31078ec6
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: snapshot: Only push the last IB1 and IB2 in the static space

Some IB1 buffers have hundreds of little IB2 buffers and only one of them
will actually be interesting enough to push into the static space.  Only
push the last executed IB1 and IB2 into the static space.

Change-Id: Ic0dedbad26fb30fb5bf90c37c29061fd962dd746
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Save the last active context in snapshot

Save the last active context that was executing when the hang happened
in snapshot.

Change-Id: I2d32de6873154ec6c200268844fee7f3947b7395
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
msm: kgsl: In snapshot track a larger object size if address is same

If the object being tracked has the same address as a previously
tracked object then only track a single object with larger size
as the smaller object will be a part of the larger one anyway.

Change-Id: I0e33bbaf267bc0ec580865b133917b3253f9e504
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
msm: kgsl: Track memory address from 2 additional registers

Add tracking of memory referenced by VS_OBJ_START_REG and FS_OBJ_START_REG
registers in snapshot. This makes snapshot more complete in terms of
tracking data that is used by the GPU at the time of hang.

Change-Id: I7e5f3c94f0d6744cd6f2c6413bf7b7fac4a5a069
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
msm: kgsl: Loop till correct index on type0 packets

When searching for memory addresses in type0 packet we were looping
from start of the type0 packet till it's end, but the first DWORD
is a header so we only need to loop till packet_size - 1. Fix this.

Change-Id: I278446c6ab380cf8ebb18d5f3ae192d3d7e7db62
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
msm: kgsl: Add global timestamp information to snapshot

Make sure that we always add global timestamp information to
snapshot. This is needed in playbacks for searching whereabouts
of last executed IB.

Change-Id: Ica5b3b2ddff6fd45dbc5a911f42271ad5855a86a
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
msm: kgsl: Skip cff dump for certain functions when its disabled

Certain functions were generating CFF when CFF was disabled. Make
sure these functions do not dump CFF when it is disabled.

Change-Id: Ib5485b03b8a4d12f190f188b80c11ec6f552731d
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>