Commit Graph

5163 Commits

Author SHA1 Message Date
Jordan Crouse
662a67c42f msm: kgsl: Fix the A3XX debugbus snapshot code
The code that dumped the A3XX debug bus wasn't using
the right bitshift for debug bus ID resulting in completely
incorrect data in the snapshot output. Set the ID correctly
and the debug data is full and complete.

Change-Id: Ic0dedbad41ec7267517f4fa16de2c5884ae0d82c
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2012-02-08 22:25:35 -07:00
Jordan Crouse
b6ebffe18f msm: kgsl: Enable A3XX GPU hang detection
A3XX GPU hang detection can figure out if the core is
hung and interrupt us if it has.  However, the interrupt
seems to be a little unreliable so that isn't of use to
us, but the hang detection has a beneficial side effect
of spewing lots of useful information to debug registers
that can be used on a hang.  Enable the hang detection but
disable the hang interrupt.

Change-Id: Ic0dedbadc8492d388729c2eea9b9e1bdc8ac1013
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2012-02-08 22:25:35 -07:00
Jordan Crouse
a7ec42196a msm: kgsl: A3XX GMEM save/restore was never executed
GMEM save/restore was never being executed for A3XX due to an
if() statement checking a flag that never gets set.  Remove said
if statement and set the flag so that GMEM save/restore gets run
during a context switch if requested from user space.

Additionally, fix a few minor issues with the gmem save/restore
sequence so when the application requests it, it will actually
work.

Change-Id: Ic0dedbad3f8e86b23bbd26051b771514e6518831
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2012-02-08 22:25:34 -07:00
Jordan Crouse
55d98fd5ce msm: kgsl: Correct the microcode sizes in the GPU snapshot
The stored sizes for the PM4 and PFP microcode in the adreno device
structure were already dword sized, so just store those numbers
directly in the snapshot header.  The stored size include an additional
version dword that isn't actually saved as part of the firmware, so
decrement the stored sizes by one when we read the data back from
the GPU.

Change-Id: Ic0dedbad6d4c5612903c7b6d1b626ccd6246f61c
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2012-02-08 22:25:33 -07:00
Jordan Crouse
c6b3a994e8 msm: kgsl: Update the GMEM and istore size for A320
Set the correct GMEM and istore sizes for A320 on APQ8064.
The more GMEM we have the happier we are, so the code will
work with 256K, but it will be better with 512K.  For the
instruction store the size is important during GPU snapshot
and postmortem dump.  Also, the size of each instruction is
different on A3XX so remove the hard coded constants and
add a GPU specific size variable.

Change-Id: Ic0dedbad01d5a9dc4211a666bc0a065189938841
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2012-02-08 22:25:24 -07:00
Linux Build Service Account
a3bcc20e53 Merge "msm: kgsl: DRM now using new memory interfaces" into msm-3.0 2012-02-08 10:02:50 -08:00
Olav Haugan
1c94f7be2d gpu: ion: Add support for IOMMU in CP heap
ION clients allocating from a content protection
heap (cp heap) must be able to map the memory to
an IOMMU when IOMMU are being used.

Add callbacks to CP heap to support IOMMU mapping.

Change-Id: I5dd70096edcab4866a436ae4447f9a6e00e2f0ec
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2012-02-08 09:49:09 -08:00
Ranjhith Kalisamy
ce75b0c900 msm: kgsl: disable irq when adreno device is stopped
When restoring to slumber from nap, the irq is kept enabled causing a
power drain. This change ensures that adreno device behaves similar to
z180 device.

Change-Id: I7dd9b8f21ae341c978204b6dbb0162d606168b77
CRs-Fixed: 331847
Signed-off-by: Ranjhith Kalisamy <ranjhith@codeaurora.org>
2012-02-06 18:24:06 +05:30
Jordan Crouse
0c2761ae0b msm: kgsl: Add snapshot and postmortem support for A3XX
Modify postmortem and GPU snapshot to dump A3XX debug sections
and registers.

Change-Id: Ic0dedbadb28be76d5ad2dcf214bc88b15dd7342e
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2012-02-04 14:54:26 -07:00
Jordan Crouse
b4d31bd8b0 msm: kgsl: Add support for the A3XX family of GPUs
Add support for the A320, the first of the new generation
of Adreno GPUs.

