Add ringbuffer and register dump as part of postmortem dump for z180
cores. Also, add kgsl_postmortem_dump as a preparatory general function
for postmortem dump for both types of kgsl devices, adreno and z180.
Change-Id: I8b538771bfa8f6bfdfe0b1b993afa3c53f8eb8cf
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
GPU MMU is used to control access to IOMMU registers on msm8960.
When pagefaults occurs, accessing mmu_pagefault which is NULL
causes kernel panic. Disable gpummu pagefault interrupts, since
pagefaults are handled through iommu fault handler.
CRs-Fixed: 380470
Change-Id: I9717f4af10b9722b0a14ba5995ee2293ae1de09f
Signed-off-by: Anoop Kumar Yerukala <ayeruk@codeaurora.org>
OCMEM is a on-chip memory bank which is shared by all Multimedia
components. KGSL needs to request space for GMEM usage for platforms
that support OCMEM.
Change-Id: Ic3ff501d7a444a71f75244806af95c62c8a08ed8
Signed-off-by: liu zhong <zhongl@codeaurora.org>
Add GPU ID and VBIF configuration for the A330 GPU
Change-Id: I02f1d6aab60233d0205f930e1813f14a685dd89c
Signed-off-by: liu zhong <zhongl@codeaurora.org>
Change GPU digital circuit head switch name to vddcx to match
devicetree property name convention.
Change-Id: If17b47125f08873106f74fdb21a29c58dbf1496a
Signed-off-by: Pu Chen <puchen@codeaurora.org>
Populate the platform_data structure by reading from the Device Tree
Source file.
Change-Id: Ic8c83d3918510448b76559b095ad414d2f22c7bd
Signed-off-by: Lokesh Batra <lbatra@codeaurora.org>
Add device tree parsing to common msm ion code
to allow new targets to specify ION heap configuration
in device tree.
Document the device tree bindings for ION.
Change-Id: I40b7f4b1fbb3ca4ad1d6dc06a33b647f6af1d669
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
These trace events help in detecting whether we are reporting the
right events(busy/idle) to the mpdcvs driver, effectively improving
debugging capabilities. The mpdcvs driver should get a busy event
when the gpu is active and an idle event whenever gpu goes idle.
Change-Id: Ie227343e764e5c7bce1c95f75668bf6326d62e7a
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
Conditional interrupts were not getting fired at the correct time when
using per context timestamps. When a context was waiting on a timestamp,
the interrupt was being fired on the global timestamp rather than the per
context timestamp. Now the interrupt is fired on the per context
timestamp.
Change-Id: Ib683c846f0639a1e44f5b39bb81ca2751b306ea1
CRs-Fixed: 340620
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
After a _stop, _start must be called to write the correct
values to these registers before the device can be used
again. No reason to write an additional value on _stop.
Change-Id: If78bfd2ca81cce9d3320419c997a8d48af96fe13
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
If dma_buf_fd fails, the dma_buf needs to be cleaned up by
calling dma_buf_put. dma_buf_put will call ion_dma_buf_release
which in turn calls ion_buffer_put to clean up the buffer
reference. Calling ion_buffer_put after dma_buf_put drops the
reference count by one more which is incorrect. Fix this by
getting rid of the extra ion_buffer_put call.
Change-Id: Ieb3a7b781bf2dc299c45384dbf0a12d186adeb22
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Increase number of clocks that RBBM will wait before de-asserting
the Register Clock Active signal. This fixes kernel panics during
stability tests on multiple devices.
Change-Id: Id8791e0f691be09d96cfd4ad8438baed51347293
CRs-fixed: 372793
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>
Report idle whenever we go to nap and sleep for the msm policy
Change-Id: I490d76812b6833acd1fe7394129ce2f42483d8c2
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
Use the gpuaddr to determine whether memstore is being mapped in
mmap or a normal memory allocation is mapped instead of physical
address. gpuaddr of the memstore will always be unique but the
physaddr may be equal to the gpuaddr of another memory allocation
and that will cause the memory allocation to be mapped as memstore
which is wrong.
Change-Id: I6a803e82e0a9d3713ebb3f15ea46d450f69d8ac7
CRs-fixed: 379019
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
When a thread times out while waiting for a timestamp, check once
whether the timestamp which it was waiting for has expired or not
before treating it as an error
Change-Id: Iffba7955de58974a8d990a589b926e10f6c6a481
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Change the GPU hang detection code to avoid the normal case is
mistakely treated as GPU hang scenario.
CRs-Fixed: 378488
Change-Id: Ie79a8d91e35c51ba043e7a845c9a56266277f1a0
Signed-off-by: Wei Zou <wzou@codeaurora.org>
Remove the use of asid(application space ID) from the kgsl driver
for IOMMU since it's known to cause to stability issues on the
2D core
Change-Id: I92f82ebb0941296c7ad625dd833822dd918fe386
CRs-fixed: 379439
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Add bounds checking to kgsl_sharedmem_find_region to ensure that GPU
addresses supplied by the user via KGSL_IOCTL_SHAREMEM_FREE and
KGSL_IOCTL_CFF_SYNCMEM are within a valid range for the MMU scheme of
choice.
CRs-Fixed: 380296
Change-Id: Ic0dedbadf40fca4a9e04ba075e67e08e617806b5
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Put a reasonable upper limit on the number of indirect buffers allowed
per submission via IOCTL_KGSL_RINGBUFFER_ISSUEIBCMDS.
CRs-Fixed: 380267
Change-Id: Ic0dedbadd78a0ad3f09f67660f34b2fba421007f
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Turn on the IOMMU clocks in recovery as the recovered command
stream may have commands that read and write to IOMMU registers.
Change-Id: I6a8d9fa17a57b0c4f8564fc62d019b2e150b8399
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
In adreno_idle the default timeout value was always used,
even if the caller specified something different. The caller
can now specify a non default timeout value to be used
in adreno_idle.
Change-Id: Ibb6bcc094521d4a660d8385b32bf8c6ac68acbd9
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
The lowest non-zero GPU frequency is only meant to be set when
the device enters SLEEP and the clocks are off. Do not permit it
to be used as a thermal level.
Change-Id: I6eedf39849ec5211977f824148883e3694cae50b
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
In recovery search for the timestamp of the command stream after
global eop instead of searching for the command stream of the
global eop and then moving the pointer forward till the start of
the command stream following global eop. This is because if the
ringbuffer is full then the global eop timestamp may have been
overwritten, so its more reliable to search for the timestamp
that occurs after global eop.
Change-Id: Ide272fd653bcba411f0c4b92b3dc2ac2fa8326a9
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Replay the all the commands that have not been executed by the GPU
in recovery with preamble turned on for the first command to see
if that succeeds. If it does then we have recovered all contexts.
If that fails then replay commands only from contexts that are
in a good state.
Change-Id: Ia2a5c9b0de5556c5182cfab3bd6ae576d15b53eb
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Expire the global timestamp and timestamps of contexts that have
cause at the end of recovery. This will prevent any users waiting
on timestamps of hung contexts to return without waiting.
Change-Id: I373de7211edd09646cdb0fb11d67b562a1ab2966
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Mark the context that has caused a hang in recovery before
calling the extraction function. This updates the context
state correctly early in recovery.
Change-Id: I68cbe5cc6f867c8d32dd0115eed6f1c65c54f796
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Write a separate function that sets the reset status of each
context after recovery.
Change-Id: I0fbd6578625637373beb9a565024043ece186e6d
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
We do not have to restore the per context timestamp states during
recovery as this data is irrelevant after recovery.
Change-Id: I3f0350afda4b4ecbdd60027720b7e4832adf04a3
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Turn on the preamble of the IB sequence in which hang is assumed
to have happened so that the bad sequence can be replayed.
Change-Id: I7123f6b5152a530c38999d6ef4aa5476d64960a7
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Make the code more readable by writing a separate function to
detect the end of last command that is assumed to be successfully
executed by the GPU
Change-Id: Icab1f4e563ea533c48aba9c57afb548501e19552
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Create a separate function that extracts valid commands from good
contexts and invalid commands from bad contexts during recovery
Change-Id: Icffe34821c1b70ca1a8c1a8e13a0b7e23d0ec193
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Use the data set in the recovery structure when extracting
valid commands from the ringbuffer instead of reading
it from the device/memory.
Change-Id: I9cbcc09b1ce95313c2d3cf59fbb649dad2cb9d99
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Create a new data structure that holds all the information required
for recovering from hangs. This data structure is initialized as soon
as hang is detected because if the GPU is under DOS attack then by
the time we start recovery the recovery data may have changed.
Change-Id: I862787267c582b9ca95bb191fb3503ceba1faa8c
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Add command sequence start identifier for commands submitted from
kgsl as well since this will be used during recovery. We will just
try recovery and not try to differentiate between commands from
kgsl or from user space.
Change-Id: I433e9f2786268c6c51a446e3c7cf9eb5fd429197
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
When performing postmortem, check for IOMMU pagetable change commands
which will allow us to find the IB from the correct pagetable.
Change-Id: I411f4c78632d1673d49d5557da435e2a9d31d420
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Start the sleep timer if recovery from hang is successful.
This prevents GPU from entering low power states during
recovery.
Change-Id: Icb021f1b1bfae7876394fa572acd156115372ac3
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Remove unneeded idle commands from the command stream when updating
pagetables and doing TLB flushes. Ths cuts down on the number of
commands in the ringbuffer during switches.
Change-Id: Ic0dedbad7a0d64c39518b2dd2bb6322f4ab74ba0
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Modify GMEM Restore procedure as per A3XX GPU spec to support
multiple GPU revisions.
Change-Id: I037cc32c5e259a2ff83cd579b586e9c1f585236f
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>
Move almost all of the SOC based GPU identification code out
of the KGSL driver and into the board files. This cleans up
the GPU side and reduces our usage of the cpu_is and machine_is
macros.
Change-Id: Ic0dedbad34eb034316b7baabf05aa7f8e8aa9ced
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
The pdata structure and associated structs have no business being
in msm_kgsl.h. Move them to include/mach/kgsl.h where they can
thrive in a non-userspace facing environment.
Change-Id: Ic0dedbadfe0d3d7d44f50c8a9a7f4cc59057d44b
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Modify GMEM Save procedure as per A3XX GPU spec to support
multiple GPU revisions. It also fixes A3XX GPU
hang caused by GMEM save procedure.
CRs-Fixed: 375034
Change-Id: I24a4d6c4fd8304b3f41a167c116a75f2e3680158
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>
Before returning from recovery routine, wait for the GPU to
become completely idle to ensure that recovery passed
Change-Id: I381b2e62641b0eaf187b410e2d043a6d4f1f4e3b
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
The condition argument to the WARN call in ion_share_dma_buf
is missing. Add the argument to allow correct printing of
warning message.
Change-Id: I6ded3a78d3030f38bf29a1be063364690cbc0ddb
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Add an idle for synchronization after writing the SMMU ASID register.
Change-Id: I1e13c9725e52293b7d4b9034fd1bac045ca5f0d1
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
User memory needs to be zeroed out before it is sent to the user.
To do this, the kernel maps the page, memsets it to zero and then
unmaps it. By virtue of mapping it, this forces us to flush the
dcache to ensure cache coherency between kernel and user mappings.
Originally, the page_alloc loop was using GFP_ZERO (which does a
map, memset, and unmap for each individual page) and then we were
additionally calling flush_dcache_page() for each page killing us
on performance. It is far more efficient, especially for large
allocations (> 1MB), to allocate the pages without GFP_ZERO and
then to vmap the entire allocation, memset it to zero, flush the
cache and then unmap. This process is slightly slower for very
small allocations, but only by a few microseconds, and is well
within the margin of acceptability. In all, the new scheme is
faster than the default for all sizes greater than 16k, and is
almost 4X faster for 2MB and 4MB allocations which are common for
textures and very large buffer objects.
The downside is that if there isn't enough vmalloc room for the
allocation that we are forced to fallback to a slow page by
page memset/flush, but this should happen rarely (if at all) and
is only included for completeness.
CRs-Fixed: 372638
Change-Id: Ic0dedbadf3e27dcddf0f068594a40c00d64b495e
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
This reverts commit 5462907f72ddcc7d337ce9431d54428c8dc486eb.
Change-Id: Ibe6ec76096838b71e43cd9beac1f57ff179c5008
Signed-off-by: Sunil Joseph <sunilj@codeaurora.org>
Update the call sites of cpu_is_msm8930() to include checks
for the MSM8930AA() variant. Relevant drivers will be
updated for more driver-specific specific MSM8930AA checks
at a later time.
Change-Id: Iff1af7a5454ec56c40390682ce2b4b6d1d325c91
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
Add EXPORT_SYMBOL to specific functions that should be
allowed to be used from within kernel modules.
Change-Id: I666c1f1a18d5af58906cb2185c5cf29d8596013f
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Per revised design decisions, cpu_is_msm8930() shall only
return true on 8930, and not on the 8627 variant. Modify
the cpu_is_xxx functions to reflect this change, and update
call sites accordingly.
Change-Id: I50b943f80c731717e6cd5d7fffb13aeec0f85a40
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
last_expired_ctxt_id was used briefly for per context timestamps and now
can be removed as it is no longer used.
Change-Id: I51d3947fe6da366824d1b947ae3448bee3518477
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>