Commit Graph

5163 Commits

Author SHA1 Message Date
Olav Haugan
b06ee07711 gpu: ion: Change ION_IOC_ALLOC ioctl return value
ION_IOC_ALLOC may incorrectly return an error pointer
which could be 0 when an allocation fails. The ioctl call from user
space expects that the function succeeded when ioctl returns 0.
Change ION_IOC_ALLOC return value to -ENOMEM when the requested
buffer could not be allocated.

Change-Id: Id9d49ffa0eb8af5defc9635f40b45351b9dd8999
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2012-01-15 09:30:31 -08:00
Olav Haugan
e1f5d838d1 gpu: ion: Add more debug info
Add more debug information to ion_debug_heap_show:
-Get number of allocations from heap
-Get number of user space mappings.
-Get number of kernel space mappings.
-Get indicator whether heaps has been secured or not.

Change-Id: I05491b3dd8caccfc3bbe5a9e55642e5e2cd431c4
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2012-01-15 09:30:28 -08:00
Olav Haugan
5e56021d35 gpu: ion: Add missing iommu heap destroy call
When a heap is destroyed a heap type specific
function is called to release memory that the heap
structures used. A case statement handling destroying
the iommu heap is missing. Add missing case statement.

Change-Id: I1aa54209a55db06becc570f65ecf0f740d2e9545
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2012-01-15 09:30:25 -08:00
Olav Haugan
0a85251cd8 gpu: ion: Add support for secure buffers
Secure buffers provides a way to allow premium encrypted
multimedia content to be decrypted in a secured
memory area that does not allow for interception of the
decrypted content.

Add support for heap type that allow heap to be
used for content protection. Introduce new content
protection heap type and id's.

Change-Id: Idd56aa8805b5b74d1b9ab3fe8964aacc218668c1
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2012-01-14 22:18:45 -07:00
Linux Build Service Account
03fe608ffd Merge changes I65145ca9,I1253dd3c,I19bcd192 into msm-3.0
* changes:
  msm: kgsl: only poke once during adreno_idle
  msm: kgsl: Modify only the pending idle timer in ISR.
  msm: kgsl: flush device workqueue before stop
2012-01-13 23:31:53 -08:00
Jeremy Gebben
f859454612 msm: kgsl: only poke once during adreno_idle
The RBBM_STATUS loop is extremely tight and calling
adreno_poke() each time through this loop appears
to cause watchdog bites on 8960.

CRs-Fixed: 324507
Change-Id: I65145ca96f63280179d76abd5320fd201beeeaa7
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
2012-01-13 13:06:28 -07:00
Tarun Karra
68755766cb msm: kgsl: Modify only the pending idle timer in ISR.
mod_timer reactivates the timer even when timer is deleted using
del_timer_sync. In the ISR we should be modifying only the pending
timer. We deleted the timer using del_timer_sync, if the interrupts
are still enabled, we could be re-enabling the timer in the ISR.

There is a code path in kgsl_suspend device where we delete the timer
but disable IRQ later.This code path seems to be fixed with another
commit.

Change-Id: I1253dd3c774427e725d302d9ba13d87fad10c463
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
2012-01-13 10:41:38 -07:00
Tarun Karra
f8e5cd2af7 msm: kgsl: flush device workqueue before stop
Make sure the irq is off, the idle timer is
stopped and the workqueue is flushed before
stopping the device for early suspend, suspend,
last release or hang recovery. There is one case
where the workqueue cannot be flushed, which is from
kgsl_pwrctrl_sleep() when going into SLUMBER
state. This codepath can be called from the
workqueue itself so flushing would deadlock.

Change-Id: I19bcd192845401ac0d94aa60a9252970b634c1ea
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
2012-01-13 10:41:16 -07:00
Lynus Vaz
bdb0c07e65 msm: IDLE_TIMER wakes up waiting processes
The msm_idle_stats_update_event() function is now a public function.
In case of IDLE_TIMER expiry, kgsl calls this function to immediately
wake up waiting processes.

Change-Id: Ia259d10e08deea71db047d8091cc97066fba3c1c
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
2012-01-13 09:03:46 +05:30
Linux Build Service Account
12ba53ace5 Merge "msm: kgsl: Collect a sample only if GPU is active" into msm-3.0 2012-01-12 09:56:54 -08:00
Lynus Vaz
b6f2863e12 msm: kgsl: Collect a sample only if GPU is active
If the device is not in active state, collecting a sample is not
necessary and will cause frequent wake-ups, resulting in higher power
consumption.

Change-Id: Icb4f82b1300cab3b4cc4ed17117a92725a5a11d4
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
2012-01-12 18:47:28 +05:30
Jeremy Gebben
a87d51a96c msm: kgsl: only queue work when requested state is none
If another state has been requested, there is no reason
to queue work.