Change-Id: Ic0dedbadd29fbdff8733cd38824594e757eef42d
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2012-02-04 14:54:26 -07:00
Vijay Krishnamoorthy
bef66933ee msm: kgsl: Add support for the preamble context flag
Userspace will set a flag in the context if preambles are in use. If
they are, we can safely skip save and restore commands for the
context. GMEM save/restore is still required.  To improve performance,
preamble commands are skipped when the context hasn't changed since
the last issueibcmds.

Change-Id: I21bb8996d62651122dbebcf7a79543679109e1f9
Signed-off-by: Vijay Krishnamoorthy <adivarah@codeaurora.org>
2012-02-04 14:54:26 -07:00
Laura Abbott
caafeea7ce gpu: ion: Add ION support for fmem
FMEM allows ION to release memory for other
purposes when ION clients are not using the
memory.

Add new heap type for fmem that make calls
into fmem API to transition memory from T to
C state and vice versa. Add support for
fmem to content protection heap.

Change-Id: I95f949b57c99949e6eafe6a6f5fd147bdaa264f6
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
2012-02-03 15:21:49 -08:00
Ryan Mallon
3fc6b66715 vmwgfx: Fix assignment in vmw_framebuffer_create_handle
commit bf9c05d5b6d19b3e4c9fe21047694e94f48db89b upstream.

The assignment of handle in vmw_framebuffer_create_handle doesn't actually do anything useful and is incorrectly assigning an integer value to a pointer argument. It appears that this is a typo and should be dereferencing handle rather than assigning to it directly. This fixes a bug where an undefined handle value is potentially returned to user-space.

Signed-off-by: Ryan Mallon <rmallon@gmail.com>
Reviewed-by: Jakob Bornecrantz<jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-03 09:19:00 -08:00
Paulo Zanoni
7e2d7afcba drm/i915/sdvo: always set positive sync polarity
commit ba68e086223a5f149f37bf8692c8cdbf1b0ba3ef upstream.

This is a revert of 81a14b4684.

We already set the mode polarity using the SDVO commands with struct
intel_sdvo_dtd. We have at least 3 bugs that get fixed with this patch.
The documentation, despite not clear, can also be interpreted in a way
that suggests this patch is needed.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=15766
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42174
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43333
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-03 09:18:57 -08:00
Thomas Hellstrom
90af660bec drm: Fix authentication kernel crash
commit 598781d71119827b454fd75d46f84755bca6f0c6 upstream.

If the master tries to authenticate a client using drm_authmagic and
that client has already closed its drm file descriptor,
either wilfully or because it was terminated, the
call to drm_authmagic will dereference a stale pointer into kmalloc'ed memory
and corrupt it.

Typically this results in a hard system hang.

This patch fixes that problem by removing any authentication tokens
(struct drm_magic_entry) open for a file descriptor when that file
descriptor is closed.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-03 09:18:52 -08:00
Alex Deucher
c196878589 drm/radeon/kms: Add an MSI quirk for Dell RS690
commit 44517c44496062180a6376cc704b33129441ce60 upstream.

Interrupts only work with MSIs.
https://bugs.freedesktop.org/show_bug.cgi?id=37679

Reported-by: Dmitry Podgorny <pasis.uax@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-03 09:18:51 -08:00
Olav Haugan
2a5404bfd9 gpu: ion: Add check for cached kernel mappings
An ION content protection heap should not allow
cached kernel space mapping for a heap that is
protected. Also, ION should not allow a heap that
has outstanding cached kernel space mappings to
be protected. These checks will ensure that the kernel
doesn't try to access memory that is locked down and
it cannot access.

Change-Id: I1f4a392d94ae8ae59c52978cfd0890e1a13fd39a
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2012-02-03 08:58:45 -08:00
Olav Haugan
ea66e7aa4b gpu: ion: Remove protection of heap on first alloc
ION protects the heap when the first secure allocation
is done while unprotecting when the last secure allocation
is freed. In addition ION provides a separate API for protecting
and unprotecting a heap allowing users to better time the
protection of a heap.

