Commit Graph

253 Commits

Author SHA1 Message Date
Linux Build Service Account
161c07db73 Merge "msm: kgsl: make pm_qos vote to default when in slumber" into msm-3.0 2012-03-28 10:51:24 -07:00
Linux Build Service Account
cfb26ebcdf Merge "msm: kgsl: Return the correct A3XX GPU ID based on SoC type" into msm-3.0 2012-03-28 08:50:40 -07:00
Suman Tatiraju
3005cddf58 msm: kgsl: make pm_qos vote to default when in slumber
Change the pm_qos vote to default when the diplay goes
off. This allows the cpu to do idle power collapse after
display goes off.

Change-Id: Id7c3af50e66c9deab483da98cac2569f56cd21e4
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
2012-03-28 02:21:24 -06:00
Linux Build Service Account
a354674bf9 Merge "msm: kgsl: Make idlestats pwrscale policy default for 7x27A" into msm-3.0 2012-03-27 22:56:21 -07:00
Jordan Crouse
54154c6436 msm: kgsl: Return the correct A3XX GPU ID based on SoC type
It turns out that A3XX_RBBM_HARDWARE_VERSION returns 0x0 for both A320
and A305.  This, combined with some faulty logic in the GPU list, caused
A320 to be reported as a A305.  This had the immediate effect of costing
A320 on apq8054 half the GMEM that it deserves and also triggering
instabilities in the user mode driver.  Instead of trying to read multiple
registers to figure out the GPU ID, make the reasoned assumption that for
now at least, GPU ID will match SoC ID. Construct the chip_id based on the
SoC ID for A3XX targets and fix up the reported chip_id so it matches what
user space expects.

Change-Id: Ic0dedbadc74cb08fd7bc0bfb523b710ad33ed78c
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2012-03-27 17:39:50 -06:00
Jordan Crouse
6d76c4d0df msm: kgsl: Increase the virtual GPU range for the IOMMU
Instead of a fixed 256MB virtual range for both the GPUMMU and IOMMU, make
the virtual range a property of the MMU engine and set the IOMMU range to
2GB.  Technically we could go all the way up to 4G, but even 2G is far out
of the realm of possiblity in the current generation, and we wanted to
reserve some of the space for future enhancements.

Change-Id: Ic0dedbad2987beb162b6a1878dd65ffae8a78522
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2012-03-27 08:55:41 -06:00
Lynus Vaz
31754cbc8b msm: kgsl: Make idlestats pwrscale policy default for 7x27A
Idlestats powerscale policy is required for userspace GPU DCVS.
This change sets it as default, so that the GPU DCVS daemon can
be started without having to set it first.

Change-Id: Ia280c9f685262b2848f1b85d74876f15a2e6ad6f
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
2012-03-27 16:49:30 +05:30
Sudhakara Rao Tentu
5746bdee80 msm: kgsl: Configure VBIF settings for GPU with dual SMMU
Use default VBIF seetings for single SMMU in case of 8x30 and
configure VBIF settings for dual SMMU in case of 8064.

Change-Id: I0e9522eecc687615f285d905d8bd6ae4341595c9
Signed-off-by: Sudhakara Rao Tentu <srtentu@codeaurora.org>
2012-03-25 14:55:16 -07:00
Jeremy Gebben
582fe31d27 msm: kgsl: set the dma_address field of scatterlists
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.
Set the dma_address field on physically contiguous
buffers.  When mapping a scatterlist to the gpummu
use sg_dma_address() first and if it returns 0
then use sg_phys().

Change-Id: Ie5f19986446be4383dfbfffa2534136b592e8e46
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
2012-03-25 13:39:28 -07:00
Linux Build Service Account
eb51c3f8bd Merge "msm: kgsl: Do not take spinlock when mapping to IOMMU" into msm-3.0 2012-03-25 06:22:34 -07:00
Shubhraprakash Das
badaeda313 msm: kgsl: Do not take spinlock when mapping to IOMMU
The IOMMU driver takes a spinlock internally when mapping, so
do not take an additional spinlock when mapping to IOMMU table.

Change-Id: I772ffb09af95ed15dc2c3495affa9efd48e4af5b
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
2012-03-25 02:03:44 -06:00
Wei Zou
c8c0163607 Revert "msm: kgsl: Add per context timestamp"
This reverts commit 2a811252c7.

Change-Id: Ic3018f19eb1a089ae67e0f3c253cc00e7d0285e3
Signed-off-by: Wei Zou <wzou@codeaurora.org>
2012-03-24 17:29:50 -07:00
Linux Build Service Account
672228892e Merge "msm: kgsl: Add per context timestamp" into msm-3.0 2012-03-24 00:24:56 -07:00
Carter Cooper
2a811252c7 msm: kgsl: Add per context timestamp
Add new ioctls for per context timestamps.
Timestamp functions (read/write/wait) will now be context
specific rather than only using the global timestamp.
Per context timestamps is a requirement for priority
based queueing.

