Due to limitations in the multimedia architecure
clients might not know when a buffer can be unmapped
from the IOMMU. In addition, the multimedia architecture
causes unnecessary mappings/unmappings for the same buffers
which reduces framerates.
Add logic to delay unmapping from the IOMMU
until buffer memory is freed and unmap any outstanding
mappings to avoid virtual memory address space leak.
Change-Id: Idaeae269d9ba623e25a0cb087a89b4cbb63915af
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
IOMMU is missing support for ion_map_dma.
ION clients need support for this api.
Add functions to implement ion_map_dma and
ion_unmap_dma in the IOMMU heap.
Change-Id: If5723f0d7ec1145e9c9d8b88a42b57ab0f2c2da7
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
The IOMMU heap must support cache operations so that clients
can do cached allocations from the heap.
Add function to perform cache operations on memory
allocated from IOMMU heap.
Change-Id: I49a84dca613b7c209dde03b67b2fc1b2c9d844dd
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Clients using ION must be able to mmap a smaller
set of pages than what was allocated from the
IOMMU heap.
Add check that we don't try to map a page passed
the end of the vma.
Change-Id: I1241f952359f6bb1d5bb0deb11cc0f44d94a3404
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Postmortem dump was not parsing CP_INDIRECT_BUFFER_PFE commands.
Snapshot was recently fixed to handle this, and this change
extends support to postmortem dump.
Change-Id: I07775ef4449efabc8cdebb1635835e7526b1c36e
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
This function is supposed to return the memdesc that
contains the range gpuaddr to gpuaddr + size. One of the
lookups was using sizeof(unsigned int) instead of size,
which could cause false positive results from this function
and possibly kernel panics in the snapshot or postmortem
code, which rely on it to do bounds checking for them.
Change-Id: I65dc48108f2010887e620a252a6afbd88473ac6e
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Add events for tracking memory operations by userspace
clients: kgsl_mem_alloc, kgsl_mem_map, kgsl_mem_free,
kgsl_mem_timestamp_queue (adding an entry to the free
on timestamp list) and kgsl_mem_timestamp_free (when
the memory is actually freed).
Change-Id: Id62eec30ea20a0f00f7a7a791c7e5b8dfad487af
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Having the snapshot buffer physically contiguous will make
it easier to recover from a ram dump in case the system
crashes after a hang. Also log the buffer address when
the snapshot is created so we know where to look for it.
Change-Id: I13fe603d0e9cb1118d15926ff5f8855420365c42
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Unknown ioctl code errors are supposed to be ENOIOCTLCMD,
not EINVAL.
Change-Id: Id38529e4ec70d63091a9273a780585aea6ae9d9a
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
The sysfs code was reading the wrong entry in the stats
array, so it printed the wrong value.
Change-Id: I26ce8bbca152a98e3dac53a9c154e52b020d5532
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
The timestamp of 2D core should not be set to 0 on startup if the
device has previously been started and is waking up from a suspend call.
This can cause processes to wait indefinitely for the 2D core if
they received a timestamp before the device went into suspend
Change-Id: Ida5dbdcb89ea7e0cf86110ecc2bd7d568123c364
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
For msm8x25, the adreno version returned by hardware is incorrect. Patch
the version to return the correct one.
Change-Id: Ie47ff55a5196442545f5adc60f4c7ce833ba458d
Signed-off-by: Ranjhith Kalisamy <ranjhith@codeaurora.org>
Clients need to be able to do cache operations
on ION buffers in the kernel. Add API to
flush, invalidate, or invalidate and flush the
cache of an ION buffer.
Change-Id: I2b676dbe32372b3c17e4aaf39f51878b105a699c
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Cached IOMMU mapping is not supported.
Add check for clients trying to map buffers
into IOMMU as cached and return error.
Change-Id: Ic63a24bf651d613933633cd81143701f66df566c
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Return the reset status of the GPU unit when
IOCTL_KGSL_DEVICE_GETPROPERTY is called with
type KGSL_PROP_GPU_RESET_STAT
Change-Id: I4bb17be959eadba3ba491d94c6fd4f5824442e92
Signed-off-by: Shubhraprakash Das<sadas@codeaurora.org>
Add /sys/kernel/debug/kgsl/kgsl-3d0/postmortem/ib_enabled to debugfs,
to control whether IBs are dumped by postmortem dump. Add check to
postmortem dump to dump registers if register dump is enabled.
By default ib dump and register dump during postmortem dump are
disabled.
Change-Id: I71b0b0c97be0753f88f6f57a1cbc6b5ee93aaffc
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
When searching for indirect buffers to dump in the snapshot, look for
all of the variations for the indirect buffer opcode, not just the
most commonly used one. This picks up many IB2 buffers that were
previously left behind.
Change-Id: Ic0dedbad0fef91bf21a5de6d1928f350d2ad2009
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
In the vast majority of cases the only interesting indirect buffers (IBs)
to dump in a shapshot are the ones that are in the current context
because they are the ones that probably contributed to the hang. Limit
the IBs that are dumped to the range between the start of context and
the RB read pointer. If the start of context can't be found, then dump
from the start of the ringbuffer dump to read pointer. Also, since
buffers can be reused (though typically not in the same context), use the
most recent parsed size when dumping the IB to make sure we get the right
buffer contents for the most recent usage of said buffer.
Change-Id: Ic0dedbad090156d69b964e229806aa45242de6fd
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Add the VBIF registers that we modify to the snapshot dump so they
can be properly verified after a hang.
Change-Id: Ic0dedbad07ab62cbd96a0c2e7343b38779163e24
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
PMEM uses buffered mappings when PMEM device is
opened with O_SYNC flag. ION should have the same
behavior as PMEM.
Change ION to provide buffered mappings instead
of uncached when the O_DSYNC flag is used when
opening the ION device.
CRs-fixed: 335827
Change-Id: I369a35a2ff68adc8339380dfbb7721e3d361ee69
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
The pt pointer was being checked against NULL value after it was
dereferenced
Change-Id: Ifbdeb7bec5e3f28396196d8f55356e5dbf1a2e55
CRs-Fixed: 336516
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
The wrap around value while comparing timestamps determines whether
the smaller timestamp value has wrapped around or not. Increase this
value as we are hitting cases where we detect a wrap around condition but
in reality the timestamp has not yet wrapped around.
Change-Id: I2dfbebf94468ec8895536214c81fc22ef62212ae
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Use the recommended VBIF settings to set up dual AXI port access and
better and faster timings.
Change-Id: Ic0dedbad5394d1a04a6e480e4a4ccb45c307ab17
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
APQ8064 has two AXI ports attached to the GPU with an IOMMU on both.
The VBIF can be programmed to use a round-robin arbitration to access
the ports equally, so we need to program both IOMMUs with the same
pagetable to make sure that the GPU can get where it needs to go.
All this involves a board file infrastructure change that affects 8960
too, but no functional changes are happening for that platform.
Change-Id: Ic0dedbad5198ed9c453711e58a3f1220ef5d5b4e
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Version 29 of the PM4 firmware for A3XX modified the format of the
REG_TO_MEM opcode by changing the bit shift of one the fields.
Modify the legacy context switch code accordingly. This will break
users of older firmware, but the old firmware shouldn't ever be in
wide use anyway, so backwards compatibility is not a concern.
Change-Id: Ic0dedbad9a6d50077a0001c95d2a0dcd30c4f070
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Video hardware has the following requirements for
ION heaps:
1. MM heap must be at a higher address than FW heap.
2. MFC heap must at a higher address than FW
3. MM heap must be adjacent to FW heap.
(There cannot be another heap between FW and MM heap)
4. MM and MFC heap cannot be more than 256MB away
from the base address of the FW heap.
MM heap is configured as a reusable heap (FMEM heap) and FMEM
is carved out at a much higher address than the other heaps breaking
the above requirements. To support the above requirements the
MFC heap together with the FW heap must be carved out at the same
location as MM heap.
Change-Id: Ie0acb4b267d4307190ea3cd9ff23c710ffa1a538
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
* changes:
msm: kgsl: change timestamp frees to use kgsl_event
msm: kgsl: cancel events from kgsl_release
msm: kgsl: remove readl/writel use for dma memory
The timestamp memqueue was unsorted, which could cause
memory to not be freed soon enough. The kgsl_event
list is sorted and does almost exactly the same thing
as the memqueue did, so freememontimestamp is now
implemented using the kgsl_event list.
CRs-Fixed: 327647
Change-Id: Ia93431bc5f31a9286cc78a92271b43a3a6ac9baf
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Events need to be cancelled when an fd is released,
to avoid possible memory leaks or use after free.
When the event is cancelled, its callback is called.
Currently this is sufficient since events are used for
resource management and we have no option but to
release the lock or memory. If future uses need to
distinguish between the callback firing and
a cancel, they can look at the timestamp passed to
the callback, which will be before the timestamp they
expected. Otherwise a separate cancel callback can
be added.
CRs-Fixed: 327647
Change-Id: I49f8f58aea6366344d1c82613f73881a169834b3
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
For dma_alloc_coherent() you don't need writel/readl because
it's just a plain old void *. Linux tries very hard to make a
distinction between io memory (void __iomem *) and memory
(void *) so that drivers are portable to architectures that
don't have a way to access registers via pointer dereferences.
You can see http://lwn.net/Articles/102232/ and the Linus rant
http://lwn.net/Articles/102240/ here for more details behind
the motivation.
Change-Id: I3da075c30304e4adf321cfb3edb1baa4a93fc2ce
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
There are a some workloads where interrupts do not
always get generated, and as a result the timestamp
work was not triggered often enough.
Queue timestamp expired work from adreno_waittimestamp(),
when the timestamp expires while we are not waiting.
It is possible in this case that no interrupt fired
because no processes were waiting.
Queue timestamp expired work when freememontimestamp
is called, which reduces the amount of memory
built up by applications that use this api often.
CRs-Fixed: 336057
Change-Id: Ib4610dfa53af04b5a7b1eb51281d32d0e5be8471
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Idle the core before changing the gpu clock as instability
is caused on some platforms on changing the clock freq when
core is busy.
CRs-fixed: 328249
Change-Id: I5f6a507eaad383bde646001d2e10c2b62880515b
Signed-off-by: Kedar Joshi <kjoshi@codeaurora.org>
Poking once during adreno_idle is not enough; a GPU hang may still happen.
Seen on 7x27A. Write a few times during the wait timeout, to ensure that
the WPTR is updated properly.
Change-Id: Id704e187a05540afa6ef4b0542d16c7bb9a6372d
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
* changes:
msm: kgsl: Disable ME, PFP split timeout and VFD interrupts.
msm: kgsl: Context switch fixes for A3XX
msm: board-8064: Fix 8064 GPU clk at 192 Mhz
msm: kgsl: Use the right physical addresses in NOMMU mode
msm: kgsl: Only use the setstate slowpath for A3XX
msm: kgsl: Set the default MMU to 'none' for APQ8064
msm: kgsl: Fix the A3XX debugbus snapshot code
msm: kgsl: Enable A3XX GPU hang detection
msm: kgsl: A3XX GMEM save/restore was never executed
msm: kgsl: Correct the microcode sizes in the GPU snapshot
msm: kgsl: Update the GMEM and istore size for A320