The protection/unprotection done during first allocation and
last free is not needed anymore. Clients need better control
and thus use the separate API.

Remove protection of heap that is occuring when the
first secure allocation is done. Remove unprotecting of
the heap when the last secure allocation is freed.

Change-Id: I80254c3a79399cd4900a389dcb535d843d6dfa80
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2012-02-03 08:58:44 -08:00
Michael Street
8bacdd092d msm: kgsl: DRM now using new memory interfaces
Modified to use memory management API provided by KGSL.  Cleaned up
unused function overrides, and fixed memory leak.

Change-Id: I28c2d5c56b559e0ee5c46d25a2a22d694d3b6b9d
Signed-off-by: Michael Street <mstreet@codeaurora.org>
2012-02-01 00:17:16 -08:00
Linux Build Service Account
d363753309 Merge "gpu: ion: Fix race condition with import" into msm-3.0 2012-01-31 07:05:05 -08:00
Laura Abbott
ec149ff980 gpu: ion: Fix race condition with import
Consider two threads. Thread 1 has an fd linked to an ion buffer
and Thread 2 has a handle to the same buffer. The two came from
the same client

Thread 1                    Thread 2
-----------------------------------------
ion_import_fd
ion_import
mutex_lock(&client->lock)
                            ion_free
                            ion_handle_put
                            ion_handle_destroy
                            mutex_lock(&client->lock) <--- currently locked
ion_handle_lookup
<return reference to same handle>
mutex_unlock(&client->lock)
                            acquire client lock
                            free(handle)

Thread 1 is now holding a reference to an already freed handle.
The issue arises because thread 2 is attempting to destroy the
handle but the handle still exists on the clients list of handles.
This needs to be atomic. Fix this by taking the client lock
around ion_handle_put.

CRs-Fixed: 328348
Change-Id: I3ff5e6c50b5268fd42092bc1f2b99403e5fcd3cd
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
2012-01-30 01:04:11 -07:00
Linux Build Service Account
61c6f4ae01 Merge "msm: kgsl: remove unneeded idle calls from context create" into msm-3.0 2012-01-29 23:55:05 -08:00
Olav Haugan
0fa9b60cc8 gpu: ion: Limit scope of local functions
Several functions that should not be used outside of
the ion.c file does not have static keyword. In
addition two of the functions should not be exported.

Add static keyword to functions that are local to the
translation unit and remove EXPORT_SYMBOL declarations
that are not needed.

Change-Id: Ia1ef54e3670d361c9a6d684f789be2129facb04d
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2012-01-28 17:05:16 -08:00
Jeremy Gebben
2794ab6dfe msm: kgsl: remove unneeded idle calls from context create
These idles were necessary when the context switch code
preserved PM_OVERRIDE registers. That was removed some time
ago so now the idles are not needed.

CRs-Fixed: 331325
Change-Id: I90d4e1685f213a5720bf6da4e6d4a187d1eb0689
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
2012-01-27 08:25:56 -07:00
Linux Build Service Account
ad4b25a942 Merge "gpu: ion: Add EXPORT_SYMBOL to functions" into msm-3.0 2012-01-26 16:02:11 -08:00
Jordan Crouse
e0ea762600 msm: kgsl: Add a constant for adreno_ringbuffer_issuecmds flags
Use a #define constant instead of a bare constant for the flags
parameter of adreno_ringbuffer_issuecmds.

Change-Id: Ic0dedbadecabe396a51201859a444e68ba64c53d
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2012-01-26 10:38:54 -07:00
Jordan Crouse
156cfbc7c3 msm: kgsl: Add GPU snapshot support
Add support for snapshotting the state of the GPU in a binary format. The
snapshot can be pulled from sysfs and parsed off-target.  The advantage is
that far more information can be encapsulated in a snapshot then can be
printed on the console during a hang.  Snapshots are automatically created
during a hang, or can be manually triggered by writing 'trigger'
in /sys/class/kgsl/kgsl-<n>/snapshot where n is either the 2D or 3D device.
Snapshot data can be pulled from 'dump' in the same directory.

