msm: kgsl: Prevent missing servicing of events waiting on timestamps

Prevent instances where we miss servicing an event which was waiting
on a timestamp. We do this by looping in the events list, until
we finish servicing all the members of the list, and if we come across
an event which has not been serviced yet, we write a dummy interrupt to
the ringbuffer so that we don't miss when that timestamp's work is done.

Change-Id: Ib7b3554efa0d9a8bdc20d1722d912977f72f3ed5
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
msm: kgsl: Resolve a potential race in the interrupt handler

In the GPU interrupt handler we attempt to clear the ts_cmp_enable
for the active context so that future interrupts are skipped until
someone needs one again. If for some reason the interrupt handler
is delayed then there is a possiblity that the "current" context in
the GPU isn't the one that fired the interrupt. In that case we
could be accidently clearing a ts_cmp_enable for a context that
needs it. Instead of clearing in the interrupt handler clear it
from the GPU so we can be sure we got the right context.

As a bonus pushing this logic to the GPU side lets us get rid of
some extra register reads/writes in the interrupt handlers.

Change-Id: I3cb3d1a3c626d0594e55bff4535990c1402764fa
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
msm: kgsl: Check the current interrupt status before power operations

Sometimes the core will go idle before the interrupt can be handled on
the GPU. If that happens then we could go to a lower power state before
cleaning up the pending interrupt and various entities that might be
waiting for it. Consider the current interrupt status when checking
for idle.

Change-Id: Idd43e56e0162a522e0929df83531aff94beadc19
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>