gpu: msm: Fix context name
msm: kgsl: Map sync lock variables to every pagetable

Map sync lock variables to every pagetable since we don't
use TTBR1 anymore.

Change-Id: If2d43c4c57d0cdcf6076229dfad32c0375e74df4
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>
msm: kgsl: Add a check to free the kgsl_timeline object.

Add a check to free the kgsl_timeline object only after
destroy flag is set. This is to avoid further references to timeline
from kgsl if it is already freed and also to catch any unbalanced
kref count.

Change-Id: I8017b9a928a26b703eb92b17ab6a361e4b479e5a
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>
msm: kgsl: Wake up gpu on kgsl_ioctl_timestamp_event only if necessary

Any call of kgsl_ioctl_timestamp_event wakes up gpu. In some cases
(like retired timestamp) it's not necessary. Wake up gpu only if it's
necessary.

Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>
Change-Id: I845faf6e9c6e4c9882a68489b64223919be3d21c
msm: kgsl: Do not try to resume the device from INIT state

If the device is still in INIT state there are no open instances
of it running.  Resume calls should be no-ops.  Do not attempt
to start the device at this point.

Change-Id: I1cb6d60581b0b5b0a2ab1b13418adc4ae3983c5e
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
gpu: msm: Allow retries for 0 order allocation

When allocating order 0 pages we allow the allocator to retry
the allocation to ensure we can take advantage of pages that
are being reclaimed. This will help avoid unnecessary out
of memory errors from kgsl clients.

Change-Id: Iec2a0a1fe10302c320a58cef90ae1ee7e35d71ee
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
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>
ion: tracing: add ftrace events for ion allocations

Add ftrace events for ion allocations to make it easier to profile
their performance.

Change-Id: I9f32e076cd50d7d3a145353dfcef74f0f6cdf8a0
Signed-off-by: Liam Mark <lmark@codeaurora.org>
ion: cma: Add debug heap ops for CMA heap

For tracking CMA allocation by address and fragmentation
(if any), add debug heap ops which gives buffer allocation
info.

Change-Id: Ia8bed38034b85b2d4dcf84811a348bbbe50dc16b
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
gpu: ion: add pointer null checks in map and unmap

Clients may pass incorrect arguments to ION causing crashes.
Add checks to validate input for ION APIs.

Change-Id: Idafa4535b3ef71184ca11fb2c0c4ab073a52ac2f
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
msm: iommu: re-use existing buffers for `extra' mappings

There is a bug on some hardware that requires us to overmap Iommu
mappings by 2x. Currently, we set aside a dummy buffer onto which we
map all of these dummy mappings. In general, for large mappings it's
nice to use the more efficient iommu_map_range instead of calling
iommu_map repeatedly. However, with our current approach in
msm_iommu_map_extra we can't use iommu_map_range for page_sizes larger
than the dummy buffer. To avoid wasting memory by increasing the size
of the dummy buffer, we can simply remap on top of the the buffer
being mapped in the first place. Since the second mapping should never
be used (besides by the buggy hardware) this should not be a problem.

Re-use existing buffers for all `extra' mappings. Essentially, map the
same physical address range twice. To be extra safe, make the second
mapping read-only.

Change-Id: I35462ad50de8da1f2befa3e3f0895925535cdc98
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Revert "msm: kgsl: Add support for KGSL_CMD_SYNCPOINT_TYPE_FENCE"

This reverts commit e4a13f8ecc300aeb12be524525a29597e63812cb.

Change-Id: I1202782313439afac9ee625f695d2b7ba957d8d7
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Revert "msm: kgsl: add kgsl_sync_fence_waiter for server side sync"

This reverts commit 878a3c0d92c0126782e7f6d77d3a52a62b28dcf8.

Change-Id: Ib2271b8402336a7d6050649f5bfe9cb47008be5f
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Revert "msm: kgsl: Don't process events if the timestamp hasn't changed"

This reverts commit 3366075c1daab3a762a6bff510d6ebd62f3ff2a9.

Change-Id: I77c3d7a7be0c952b6a81efb385f15208b278087a
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Revert "msm: kgsl: Add a new command submission API"

This reverts commit c177eb9e5d25e0b7cf5b5cba434b052fb36a33cd.

Change-Id: If33bd6c52ebf16d0402886f0a41c2a015ef69f8a
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>