Change-Id: Ic0dedbad1c8473b3b109582b95a8771b0d341f05
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2012-01-26 10:38:53 -07:00
Olav Haugan
bd2b6925de gpu: ion: Add EXPORT_SYMBOL to functions
Several functions in the ion interface is missing
EXPORT_SYMBOL. This is needed to allow clients to
use these functions from kernel modules.

Add EXPORT_SYMBOL to functions that are supposed
to be exposed.

Change-Id: Ieb2810d85205a7492b8fe28536fb20ea090e830f
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2012-01-26 09:18:18 -08:00
Michel Dänzer
be2ef85142 radeon: Fix disabling PCI bus mastering on big endian hosts.
commit 3df96909b75835d487a9178761622b0cbd7310d4 upstream.

It would previously write basically random bits to PCI configuration space...
Not very surprising that the GPU tended to stop responding completely. The
resulting MCE even froze the whole machine sometimes.

Now resetting the GPU after a lockup has at least a fighting chance of
succeeding.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2012-01-25 17:24:35 -08:00
Alex Deucher
a674b8b3e3 drm/radeon/kms: disable writeback on pre-R300 asics
commit 28eebb703e28bc455ba704adb1026f76649b768c upstream.

We often end up missing fences on older asics with
writeback enabled which leads to delays in the userspace
accel code, so just disable it by default on those asics.

Reported-by: Helge Deller <deller@gmx.de>
Reported-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2012-01-25 17:24:35 -08:00
Rafał Miłecki
b48620dfff drm/radeon/kms: workaround invalid AVI infoframe checksum issue
commit 92db7f6c860b8190571a9dc1fcbc16d003422fe8 upstream.

This change was verified to fix both issues with no video I've
investigated. I've also checked checksum calculation with fglrx on:
RV620, HD54xx, HD5450, HD6310, HD6320.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2012-01-25 17:24:35 -08:00
Olav Haugan
6625c7d1f8 gpu: ion: Replace strncpy with strlcpy
strncpy is unsafe because it does not guarantee
that the resultant string is NULL-terminated.

Replace strncpy with strlcpy and remove explicit
NULL-termination. Also correct allocation of
string buffer.

Change-Id: Id5075ef7b04f80e2bf828f52def329b926e9ec3f
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2012-01-24 14:26:04 -08:00
Anoop Kumar Yerukala
03ba25fa5b Revert "msm: kgsl: only queue work when requested state is none"
This reverts a87d51a96c
Patch causes increase in power consumption while playing a video.

CRs-fixed: 331854
Change-Id: Ic21f109ac730167539a78647d51a8051d5c9948f
Signed-off-by: Anoop Kumar Yerukala <ayeruk@codeaurora.org>
2012-01-24 12:14:47 +05:30
Jeff Boody
28afec421e msm: kgsl: convert sg allocation to vmalloc
kmalloc allocates physically contiguous memory and
may fail for larger allocations due to fragmentation.
The large allocations are caused by the fact that the
scatterlist structure is 24 bytes and the array size
is proportional to the number of pages being mapped.

CRs-fixed: 327066
Change-Id: Ic7d15ca0399aa5c1fa01b7892cff736b3d1e4236
Signed-off-by: Jeff Boody <jboody@codeaurora.org>
2012-01-21 22:13:39 -07:00
Linux Build Service Account
d24aaeed10 Merge changes I3454e773,I1e01dc35 into msm-3.0
* changes:
  msm: kgsl: Make sure SLUMBER is the requested state
  msm: kgsl: Clarify the circumstances to enable SLUMBER state
2012-01-21 17:36:55 -08:00
Linux Build Service Account
96dd983b52 Merge "gpu: ion: Increment the ref count in mmap" into msm-3.0 2012-01-20 08:40:30 -08:00
Lucille Sylvester
344e46286b msm: kgsl: Make sure SLUMBER is the requested state
The stop_work function releases the device mutex to flush
the workqueue.  The requested state may change while the
mutex is held by a different thread.  So set the requested
state after stop_work.

Change-Id: I3454e773fd670722ea5776d2c8d960190da24006
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
2012-01-19 14:49:55 -07:00
Lucille Sylvester
a985adf60e msm: kgsl: Clarify the circumstances to enable SLUMBER state
Use the restore_slumber variable at as low a level as possible
to remove confusion from the state machine.  Also do not let
restore_slumber impact the function of NAP state.