Change-Id: Ifa8d57e523a047bd2021c00732c2fe6a67bd6790
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
2012-01-11 12:47:05 -07:00
Jeremy Gebben
b7bc955c00 msm: kgsl: call device->irqctrl from start/stop
These functions write registers and so if they are called
from kgsl_pwrctrl_irq() there is a chance that they
might be called when clocks are disabled.

Change-Id: I259d840d9996d424aba3e3481201d49f602637e8
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
2012-01-11 12:46:48 -07:00
Olav Haugan
7fba5cf795 gpu: ion: Add missing gen_pool_destroy call
If the carveout heap fails to be created the pool needs to
be destroyed.

Change-Id: I73f768d79a11aacd2161b079db9621264d14d2ad
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2012-01-10 16:45:32 -08:00
Lynus Vaz
3f05022a4b msm: kgsl: Power scale policy needs at least three power levels.
Since 7x25A supports two power levels, do not allow it to register
with the power scale policy.

Change-Id: I1a77f0aa8e7affa126d7c18cb2d73e8617602dcf
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
2012-01-10 11:49:31 +05:30
Linux Build Service Account
24666ed66a Merge "msm: kgsl: Don't wake core to check if it is idle." into msm-3.0 2012-01-09 10:12:40 -08:00
Alexander Müller
e343400d67 drm/radeon/kms/atom: fix possible segfault in pm setup
commit 4376eee92e5a8332b470040e672ea99cd44c826a upstream.

If we end up with no power states, don't look up
current vddc.

fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=44130

agd5f: fix patch formatting

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-06 14:14:12 -08:00
Alex Deucher
6f4214ef6a drm/radeon/kms: bail on BTC parts if MC ucode is missing
commit 77e00f2ea94abee1ad13bdfde19cf7aa25992b0e upstream.

We already do this for cayman, need to also do it for
BTC parts.  The default memory and voltage setup is not
adequate for advanced operation.  Continuing will
result in an unusable display.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2012-01-06 14:14:00 -08:00
Eugeni Dodonov
183647b865 drm/i915: prevent division by zero when asking for chipset power
commit 4ed0b577457eb6aeb7cdc7e7316576e63d15abb2 upstream.

This prevents an in-kernel division by zero which happens when we are
asking for i915_chipset_val too quickly, or within a race condition
between the power monitoring thread and userspace accesses via debugfs.

The issue can be reproduced easily via the following command:
while ``; do cat /sys/kernel/debug/dri/0/i915_emon_status; done

This is particularly dangerous because it can be triggered by
a non-privileged user by just reading the debugfs entry.

This issue was also found independently by Konstantin Belousov
<kostikbel@gmail.com>, who proposed a similar patch.

Reported-by: Konstantin Belousov <kostikbel@gmail.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Acked-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2012-01-06 14:13:45 -08:00
Lucille Sylvester
51b764d6fd msm: kgsl: Don't wake core to check if it is idle.
Scenarios which check for idle and inadvertently turn
on the core when it was off happen fairly frequently.
Fixing this at the root rather than continuing to work
around each one.

Change-Id: Ibddd40bf69352733c8d4779272aa08757981d494
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
2012-01-03 15:48:02 -07:00
Jordan Crouse
f7597bf28d msm: kgsl: Move the GPU register lists to a common location
Move the GPU register lists to a common location so they can be used
by multiple sub-systems.  To avoid confusion, convert the lists from
byte offsets to dword offsets to match how we do register offsets
throughout the entire driver and in user space.

Change-Id: Ic0dedbad0f320242b77231a444939f9c6d852976
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2012-01-03 10:51:58 -07:00
Olav Haugan
ee0f780d78 board: 8660: Add callbacks to request_region
Callbacks to request_region, release_region,
setup_region is missing from ION platform data for
SMI heap.

Change-Id: Ida603d4ac7c3246c0deedb9b80dc0c1ea64638eb
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
2011-12-21 16:32:08 -08:00
Linux Build Service Account
97de8ee2c9 Merge "msm: kgsl: add power tracepoints" into msm-3.0 2011-12-20 20:10:09 -08:00
Lucille Sylvester
5b3a942f2f msm: kgsl: Do not ramp to turbo if the screen is off.
Change-Id: I1f6e7a829352c0c5c8f31132bc22ad95ed737e28
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
2011-12-20 18:11:28 -07:00
Jeremy Gebben
b50f33135c msm: kgsl: add power tracepoints
Add kgsl_clk, kgsl_bus, kgsl_irq, kgsl_rail, kgsl_pwrlevel,
kgsl_pwr_set_state and kgsl_pwr_request_state trace
events.