Change-Id: I5fdfb816480241b9552ecf90ed1bb22db3a652b5
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
2012-03-23 15:44:23 -06:00
Jeremy Gebben
7faf9ecde6 msm: kgsl: don't clear gpuaddr when unmapping global mappings
Memory mapped through kgsl_mmu_map_global() is supposed to have
the same gpu address in all pagetables. And the memdesc will
persist beyond the lifetime of any single pagetable.
Therefore, memdesc->gpuaddr should not be zeroed for these
memdescs.

Change-Id: I0f46aaee2b9e87f839e78b7978cdf1bb4239d6f5
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
2012-03-23 14:05:59 -06:00
Linux Build Service Account
a7bb217eac Merge "msm: kgsl: Remove unused debugfs files" into msm-3.0 2012-03-22 10:55:12 -07:00
Linux Build Service Account
eec2a60c6a Merge "msm: kgsl: Add GMEM size configuration in gpu list" into msm-3.0 2012-03-22 03:29:43 -07:00
Harsh Vardhan Dwivedi
6b5b94ae27 msm: kgsl: Remove unused debugfs files
istore, sx_debug, cp_debug and mh_debug have been deprecated. Remove
them.

Change-Id: I34364f8987a74e68244015992af39842342d0489
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
2012-03-21 10:31:29 -06:00
Sudhakara Rao Tentu
7985383201 msm: kgsl: Add GMEM size configuration in gpu list
To avoid msm or gpu specific code in the driver, added
GMEM size configuration parameter as a part of gpu list.

Change-Id: I3a0c4efdfbc607f3a0a87fc2350e7b40864f9f73
Signed-off-by: Sudhakara Rao Tentu <srtentu@codeaurora.org>
2012-03-20 14:16:30 -06:00
Jordan Crouse
e0879b15a4 msm: kgsl: Capture more interesting GPU buffers from a hang
Freeze more essential GPU buffers and push them into the snapshot
dump.  Add visibilty stream buffers, VBOs, index buffers and general
purpose GPU buffers to the list of frozen buffers. Parse the captured
IBs for type0 and type3 writes that indicate a buffer of interest
and add them to the dump list.

Change-Id: Ic0dedbad1ee978b951abedacb0c70481a1a7e38f
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2012-03-20 11:19:57 -06:00
Jordan Crouse
f99f5a66b7 msm: kgsl: Put only critical IBs in the snapshot section
In many cases there isn't enough room in the snapshot region to
store all the IBs from the hanging context.  Only store the
last IB1 to be executed (per the CP_IB1_BASE register) and any IB2s
within that IB1 - all other IBs in the hanging context are
marked as GPU objects. The downside to this approach is that after
a system crash, only the snapshot region can be assured to be recovered
from a RAM dump; the list of GPU objects might be skipped.  This is
why the critical IBs go in the snapshot to ensure that no matter what
at least the last buffers to execute before the hang are recovered.
The upside is this reduces the pressure on the snapshot region size and
ensures that more of the state can be recovered under normal
circumstances.

Change-Id: Ic0dedbada7869c7f5cc03ed2ed58e996294c1e8c
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2012-03-19 10:41:39 -06:00
Jordan Crouse
ea2c6380d0 msm: kgsl: Add indirect shader buffers to the snapshot
There are two ways to load shader instructions and constants -
direct (in the IB) and indirect (with a pointer to another
GPU buffer). Start dumping indirect shader buffers into the snapshot
so that complete shader information can be recreated at parse time.

Change-Id: Ic0dedbada6b0e6ba26d2bd57617976d16809129e
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2012-03-19 10:41:37 -06:00
Jordan Crouse
9610b6b9de msm: kgsl: Freeze GPU memory objects to be dumped with the snapshot
In addition to the usual objects in a snapshot (registers, ringbuffer,
IBs, etc), there are a handful of indirect GPU buffer objects that are
created and used during draw operations. These include shaders, buffer
objects, and various state buffers.  Taken together, these buffer
objects can be large, much larger then the snapshot region we have set
aside. Fortunately, these buffers are independent and don't need to be
freed or overwritten when the context is reset.

Long story short we can take these buffers, put them in a list at snapshot
time and mark them so they don't get freed.  Then, when the snapshot is
grabbed dump them into the output stream inline and only then free them.
This allows us to snapshot a larger section of the GPU state without having
to worry about having enough memory set aside.  The only downside is that
some GPU memory will stick around, but we hope that hangs are few and far
between and that some entity will grab the dump soon after the hang so the
memory can be released.

