msm: kgsl: Properly record the size of the sglist in the memdesc

It was possible to fail out of kgsl_sharedmem_alloc after a sglist was
allocated but before we saved the size of the allocation which caused
problems when the sglist was freed during cleanup.

CRs-fixed: 464289
Change-Id: Ic0dedbadd57ec4d9422b5e3a873243d0ffed51f7
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: display: Fix composition issues when framework rebooted in suspend.

Currently, if framework is rebooted while in suspend mode, borderfill
is not unset due to which MDP composition can not be enabled. This patch
fixes the issue.

Change-Id: I8b671eccedebf2bb08724cf2d284d4ab27a71360
Signed-off-by: Vishnuvardhan Prodduturi <vproddut@codeaurora.org>
msm_fb: display: add one more pipe_commit delay before free ion buffer

It is possible that two consective pipe_commits happen within
same vsync period.  This will cause iommu page fault due to an ion buffer
that is being fetched by mdp's pipe is freed. It needs one pipe_commit
delay to free ion buffer to prevent iommu page from happening. Therefore
an extra free stage is needed to empty ion buffer free list.
Also, ION_IOMMU_UNMAP_DELAYED flag is not necessary at mapping of an
ion buffer since one pipe_commit delay had been added.

Change-Id: I340e002e8dc30b6faa0c095ba042eab50e8b7c88
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
Merge "msm: display: Fix composition issues when framework rebooted in suspend."
Merge "msm: kgsl: Properly record the size of the sglist in the memdesc"
Merge "msm_fb: display: add one more pipe_commit delay before free ion buffer"
Merge remote-tracking branch 'caf/jb_2.5' into update
msm: kgsl: Disable clock gating earlier during snapshot

Disable clock gating earlier when recording the GPU snapshot.
This will ensure that there are no issues when reading register
values from the GPU hardware.

Change-Id: I173655b419c958f0b8cdfa4609c712e512ff2487
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
msm: kgsl: Set the context ID of iommu bank based on address

Use the context bank's and iommu units register base address to
calculate the iommu context'd ID instead of using sid. It is done
in a similar manner in iommu driver.

Change-Id: I6f8f02257a8bbd11de555901f9bbe87c66112219
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
msm: kgsl: Sync memory with CFF from places where it was missing

Before submitting any indirect buffer to GPU via the ringbuffer,
the indirect buffer memory should be synced with CFF so that the
CFF capture will be complete. Add the syncing of memory with CFF
in places where this was missing

Change-Id: I18f506dd1ab7bdfb1a68181016e6f661a36ed5a2
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
msm: kgsl: a2xx: Check the right interrupt status bits

Check the actual interrupt status bits in a2xx_irq_pending instead
of reading the mask registers which were always set and returning
true. Troutslap for the original author (me).

CRs-fixed: 467381
Change-Id: Ic0dedbada1c5fa64548221718c1eaf9b6eaaa1e8
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Add barriers to GPU fault tolerance memory reads

In GPU fault tolerance When reading from memstore add
memory barriers. This ensures memstore reads are
completed and makes GPU fault tolerance code robust.

Change-Id: Iefb950ae2647eb8ae16bfb9a8d7ee9885636d920
Signed-off-by: Tarun Karra <tkarra@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: 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: Add a section to list memory entries in snapshot

Add a section that lists all memory entries of a process
in which the hang has supposedly occurred. The entries are
of (gpuaddr, size, memtype) tuples.

Change-Id: I981d2325346455a6775af1691474c02422581b4f
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@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: Run GPU fault tolerance at max clock

GPU fault tolerance should take minimal time,
set the GPU clock to max freqency to acheive this.
When we set GPU clock to max freqency we vote for
high CPU clock and bus bandwidth.

Change-Id: I98a3f7c24f0939c08f9b12257817d17414e3f128
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Merge remote-tracking branch 'caf/jb_2.5' into update