Change-Id: I3bf246f350b1208123ab9a33c08495cea9c533eb
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
2011-12-20 09:06:56 -07:00
Jeremy Gebben
388c297b8b msm: kgsl: power state cleanup
Clean up kgsl_pwrctrl_sleep() and kgsl_pwrctrl_wake() to make
state transistions clearer.  Add kgsl_pwrctrl_request_state()
and kgsl_pwrctrl_set_state() to make it easier to debug the
state machine.

CRs-Fixed: 315833
Change-Id: I656ce8bd19feabd4186ef91dc031f8a6c6a7d09a
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
2011-12-20 09:06:55 -07:00
Linux Build Service Account
183a947581 Merge "msm: kgsl: Add supporting code for 2d dcvs" into msm-3.0 2011-12-19 18:28:24 -08:00
Lucille Sylvester
808eca2d91 msm: kgsl: Add supporting code for 2d dcvs
2d dcvs will also need changes in TrustZone.  However
by adding this code first the TrustZone update can be
made later without breaking any functionality.  This
feature is disabled by default and should not be
enabled without the necessary TrustZone changes in
place.

Change-Id: Ifdd511a3f18ba90faee189393ffc231fbbc6e2cd
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
2011-12-16 18:34:50 -07:00
Linux Build Service Account
1122dbaea8 Merge changes I9b6533ac,Ia49a819d,I19f2fe7a into msm-3.0
* changes:
  msm: kgsl: in postmortem, log powerstate before changing it
  msm: kgsl: adreno_isidle shouldn't BUG()
  msm: kgsl: fix infinite loop in adreno_find_region()
2011-12-16 10:23:26 -08:00
Linux Build Service Account
8b8fbac794 Merge "msm: kgsl: Allow device attributes to be re-created" into msm-3.0 2011-12-16 10:23:26 -08:00
Lucille Sylvester
43deede066 msm: kgsl: Eventually transition to SLUMBER
Even if a core is ACTIVE during an early_suspend call make
sure it switches off eventually with lack of use.

Change-Id: I476e8a14a0d7e90a8ed8b8c05d0cf5ed88632cad
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
2011-12-15 16:37:25 -07:00
Jeremy Gebben
a4d97ee181 msm: kgsl: in postmortem, log powerstate before changing it
Change-Id: I9b6533acbe99c5094d51ac4fb12a23a280cc07c7
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
2011-12-15 10:16:04 -07:00
Jeremy Gebben
aeb23871d8 msm: kgsl: adreno_isidle shouldn't BUG()
If the ringbuffer isn't idle, the GPU is probably in
SLUMBER or SUSPEND which are very idle states. This
function probably still shouldn't be called, so WARN
instead.

Change-Id: Ia49a819d935d6dce9cae2c193aff8e9de87d8af6
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
2011-12-15 10:16:03 -07:00
Jeremy Gebben
775d48b639 msm: kgsl: fix infinite loop in adreno_find_region()
If postmortem dump tried to parse a context switch
buffer for any context except the current context
this function would never return.

Change-Id: I19f2fe7afda5796180cdf5f81c17fad960e84f05
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
2011-12-15 10:16:03 -07:00
Lucille Sylvester
e683db4d38 msm: kgsl: Allow device attributes to be re-created
Leave the attributes initialized so that removing and
restoring policies doesn't result in a kernel panic.

Change-Id: I9724ebf94e3845b6cbaea18abf49d1813043eb52
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
2011-12-14 13:52:48 -07:00
Linux Build Service Account
15aabfaa27 Merge "msm: kgsl: Allow userspace processes to turn off/on power features." into msm-3.0 2011-12-13 10:54:07 -08:00
Linux Build Service Account
0f3f02683c Merge "gpu: ion: Take handle reference in ion_vma_open" into msm-3.0 2011-12-11 19:19:37 -08:00
Laura Abbott
0f2175b51f gpu: ion: Take handle reference in ion_vma_open
When ion_vma_open is called, a reference to the handle in
the vma must be taken. Otherwise, if forking occurs,
ion_vma_close will be called twice which will leave one of
the calls with an invalid reference.

Change-Id: I9ab6e68ab6b1d2ac4bed4f45045b4b2ee39995e8
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
2011-12-09 14:26:07 -08:00
Alex Deucher
6a82412403 drm/radeon/kms: add some loop timeouts in pageflip code
commit f64964796dedca340608fb1075ab6baad5625851 upstream.

Avoid infinite loops waiting for surface updates if a GPU
reset happens while waiting for a page flip.

