Commit Graph

5079 Commits

Author SHA1 Message Date
Linux Build Service Account
04a73cf0a8 Merge "Revert "msm: kgsl: Remove wakelock and pm_qos requirements"" into msm-3.0 2012-03-10 09:51:46 -08:00
Olav Haugan
b36765960a gpu: ion: Delay unmapping from IOMMU.
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>
2012-03-09 09:49:47 -08:00
Olav Haugan
ab804b883a gpu: ion: Add map_dma support in IOMMU heap
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>
2012-03-09 09:49:28 -08:00
Olav Haugan
ef0107124e gpu: ion: Add cache operations to IOMMU heap
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>
2012-03-09 09:49:22 -08:00
Olav Haugan
dbec7db15d gpu: ion: Allow smaller mappings
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>
2012-03-09 09:49:00 -08:00
Lucille Sylvester
10297895f5 Revert "msm: kgsl: Remove wakelock and pm_qos requirements"
This reverts commit ef44e7338f.

Conflicts:

	drivers/gpu/msm/kgsl_pwrctrl.c

Change-Id: Ic67995af9e32006ffbe031367df8341f2caedf99
CRs-Fixed: 333977
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
2012-03-08 12:09:33 +05:30
Jeremy Gebben
6ca1d15190 msm: kgsl: handle all indirect buffer types in postmortem
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>
2012-03-07 16:05:32 -07:00
Jeremy Gebben
1ab51045b5 msm: kgsl: fix size checking in adreno_find_region
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>
2012-03-07 16:05:31 -07:00
Linux Build Service Account
d1629b88d1 Merge changes Id62eec30,I13fe603d,Id38529e4,I26ce8bbc into msm-3.0
* changes:
  msm: kgsl: add userspace memory alloc and free tracepoints
  msm: kgsl: allocate the snapshot buffer from kmalloc
  msm: kgsl: return correct error code for unknown ioctls
  msm: kgsl: fix statistics for ion memory regions
2012-03-06 22:18:43 -08:00
Linux Build Service Account
b2f1249e8f Merge "msm: kgsl: Check before resetting timestamps of 2D core to 0 on startup" into msm-3.0 2012-03-06 22:18:43 -08:00
Linux Build Service Account
7adc823b29 Merge "msm: kgsl: Add support for controlling ib dump in postmortem dump" into msm-3.0 2012-03-06 22:18:43 -08:00
Jeremy Gebben
a5859279c8 msm: kgsl: add userspace memory alloc and free tracepoints
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>
2012-03-05 11:39:46 -07:00
Jeremy Gebben
9d15ae432b msm: kgsl: allocate the snapshot buffer from kmalloc
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>
2012-03-05 11:39:46 -07:00
Jeremy Gebben
c15b4613d7 msm: kgsl: return correct error code for unknown ioctls
Unknown ioctl code errors are supposed to be ENOIOCTLCMD,
not EINVAL.

Change-Id: Id38529e4ec70d63091a9273a780585aea6ae9d9a
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
2012-03-05 11:39:46 -07:00
Jeremy Gebben
ff6eab00fd msm: kgsl: fix statistics for ion memory regions
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>
2012-03-05 11:39:46 -07:00
Linux Build Service Account
49f95a982e Merge "msm: kgsl: Add support for adreno203 in msm8x25" into msm-3.0 2012-03-05 04:43:58 -08:00
Shubhraprakash Das
8cbd23218e msm: kgsl: Check before resetting timestamps of 2D core to 0 on startup
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>
2012-03-04 16:05:27 -07:00
Linux Build Service Account
4d088da993 Merge changes I2b676dbe,Ic63a24bf into msm-3.0
* changes:
  gpu: ion: Add API to do cache operations
  gpu: ion: Do not allow cached IOMMU mappings.
2012-03-03 15:40:48 -08:00
Ranjhith Kalisamy
938e00f21a msm: kgsl: Add support for adreno203 in msm8x25
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>
2012-03-03 21:15:31 +05:30
Olav Haugan
41f8579a79 gpu: ion: Add API to do cache operations
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>
2012-03-02 17:33:19 -08:00
Olav Haugan
79e9ffa55a gpu: ion: Do not allow cached IOMMU mappings.
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>
2012-03-02 17:33:19 -08:00
Shubhraprakash Das
2dfe5dd0c5 msm: kgsl: Add a new property to IOCTL_KGSL_DEVICE_GETPROPERTY
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>
2012-03-02 13:47:28 -07:00
Harsh Vardhan Dwivedi
ff6dc297b8 msm: kgsl: Add support for controlling ib dump in postmortem dump
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>
2012-03-01 12:06:51 -07:00
Jordan Crouse
2832867ed2 msm: kgsl: Identify all variations of indirect buffer opcodes
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>
2012-02-27 16:29:35 -07:00
Jordan Crouse
e9e91bf3e4 msm: kgsl: Limit buffer dumping in the snapshot to the current context
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>
2012-02-27 16:27:31 -07:00
Jordan Crouse
1268f9cf28 msm: kgsl: A3XX: Add VBIF registers to the snapshot dump
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>
2012-02-27 16:27:26 -07:00
Linux Build Service Account
d705a48883 Merge "msm: kgsl: Dereference pagetable pointer after checking it's not NULL" into msm-3.0 2012-02-25 20:51:56 -08:00
Linux Build Service Account
3b8582b49c Merge changes Ic0dedbad,Ic0dedbad into msm-3.0
* changes:
  msm: kgsl: A3XX: Use recommended VBIF setings for dual port access
  msm: kgsl: Program both IOMMUs at our disposal on 8064