Change-Id: I1e01dc35c19b3568bad1e6ae4b2399d309147cbd
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
2012-01-19 14:49:55 -07:00
Lucille Sylvester
8b803e9753 msm: kgsl: Be explicit about what states may access hw
If the core is in SUSPEND or INIT hw access should not be allowed.

Change-Id: I635a68044dc66be643eb73844b0a5a8b43f31b6c
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
2012-01-19 14:49:54 -07:00
Laura Abbott
e8bc7aaf98 gpu: ion: Increment the ref count in mmap
The refcount increment actually needs to happen in mmap.
Otherwise it doesn't actually happen.

Change-Id: I1043453c2c828b8658a28acea57181759b2b21f0
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
2012-01-19 11:06:59 -08:00
Linux Build Service Account
1ed4548689 Merge changes I31aa21c0,I9550c900 into msm-3.0
* changes:
  msm: 7x27a: Enable idle stats device for 7x27A
  msm: Config option to enable idle stats device
2012-01-19 01:54:26 -08:00
Olav Haugan
3d4fe1ac86 gpu: ion: Refactor debugfs printing
Printing to debugfs is done from a centralized location for
all the heaps managed by ion. This architecture is not
sustainable in the long run since different heaps have different
requirements for what should be printed.

Refactor the debugfs printing for ion so that each heap is
responsible for printing its information.

Change-Id: I1dbe13432a4ab07f27ea4756c3be7fa01ad1df92
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2012-01-18 16:41:56 -08:00
Olav Haugan
35e2f2f14b gpu: ion: Add error message when allocation fails
Add error message when allocation from ion fails.

Change-Id: If2efa95c563c9f076b85958a70ea66afa3983325
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2012-01-18 16:41:47 -08:00
Olav Haugan
63e5f3bc5a gpu: ion: Fix ion client name allocation
The ion client name used for debugging were being
allocated on the stack for user space clients. This
causes the name to be garbled when later printed.

Instead, allocate the name from the heap.

Change-Id: Id299d224192f127197bef2eeb22d881b3a31795c
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2012-01-18 16:41:26 -08:00
Olav Haugan
cb9ad9ead5 gpu: ion: Add decrement of mapping count
Add decrement of mapping count when mapping fails
and corresponding SMI release region call.

Change-Id: I81fb7eeee9973c770a65f02236c5358ce313e3a0
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2012-01-18 16:41:15 -08:00
Olav Haugan
9b2d1c2f8c gpu: ion: Clean up logging messages
Remove duplicate logging message for failure to create
a heap. Add logging message with name, base address, and
size of each heap created.

Change-Id: Id3a3706d914ffa72b0ecd84eb98785a678ceda9a
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2012-01-18 16:41:04 -08:00
Olav Haugan
41cf3e3363 gpu: ion: Fix SCM call message size
The SCM call message size used to protect and
unprotect memory is incorrect. The interface expects
13 bytes but 16 bytes is sent due to padding of the
message struct.

Pack the message structure to force the size of the
structure to 13 bytes.

Change-Id: Iecb7b40aa7e94454620c19cd70c3106392d2d311
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2012-01-18 16:40:53 -08:00
Olav Haugan
42ebe71efc gpu: ion: Add support for adjacent heaps
ION has to guarantee that two of the heaps are
adjacent to each other. This is due to a limitation
in the hardware. Add code to ensure these heaps
are adjacent.

Change-Id: Icc18437a50e1d872112468d02b61ab47fd70acc9
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2012-01-18 16:40:39 -08:00
Lynus Vaz
dde09ee24d msm: Config option to enable idle stats device
MSM_SLEEP_STATS_DEVICE option is used to compile idle stats device
framework which is needed for GPU DCVS feature.

Change-Id: I9550c90054587aa4fcec40131761eeaf54da8a03
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
2012-01-18 10:46:01 +05:30
Olav Haugan
0703dbf608 gpu: ion: Refactor platform data
Refactor platform data to allow for better
expansion in the future. Add void * for
elements unique to each heap type.

Change-Id: I435679819c67ce917b5798009eff7e71047fd2ea
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2012-01-15 09:30:35 -08:00