See:
https://bugs.freedesktop.org/show_bug.cgi?id=43191

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Tested-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-09 08:52:38 -08:00
Alex Deucher
ff17063daf drm/radeon/kms: fix up gpio i2c mask bits for r4xx
commit 6c47e5c23aa2a7c54ad7ac13af4bd56cd9e703bf upstream.

Fixes i2c test failures when i2c_algo_bit.bit_test=1.

The hw doesn't actually require a mask, so just set it
to the default mask bits for r1xx-r4xx radeon ddc.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-09 08:52:23 -08:00
Jesse Barnes
ed3035ddf8 drm/i915: fix CB tuning check for ILK+
commit cb0e093162d7b6589c2217a00e2abfef686b32d6 upstream.

CB tuning is needed to handle potential process variations that might
cause clock jitter for certain PLL settings.  However, we were setting
it incorrectly since we were using the wrong M value as a check (M1 when
we needed to use the whole M value).  Fix it up, making my HDMI
attached display a little prettier (used to have occasional dots crawl
across the display).

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Timo Aaltonen <timo@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-09 08:52:22 -08:00
Ben Skeggs
8215014c1d drm/ttm: request zeroed system memory pages for new TT buffer objects
commit ff02b13f6867af72682d7a9bb9bd705f9af2bab0 upstream.

Fixes an information leak to userspace, we were handing out un-zeroed pages
for any newly created TTM_PL_TT buffer.

Reported-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-09 08:52:22 -08:00
Eric Anholt
6d7f52a7e6 drm/i915: Turn on another required clock gating bit on gen6.
commit 9ca1d10d748e56964de95e3ed80211b192f56cf4 upstream.

Unlike the previous one, I don't have known testcases it fixes.  I'd
rather not go through the same debug cycle on whatever testcases those
might be.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-09 08:52:22 -08:00
Eric Anholt
d37e377384 drm/i915: Turn on a required 3D clock gating bit on Sandybridge.
commit 406478dc911e16677fbd9c84d1d50cdffbc031ab upstream.

Fixes rendering failures in Unigine Tropics and Sanctuary and the mesa
"fire" demo.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-09 08:52:21 -08:00
Daniel Vetter
a00931691a drm/i915: Ivybridge still has fences!
commit 775d17b6ca4357048f36c22151335addfe15db4b upstream.

So don't forget to restore them on resume and dump them into
the error state.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-09 08:52:21 -08:00
Alex Deucher
1b0f670a0a drm/radeon/kms: fix up gpio i2c mask bits for r4xx for real
commit d724502a9d7a46f4a56a1663b1f50d2dc9d1ef40 upstream.

Fixes i2c test failures when i2c_algo_bit.bit_test=1.

The hw doesn't actually require a mask, so just set it
to the default mask bits for r1xx-r4xx radeon ddc.

I missed this part the first time through.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-09 08:52:21 -08:00
Xi Wang
61aff74833 drm: integer overflow in drm_mode_dirtyfb_ioctl()
commit a5cd335165e31db9dbab636fd29895d41da55dd2 upstream.

There is a potential integer overflow in drm_mode_dirtyfb_ioctl()
if userspace passes in a large num_clips.  The call to kmalloc would
allocate a small buffer, and the call to fb->funcs->dirty may result
in a memory corruption.

Reported-by: Haogang Chen <haogangchen@gmail.com>
Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-09 08:52:20 -08:00
Jordan Crouse
f587fe56c8 msm: kgsl: Move a #define to a centralized header
ADRENO_ISTORE_START is valuable information for
a number of functions, so move it from within
adreno_debugfs.c to adreno.h.

Change-Id: Ic0dedbad41445fad2130b7cb28d706283f59b4c2
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2011-12-09 08:35:55 -07:00
Jordan Crouse
a0758f20cd msm: kgsl: Establish a standard GPU ID scheme for the KGSL core
Establish a standard generic format for a GPU ID in the KGSL core:

[0:15] - GPU specific identifier
[16:31] - 0x0002 for 2D or 0x0003 for 3D

Add a KGSL core function to get the GPU ID from the devices and
GPU specific functions to return them.  For Z180, the ID will be
0x0002000B4 (0xB4 = 180).  For 3D, the ID will be 0x00030000 ORed
with the GPU identifier (anywhere from 205 to 225).

Change-Id: Ic0dedbadddb3f587121913b9c226e2bda466f84e
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2011-12-09 08:35:54 -07:00
Jordan Crouse
520640622d msm: kgsl: Make sure the local directory is put in the CFLAGS
Some compilers struggle to find local includes that are referenced from
external headers.  Add the driver path to ccflags-y.

Change-Id: Ic0dedbad2744e7350b19b97dc0b84cd49c070b95
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2011-12-09 08:35:53 -07:00