2012-02-25 12:46:51 -08:00
Linux Build Service Account
cce42f625a Merge "gpu: ion: Change from uncached to buffered mapping" into msm-3.0 2012-02-25 12:46:51 -08:00
Linux Build Service Account
8e3e62e472 Merge "msm: kgsl: Increase the wrap around constant while comparing timestamps" into msm-3.0 2012-02-25 12:46:51 -08:00
Linux Build Service Account
68f4b74978 Merge "msm: kgsl: Update A3XX REG_TO_MEM opcodes in legacy context switch" into msm-3.0 2012-02-23 21:36:41 -08:00
Olav Haugan
de074a7d5b gpu: ion: Change from uncached to buffered mapping
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>
2012-02-23 13:48:18 -08:00
Shubhraprakash Das
c0f21b6bc1 msm: kgsl: Dereference pagetable pointer after checking it's not NULL
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>
2012-02-22 00:01:37 -07:00
Linux Build Service Account
c18a9d9375 Merge "Revert "msm: kgsl: flush device workqueue before stop"" into msm-3.0 2012-02-21 19:55:53 -08:00
Shubhraprakash Das
3dd7375fa4 msm: kgsl: Increase the wrap around constant while comparing timestamps
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>
2012-02-21 11:22:59 -07:00
Jordan Crouse
563cf0fd47 msm: kgsl: A3XX: Use recommended VBIF setings for dual port access
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>
2012-02-21 09:18:33 -07:00
Jordan Crouse
46cf4bb5eb msm: kgsl: Program both IOMMUs at our disposal on 8064
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>
2012-02-21 09:18:31 -07:00
Jordan Crouse
d00708822d msm: kgsl: Update A3XX REG_TO_MEM opcodes in legacy context switch
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>
2012-02-21 09:18:29 -07:00
Olav Haugan
f6dc774968 gpu: ion: Move MFC heap to different address
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>
2012-02-19 20:26:15 -07:00
Suman Tatiraju
4a32c65a5a Revert "msm: kgsl: flush device workqueue before stop"
This reverts commit f8e5cd2af7.

Change-Id: Ie2902a33ffca298a27d9ef811e7e57a6d3630c5f
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
2012-02-17 12:06:49 -08:00
Linux Build Service Account
1d5e261d0a Merge changes Ia93431bc,I49f8f58a,I3da075c3 into msm-3.0
* 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
2012-02-16 00:08:24 -08:00
Linux Build Service Account
8a9b385bb4 Merge "msm: kgsl: Idle the core before changing the gpu clock." into msm-3.0 2012-02-15 11:27:50 -08:00
Jeremy Gebben
c81a3c6d18 msm: kgsl: change timestamp frees to use kgsl_event
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>
2012-02-13 12:52:28 -07:00
Jeremy Gebben
fd87f9ac2c msm: kgsl: cancel events from kgsl_release
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>
2012-02-13 12:52:28 -07:00
Jeremy Gebben
aba1327fbd msm: kgsl: remove readl/writel use for dma memory
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>
2012-02-13 12:52:27 -07:00
Jeremy Gebben
6390483572 msm: kgsl: queue timestamp expired work more often
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>
2012-02-13 12:52:26 -07:00
Kedar Joshi
c11d098f53 msm: kgsl: Idle the core before changing the gpu clock.
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>
2012-02-13 10:39:07 +05:30
Lynus Vaz
284d10404f msm: kgsl: Poke regularly in adreno_idle
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>
2012-02-10 05:38:26 -07:00
Linux Build Service Account
f4be39fe8e Merge changes I32e71478,I85895451,I00b0b40b,Ic0dedbad,Ic0dedbad,Ic0dedbad,Ic0dedbad,Ic0dedbad,Ic0dedbad,Ic0dedbad,Ic0dedbad into msm-3.0
* 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
2012-02-09 22:09:38 -08:00
Linux Build Service Account
6cce25a428 Merge "gpu: ion: Add support for IOMMU in CP heap" into msm-3.0 2012-02-09 20:28:09 -08:00