Change-Id: Ic0dedbad0629fa483b077e727d512877bbbf81d6
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2012-03-19 10:41:34 -06:00
Jordan Crouse
0fdf3a068b msm: kgsl: Find a mem_entry by way of a GPU address and a pagetable base
Given a pagetable base and a GPU address, find the struct kgsl_mem_entry
that matches the object.  Move this functionality out from inside another
function and promote it to top level so it can be used by upcoming
functionality.

Change-Id: Ic0dedbad965530a28c43bac36dda0535dcd1c95b
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2012-03-19 10:41:33 -06:00
Jordan Crouse
0071401911 msm: kgsl: Detach memory objects from a process ahead of destroy time
Previously, memory objects assumed that they remained attached to a
process until they are destroyed. In the past this was mostly true,
but worked by luck because a process could technically map the memory
and then close the file descriptor which would eventually explode. Now we
do the process related cleanup (MMU unmap, fixup statistics) when the
object is released from the process so the process can go away without
affecting the other holders of the mem object refcount.

Change-Id: Ic0dedbadde0db62b5f3eb02716d6bb8f65f2562d
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2012-03-19 10:41:31 -06:00
Jordan Crouse
b409257520 msm: kgsl: Remove some uneeded debug output
Remove a block of code that dumped the ringbuffer contents after they
were extracted.  The dump is no longer needed and the longer we
stick around dumping things to the console with the mutexes locked,
the better the chance that the watchdog will come bite us.

Change-Id: Ic0dedbadd22993f0f1646841f481cdc6713d38e8
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2012-03-19 10:41:30 -06:00
Jordan Crouse
a400d8da2d msm: kgsl: Do not BUG in GPU recovery if a valid context can't be found
Don't BUG() if we can't find a valid context to recover to; just fail and
go into a zombie state. This usually happens after a first hang goes bad
and the system keeps hanging while trying to find its way. The problem with
a BUG() in this case is that the system goes down and we can't recover the
snapshot or other debug information.

Change-Id: Ic0dedbad424067ca67799487ee7a7de48a2f42b0
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2012-03-19 10:41:28 -06:00
Wei Zou
8e6dfcced1 msm: kgsl: Enable ME split timeout reporting
Enable the ME split timeout status registers to provide useful
information for GPU hangs.

Change-Id: If110d49fc41f98ac4066f3f29c666c06b6908e99
Signed-off-by: Wei Zou <wzou@codeaurora.org>
2012-03-19 10:41:27 -06:00
Linux Build Service Account
e32270f7bb Merge "msm: kgsl: Make sure kmemleak tool does not report incorrect mem leak." into msm-3.0 2012-03-15 12:09:48 -07:00
Michael Street
d07226e55d msm: kgsl: Remove DRM specific gpu cache flush
DRM specific gpu cache flushing was causing kernel
crashes (NULL dereferences) and is no longer necessary.

Change-Id: I47d82baa9454a29e7f21b9ac5365921379bfb09d
Signed-off-by: Michael Street <mstreet@codeaurora.org>
2012-03-14 12:42:00 -07:00
Praveena Pachipulusu
263467dc0b msm: Change the permission for pwrnap, policy, modem_wait sys entries
Sysfs files are not world writable. Allowing only
root to write to sysfs files to keep non-privileged
process from change the power policy.

CRs-Fixed: 327239
Change-Id: Ibe44e888c28f854996c8a4391d99fdb7e0edd602
Signed-off-by: Praveena Pachipulusu <pveena@codeaurora.org>
2012-03-14 16:44:58 +05:30
Anshuman Dani
eecd52061a msm: kgsl: Make sure kmemleak tool does not report incorrect mem leak.
Certain memory allocations are not properly tracked by kmemleak tool,
which makes it to incorrectly detect memory leak. Notify the tool by using
kmemleak_not_leak() to ignore the memory allocation so that incorrect leaks
report are avoided.

Change-Id: Id3beea7d99aedc10d9d8d74e5dad384e03abf4f2
CRs-Fixed: 334294
Signed-off-by: Anshuman Dani <adani@codeaurora.org>
2012-03-14 14:35:52 +05:30
Sudhakara Rao Tentu
8ebb228949 msm: kgsl: Add graphics support for msm8930
Allow GPU chipid detection in msm8930,A3xx driver used
in msm8064 and msm8930.

Change-Id: Idf8229d24a59e56ba3eb7d0a52b28599b726072b
Signed-off-by: Sudhakara Rao Tentu <srtentu@codeaurora.org>
2012-03-12 20:14:26 +05:30
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
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
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
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
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