SLEEP & SLUMBER should both wake at default power level on targets w/
GPU DCVS. Combine the calls to make this possible.
CRs-Fixed: 369927
Change-Id: I386a9ab04850b0beb249b47398ad623f91fbbfda
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
We do not need to do a soft reset of the A3XX GPUs after power on
as all the interesting registers appear to be in a reasonable power
on state. This saves 20ms during suspend/resume.
CRs-Fixed: 369927
Change-Id: Ic0dedbad367e8b402aefbf6e7746ae5b17120ac8
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
The IOMMU registers should only be accessed by priv bank. Create a separate
pagetable for priv bank and map the IOMMU registers to only this pagetable.
This is only supported for devices which can use the priv bank for
performing in stream pagetable switches.
Change-Id: If9edada5d3a05e9a660c126139e18091b1ab43cc
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Add support to allow ion_cp_heap.c to secure according to new
requirements. This includes adding versioning to the secure
calls to allow other types of securing to take place.
Change-Id: I65e07ebaeefa1d0572b6531753a707a28284aa0d
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
CL contexts turn off the VPC block while running to avoid a hang. The
VPC block needs to be turned back on before any GL calls. This includes
GMEM restore, so set the clock control value back to the original default
before doing any other operations.
CRs-fixed: 363922
Change-Id: Ic0dedbad6b031ccd9c0816013b75ba9effb18fcb
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
When an axi error happens and the GPU is using IOMMU then a warning stack
trace was being reported. This is because during axi error interrupt
handling the IOMMU clocks were being turned on to read the current
pagetable base address. Switching the IOMMU clocks from interrupt context
is not allowed. Fix this by reporting the axi error and displaying 0
as the pagetable base address since we cannot read its value from
the axi error interrupt code.
Change-Id: If98538bc1b2df51a1b3632faf449d5d332bccc3e
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
In the IOMMU heap, the return value of msm_allocate_iova_address
needs to be checked instead of the value of the iova address.
Check the return value instead.
Change-Id: I4554515d17c926a7dd738824aff21eb65d2ba56a
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
When GMEM save is not performed, the events to reuse shader space
can get dropped. This make the CP block to wait indefinitely
causing a hang. To unblock this, issue a packet to set shader bases.
This applies only to A20x/220 GPU.
CRs-fixed: 365465
Change-Id: I3ea6a58821b238706f167845380370d5bd19c4b3
Signed-off-by: Ranjhith Kalisamy <ranjhith@codeaurora.org>
Reference count the calls to ion_{un}secure_heap. The secure SCM
call will only be made when the count goes from 0 -> 1 and the
unsecure call will only be made when the count goes from 1 -> 0.
Change-Id: Ia221b79782c9223d9853ef00c2848e1ab7a73091
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
The next generation of content protection has separate SCM
calls into TZ. Add these functions in a dedicated file so they
can be used by any Ion heap.
Change-Id: I197130f6a5fc33efcd6871b0f7c362fa99f18d20
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
kgsl_core_exit() should not call kgsl_sharedmem_uninit_sysfs() and
device_unregister() if those resources have not been allocated.
We check this by seeing if kgsl_driver.virtdev has been
populated or not.
CRs-fixed: 359477
Change-Id: Ic040667b29bd4e006e6f29a50809d94a2bb4b469
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
Dump the shader memory (working memory and shadow memory) for A3XX GPUs
in the snapshot.
Change-Id: Ic0dedbadf28733b96323a680b014dbea10b1ceda
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Update the snapshot header to version 2 to return the raw chipid
in the dump.
Change-Id: Ic0dedbad82bbe61395924bf49cb0144e5e2e10e3
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
There are some subtle differences between revisions of GPUs
that are not reflected in the GPU ID value. Return the raw
chipid (derived from the hardware) along with the GPU ID
when queried.
Change-Id: Ic0dedbad035a80726e6fedc066ec11b78b79da2b
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
The code seeking out the failing frame for a hang got confused if
the CP read and write pointers were equal resulting in missing
IBs.
Change-Id: Ic0dedbadb32e4a708d0f8ee9e8a853fdfaff10b0
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Use a iterator to cleanup how snapshot GPU objects are printed.
This removes a ton of ugly math, and allows us to do subtle
silly things like add padding at the end of a non dword
aligned object.
Change-Id: Ic0dedbadabeee50f42fe9be62ea0b7dfc1f333da
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Enhance the logic that checks to see if the CP_RPTR is stuck
mid packet. Ensure that when we do packet counting that we
use real type3 packets instead of regular data pretending to
be a type3 packet.
Change-Id: Ic0dedbadb502fa2790df0c6752309da300d6d1ae
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Currently we just check the most significant two bits of a dword
in the ringbuffer or IB are set to decide if the data is a type3
packet header. This has proven to be problematic, as it turns out
that the top two bits are often set in nominal data. Enhance
the type3 packet check to verify that various reserved bits in
the dword are 0 as expected.
Change-Id: Ic0dedbada5eff8353bc64da9eefd9919de127fa4
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
User side drivers are starting to use more indirect buffers
for CP_LOAD_STATE, so expand the snapshot to support grabbing
all of the possible combinations.
Change-Id: Ic0dedbadff743d03b5accb2a0299ab5dc0bc1a61
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
If there is a failure in drawctxt create, then the KGSL core will call
drawctxt destroy to free the memory. If the failure happened soon
enough, there might not a drawctxt to free.
CRs-Fixed: 371852
Change-Id: Ic0dedbad629090ae1827e354b9b94bbd3c5efcdd
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
This reverts commit 609467077ae6b794af47613e05949e8b2fb3a842.
Change-Id: I457634982603c957788b749198219d0974bd1de5
Signed-off-by: Zhoulu Luo <zluo@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.
CRs-Fixed: 340620
Change-Id: I8393ca74aabfe4b711b61efb023d38d6ab852eec
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
Change prevents IOMMU pagefaults which may occur when
indexing reaches 4096/sizeof(kgsl_devmemstore) number
of contexts
CRs-Fixed: 370594
Change-Id: If726c2a1fcf7667b062e890453a71e95f5417c60
Signed-off-by: Richard Ruigrok <rruigrok@codeaurora.org>
Use one code path to dereference shared variables. Simplify code
for readability.
Change-Id: Ifcfe948b7c04a6594c3fa9eac4afea81f65e59af
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
Make a3xx ftrace always print timestamps in hex rather than
sometimes in hex and sometimes in decimal.
Change-Id: I6b1709458afd9361fd04bab06c1a4b22aaadd082
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
We need to add a draw workaround command sequence after every 50 context
switches if the gmem has not been saved in those 50 switches. This
workaround is required to prevent the GPU from deadlocking. Since gmem
save commands have draw calls in them we only need to execute this
workaround if the gmem has not been saved. The number 50 was chosen
empirically.
CRs-fixed: 362302
Change-Id: I1a659c85736c47fe6f45030b20ce7a12851b0815
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
In msm8930 V1.2, there are few HW fixes added for A305 GPU,
communicate new chipid to userspace driver to remove SW workarounds.
Change-Id: I51f272a39cb2cc60541607af9fa9be70cc838cb3
Signed-off-by: Sudhakara Rao Tentu <srtentu@codeaurora.org>
Get the current pagetable being used by the GPU by reading the
pagetable register during iommu pagefault and use that base
address to get the pid of the process corresponding to the
pagetable. Earlier we were using the pagetable address that the
IOMMU driver thinks is presently set for the GPU which may not
always be the case because we change the pagetable used by the
GPU without informing the IOMMU driver.
Change-Id: I7cf788f5d0f9454deb139ed3ad75bb4e750f4772
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Moves fixed area start address down, so that non secure
video firmware heap and secure video firmware area overlap.
Both use the region in a mutually exclusive manner.
ALso introduce a hole, that can be used by MM heap
lock down for content protection.
Change-Id: Ic240377da25e00423742ccb73dbb60a1ff037e37
Signed-off-by: Deepak Kotur <dkotur@codeaurora.org>
[sboyd: drop board file changes]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Instead of using custom routines for cache operations use the
standard operations for cache flush, cache clean, and cache
invalidate. In addition only call outer cache routines if
outer cache is available.
Change-Id: Idb51bf7348fd526ebdea1e6ff2e366b8a3b4de33
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Going forward, clients may want to have more control over the
virtual address space for iommu domains. Add API to support
clients registering virtual address space information. Current
clients are internally converted to use the new APIs.
Change-Id: Iaec9f1cd150eefc02ce22c34790494b61f21eb12
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Add dump of physical memory map, showing allocated and
free areas, to debugfs interface for heaps with carveout memory.
Change-Id: I9bda9f3e555e55570c95e652616ca1fcc25eb0ab
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Access to rb tree of user and kernel ION clients
must be protected by a mutex.
Change-Id: Ie27eba65f8cab3a7c20c041eb46429ba62c5c00f
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
When the last buffer is freed from a heap that uses fmem we call
into fmem to transition the memory from c-state to t-state. However,
if the heap has been secured for content protection transitioning
the memory from c-state to t-state could cause undefined behavior
in fmem.
Add checks to ensure that a secured heap will not transition to
t-state until heap is unsecured.
Change-Id: I672274c8bcb9912652e82588941fe840b08b3473
CRs-fixed: 359593
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Add logging of buffer physical address (if allocation
is from physically contiguous heap) and iommu mapping
information to the ion client debug interface.
Change-Id: Id3a77c1b5e3c5d15b11b3612f07d10092922cdff
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Add check for null argument to avoid dereferencing
a null-pointer.
Change-Id: Icb452d0764e375bf2684e013c51d260de98e8583
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
ION_IOC_MAP, ION_IOC_SHARE, and ION_IOC_IMPORT may return
success when an error occurs.
Add correct error handling to ION_IOC_MAP, ION_IOC_SHARE, and
ION_IOC_IMPORT.
Change-Id: Idb7e58c94dab53fd82dd49150af9eaec78430c40
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
During bootup add check to ensure heap addresses are not overlapping
with each other. If a heap is found to be overlapping with another
heap boot will be stopped with a call to panic.
Change-Id: Id37aefa2e09aa165ec376e241e282faf5f3c5737
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Under certain error conditions the following ION ioctl's would return
success even when the operation failed:
-ION_IOC_CLEAN_CACHES
-ION_IOC_INV_CACHES
-ION_IOC_CLEAN_INV_CACHES
Add return of correct error codes when an error occurs.
Change-Id: Ie8824bfecbb423c23d32c6a3d7058f06d8322906
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Due to performance issues with 4K pages and the IOMMU we should use
64K pages. However, minimum allocation from ION is 4K so instead of
mapping on demand we need to map the full heap into the IOMMU when
the first request for mapping comes. Only unmap everything from the
IOMMU when the last buffer is freed.
CRs-fixed: 348606
Change-Id: Ic1793f5caaff2f69bf1fb7e8c8b3bd03378131b8
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[sboyd: drop board file, fmem, memory changes]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
IOMMU virtual address (iova) is allocated locally in IOMMU mapping
functions per heap type. When an error happens the iova's are
freed in the same function as it was allocated. However, there
is an extra free call in the ion wrapper function that calls
these IOMMU mapping functions.
Remove the extra iova free call which can cause kernel panic.
Change-Id: Ic8978cf05202b29a42da7374e2c8c1e590b2d2a8
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
iommu map functions requires clients to specify whether
the mappings should be read only or read-write (write only
is not supported). Ensure clients specify the appropriate
flags when calling map functions.
Change-Id: If42b4b0367b4311aa36d3063979ef04af3a43fc6
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[sboyd: drop kgsl changes]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
The condition argument to the WARN call in ion_free is missing. Add the
argument to allow correct printing of warning message.
Change-Id: I158e1a583b7242b2c3209d6ce64dc0b771efeffe
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
If an ion allocation fails because of memory fragmentation a debug
message should be printed. However, the logic that decides whether
the debug message should be printed or not is incorrect causing
the debug message to not be printed when the amount of space
available in the heap is equal to the requested size.
Change-Id: Iaaf8cd6742aeffab7bcb4806e485326fb9690945
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
If an ion allocation fails because of memory fragmentation a debug
message should be printed. However, the logic that decides whether
the debug message should be printed or not is incorrect causing
the debug message to not be printed when it should.
Change-Id: I6537171db0a47ba072d182e9bb3125cac5513ff9
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
The multimedia firmware on 8960 will always be
loaded into a fixed address, and all callers into
this firmware must be no more than 256M above the
start of this firmware.
This implies that the the mm ION heap and its associated heaps
(mm_fw and mfc) must also be created in a fixed place.
This version of the patch keeps the mm fw heap size
to 2M for compatibility with the current tip. This
will eventually be reduced to 1M.
Change-Id: I35f89b8c60165fb0adbb9d04412e0e200117beb9
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[sboyd: drop memory.c changes]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Instead of mapping 1 4K page at a time into the IOMMU create a
scatterlist and map everything at once. This will be more efficient.
Change-Id: I8e83066869dd6f7a479bad22a66e4c70cc5973b5
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Ion carveout and content protect heap buffers do not
have a struct page associated with them. Thus
sg_phys() will not work reliably on these buffers,
so set dma_address on their scatterlists.
CRs-Fixed: 345257
Change-Id: Ifdad5ce497de170f47b4ee2f7a93563a5cbe1a96
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>