openwrt/staging/blogic.git
13 years agodrm/nouveau: remove dummy page use from PCI(E)GART, use PTE present instead
Ben Skeggs [Mon, 15 Nov 2010 02:54:57 +0000 (12:54 +1000)]
drm/nouveau: remove dummy page use from PCI(E)GART, use PTE present instead

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50: fix 0x100c90 init for NVAF
Ben Skeggs [Mon, 15 Nov 2010 02:52:23 +0000 (12:52 +1000)]
drm/nv50: fix 0x100c90 init for NVAF

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50: allocate page for unknown PFB object in nv50_fb.c
Ben Skeggs [Mon, 15 Nov 2010 02:50:50 +0000 (12:50 +1000)]
drm/nv50: allocate page for unknown PFB object in nv50_fb.c

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: rework gpu-specific instmem interfaces
Ben Skeggs [Mon, 1 Nov 2010 01:45:02 +0000 (11:45 +1000)]
drm/nouveau: rework gpu-specific instmem interfaces

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: simplify gpuobj suspend/resume
Ben Skeggs [Mon, 25 Oct 2010 05:23:59 +0000 (15:23 +1000)]
drm/nouveau: simplify gpuobj suspend/resume

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50: rework PGPIO IRQ handling and hotplug detection
Ben Skeggs [Thu, 11 Nov 2010 06:14:56 +0000 (16:14 +1000)]
drm/nv50: rework PGPIO IRQ handling and hotplug detection

Allows callers to install their own handlers for when a GPIO line
changes state (such as for hotplug detect).

This also fixes a bug where we weren't acknowledging the GPIO IRQ
until after the bottom half had run, causing a severe IRQ storm
in some cases.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv04-nv40: unregister irq handler on destroy
Ben Skeggs [Thu, 11 Nov 2010 03:59:05 +0000 (13:59 +1000)]
drm/nv04-nv40: unregister irq handler on destroy

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: tidy+move PGRAPH ISRs to their respective *_graph.c files
Ben Skeggs [Wed, 3 Nov 2010 03:16:18 +0000 (13:16 +1000)]
drm/nouveau: tidy+move PGRAPH ISRs to their respective *_graph.c files

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: move PFIFO ISR into nv04_fifo.c
Ben Skeggs [Wed, 3 Nov 2010 00:56:05 +0000 (10:56 +1000)]
drm/nouveau: move PFIFO ISR into nv04_fifo.c

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv04-nv40: register vblank isr
Ben Skeggs [Wed, 3 Nov 2010 01:36:09 +0000 (11:36 +1000)]
drm/nv04-nv40: register vblank isr

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: move bitfield/enum helpers to nouveau_util.c
Ben Skeggs [Wed, 3 Nov 2010 00:45:48 +0000 (10:45 +1000)]
drm/nouveau: move bitfield/enum helpers to nouveau_util.c

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50: use register/unregister functionality for PDISPLAY ISR
Ben Skeggs [Wed, 3 Nov 2010 00:27:27 +0000 (10:27 +1000)]
drm/nv50: use register/unregister functionality for PDISPLAY ISR

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50: move GPIO ISR to nv50_gpio.c
Ben Skeggs [Wed, 3 Nov 2010 00:18:04 +0000 (10:18 +1000)]
drm/nv50: move GPIO ISR to nv50_gpio.c

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv84: move PCRYPT ISR out of nouveau_irq.c
Ben Skeggs [Wed, 3 Nov 2010 00:06:43 +0000 (10:06 +1000)]
drm/nv84: move PCRYPT ISR out of nouveau_irq.c

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: allow irq handlers to be installed by engine-specific code
Ben Skeggs [Tue, 2 Nov 2010 23:57:28 +0000 (09:57 +1000)]
drm/nouveau: allow irq handlers to be installed by engine-specific code

Lets start to clean up this mess!

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50: 0x50c0 apparently works on NVA3+ too, so lets allow it
Ben Skeggs [Thu, 4 Nov 2010 23:40:00 +0000 (09:40 +1000)]
drm/nv50: 0x50c0 apparently works on NVA3+ too, so lets allow it

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50: fix compute object class
Ben Skeggs [Thu, 4 Nov 2010 03:40:15 +0000 (13:40 +1000)]
drm/nv50: fix compute object class

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: Fix sleep while atomic in nouveau_bo_fence().
Francisco Jerez [Thu, 28 Oct 2010 21:10:29 +0000 (23:10 +0200)]
drm/nouveau: Fix sleep while atomic in nouveau_bo_fence().

Reported-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv20: Add Z compression support.
Francisco Jerez [Sun, 24 Oct 2010 14:36:12 +0000 (16:36 +0200)]
drm/nv20: Add Z compression support.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Tested-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: Rework tile region handling.
Francisco Jerez [Sun, 24 Oct 2010 14:14:41 +0000 (16:14 +0200)]
drm/nouveau: Rework tile region handling.

The point is to share more code between the PFB/PGRAPH tile region
hooks, and give the hardware specific functions a chance to allocate
per-region resources.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: Add a separate class for the kernel channel mutex.
Francisco Jerez [Mon, 25 Oct 2010 21:38:59 +0000 (23:38 +0200)]
drm/nouveau: Add a separate class for the kernel channel mutex.

nouveau_bo_move_m2mf() needs to lock the kernel channel, and it may be
called from the pushbuf IOCTL with an user channel already locked. Use
a separate subclass for the kernel channel mutex because this is
legitimate mutex nesting.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50: Keep track of the head a channel is vsync'ing to.
Francisco Jerez [Sun, 24 Oct 2010 12:15:58 +0000 (14:15 +0200)]
drm/nv50: Keep track of the head a channel is vsync'ing to.

In a multihead setup vblank interrupts may end up enabled in both
heads. In that case we want to ignore the vblank interrupts coming
from the wrong CRTC to avoid tearing and unbalanced calls to
drm_vblank_get/put (fdo bug 31074).

Reported-by: Felix Leimbach <felix.leimbach@gmx.net>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: Call drm_vblank_pre/post_modeset() around mode setting.
Francisco Jerez [Mon, 25 Oct 2010 01:30:34 +0000 (03:30 +0200)]
drm/nouveau: Call drm_vblank_pre/post_modeset() around mode setting.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: Implement the pageflip ioctl.
Francisco Jerez [Wed, 20 Oct 2010 21:35:40 +0000 (23:35 +0200)]
drm/nouveau: Implement the pageflip ioctl.

nv0x-nv4x should be mostly fine, nv50 doesn't work yet.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: Implement the vblank DRM hooks.
Francisco Jerez [Thu, 21 Oct 2010 16:19:29 +0000 (18:19 +0200)]
drm/nouveau: Implement the vblank DRM hooks.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv04: Make CRTC base changes effective in the next hsync.
Francisco Jerez [Fri, 22 Oct 2010 02:31:02 +0000 (04:31 +0200)]
drm/nv04: Make CRTC base changes effective in the next hsync.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: fix annoying nouveau_fence type issue
Marcin Slusarz [Wed, 20 Oct 2010 19:50:24 +0000 (21:50 +0200)]
drm/nouveau: fix annoying nouveau_fence type issue

nouveau_fence_* functions are not type safe, which could lead to bugs.
Additionally every use of nouveau_fence_unref had to cast struct
nouveau_fence to void **.
Fix it by renaming old functions and creating static inline functions with
new prototypes. We still need old functions, because we pass function
pointers to ttm.
As we are wrapping functions, drop unused "void *arg" parameter where possible.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50: regression fix, point NVAA/NVAC at correct PM functions
Ben Skeggs [Thu, 21 Oct 2010 22:44:09 +0000 (08:44 +1000)]
drm/nv50: regression fix, point NVAA/NVAC at correct PM functions

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: add support for MSI
Ben Skeggs [Thu, 21 Oct 2010 04:07:03 +0000 (14:07 +1000)]
drm/nouveau: add support for MSI

Only supported on NV50+ so far, and disabled by default currently.  The
module parameter "msi=1" will enable it.

There's a kernel bug which will cause this to fail if the module (or the
NVIDIA binary driver) has ever been loaded before loading nouveau with
MSI enabled.  As such, this is only safe to enable if you have nouveau
load on boot, and don't wish to ever reload it.

The workaround is to "echo 0 > /sys/bus/pci/devices/<device>/enable"
until the enable count reads 0.  Then you should be able to load nouveau
with MSI enabled.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv10: fix thinko and let nv17 do 3d again :)
Ben Skeggs [Thu, 21 Oct 2010 01:37:21 +0000 (11:37 +1000)]
drm/nv10: fix thinko and let nv17 do 3d again :)

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50: fix evo instmem alignment
Ben Skeggs [Wed, 20 Oct 2010 05:35:28 +0000 (15:35 +1000)]
drm/nv50: fix evo instmem alignment

Not an issue right now, we're forced to 64k size/alignment by the BO
allocator anyway.  This won't be the case soon.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50: improve evo error handler when more than just channel 0 active
Ben Skeggs [Wed, 20 Oct 2010 04:23:29 +0000 (14:23 +1000)]
drm/nv50: improve evo error handler when more than just channel 0 active

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50: rework evo init to match nvidia more closely
Ben Skeggs [Tue, 19 Oct 2010 08:01:41 +0000 (18:01 +1000)]
drm/nv50: rework evo init to match nvidia more closely

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50: initial work to allow multiple evo channels
Ben Skeggs [Tue, 19 Oct 2010 04:18:06 +0000 (14:18 +1000)]
drm/nv50: initial work to allow multiple evo channels

This doesn't work yet for unknown reasons.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50: move evo handling to nv50_evo.c
Ben Skeggs [Tue, 19 Oct 2010 03:05:51 +0000 (13:05 +1000)]
drm/nv50: move evo handling to nv50_evo.c

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50: clearer separation of the stages of evo init
Ben Skeggs [Tue, 19 Oct 2010 01:14:17 +0000 (11:14 +1000)]
drm/nv50: clearer separation of the stages of evo init

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50: create graph and crypt contexts on demand
Ben Skeggs [Wed, 20 Oct 2010 01:47:09 +0000 (11:47 +1000)]
drm/nv50: create graph and crypt contexts on demand

This really needs cleaning up somehow, and probably investigate what's
needed to do this on earlier generations.  NVIDIA do something similar
there too.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50: remove excessive alignment of graph/crypt contexts
Ben Skeggs [Wed, 20 Oct 2010 01:46:38 +0000 (11:46 +1000)]
drm/nv50: remove excessive alignment of graph/crypt contexts

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv84: add support for the PCRYPT engine
Ben Skeggs [Tue, 19 Oct 2010 10:06:01 +0000 (20:06 +1000)]
drm/nv84: add support for the PCRYPT engine

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: only expose the object classes that are supported by the chipset
Ben Skeggs [Wed, 20 Oct 2010 00:39:35 +0000 (10:39 +1000)]
drm/nouveau: only expose the object classes that are supported by the chipset

We previously added all the available classes for the entire generation,
even though the objects wouldn't work on the hardware.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: use object class structs more extensively
Ben Skeggs [Tue, 19 Oct 2010 09:57:34 +0000 (19:57 +1000)]
drm/nouveau: use object class structs more extensively

The structs themselves, as well as the non-sw object creation function are
probably very misnamed now.  That's a problem for later :)

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: store engine type in gpuobj class structs
Ben Skeggs [Tue, 19 Oct 2010 09:47:06 +0000 (19:47 +1000)]
drm/nouveau: store engine type in gpuobj class structs

We will eventually want to address hw engines other than PGRAPH.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: pass gpuobj alignment request down into backing allocator
Ben Skeggs [Thu, 14 Oct 2010 23:15:26 +0000 (09:15 +1000)]
drm/nouveau: pass gpuobj alignment request down into backing allocator

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv40: Ignore sync-to-vblank active when waiting for idle.
Francisco Jerez [Mon, 18 Oct 2010 14:15:15 +0000 (16:15 +0200)]
drm/nv40: Ignore sync-to-vblank active when waiting for idle.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: Take fence spinlock in nouveau_fence_channel_fini().
Francisco Jerez [Mon, 18 Oct 2010 01:57:19 +0000 (03:57 +0200)]
drm/nouveau: Take fence spinlock in nouveau_fence_channel_fini().

Without it there's a potential race with nouveau_fence_update().

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: Avoid race in the interchannel sync code.
Francisco Jerez [Mon, 18 Oct 2010 01:56:40 +0000 (03:56 +0200)]
drm/nouveau: Avoid race in the interchannel sync code.

It needs a "strong" channel reference because it actually writes to
the channel pushbuf, otherwise the corresponding FIFO context could
get kicked off in the middle of nouveau_fence_sync().

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: Make fences take a weak channel reference.
Francisco Jerez [Mon, 18 Oct 2010 01:56:14 +0000 (03:56 +0200)]
drm/nouveau: Make fences take a weak channel reference.

Fences didn't increment the channel reference count, and the fenced
channel could go away at any time. Fixes a potential race in
nouveau_fence_update().

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: Implement weak channel references.
Francisco Jerez [Mon, 18 Oct 2010 01:55:48 +0000 (03:55 +0200)]
drm/nouveau: Implement weak channel references.

nouveau_channel_ref() takes a "weak" channel reference that doesn't
prevent the hardware channel resources from being released, it just
keeps the channel data structure alive.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: Fix lock unbalance on card take down.
Francisco Jerez [Mon, 18 Oct 2010 01:01:34 +0000 (03:01 +0200)]
drm/nouveau: Fix lock unbalance on card take down.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: Add unlocked variants of nouveau_channel_get/put.
Francisco Jerez [Mon, 18 Oct 2010 00:58:04 +0000 (02:58 +0200)]
drm/nouveau: Add unlocked variants of nouveau_channel_get/put.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: Fix race condition in channel refcount handling.
Francisco Jerez [Mon, 18 Oct 2010 01:54:33 +0000 (03:54 +0200)]
drm/nouveau: Fix race condition in channel refcount handling.

nouveau_channel_put() can be executed after the 'refcount == 0' check
in nouveau_channel_get() and before the channel reference count is
incremented. In that case CPU0 will take the context down while CPU1
thinks it owns the channel and 'refcount == 1'.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: Refactor context destruction to avoid a lock ordering issue.
Francisco Jerez [Mon, 18 Oct 2010 01:53:39 +0000 (03:53 +0200)]
drm/nouveau: Refactor context destruction to avoid a lock ordering issue.

The destroy_context() engine hooks call gpuobj management functions to
release the channel resources, these functions use HARDIRQ-unsafe locks
whereas destroy_context() is called with the HARDIRQ-safe
context_switch_lock held, that's a lock ordering violation.

Push the engine-specific channel destruction logic into destroy_context()
and let the hardware-specific code lock and unlock when it's actually
needed. Change the engine destruction order to avoid a race in the small
gap between pgraph and pfifo context uninitialization.

Reported-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: Use lazy fence waits when doing software interchannel sync.
Francisco Jerez [Thu, 14 Oct 2010 19:55:23 +0000 (21:55 +0200)]
drm/nouveau: Use lazy fence waits when doing software interchannel sync.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: Leave BO eviction synchronization for later.
Francisco Jerez [Thu, 14 Oct 2010 18:37:56 +0000 (20:37 +0200)]
drm/nouveau: Leave BO eviction synchronization for later.

The pushbuf ioctl syncs after validation, no need for this anymore.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50: remove some unnecessary PDISPLAY init
Ben Skeggs [Mon, 18 Oct 2010 02:34:04 +0000 (12:34 +1000)]
drm/nv50: remove some unnecessary PDISPLAY init

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: fallback to sw fbcon if we can't get mutex immediately
Ben Skeggs [Thu, 14 Oct 2010 04:55:23 +0000 (14:55 +1000)]
drm/nouveau: fallback to sw fbcon if we can't get mutex immediately

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: hook up acpi power supply change tracking
Ben Skeggs [Tue, 12 Oct 2010 02:31:32 +0000 (12:31 +1000)]
drm/nouveau: hook up acpi power supply change tracking

Not used at all yet, but lets hook it up now anyway.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: return error from nouveau_ramht_remove() if not found
Ben Skeggs [Tue, 12 Oct 2010 00:11:00 +0000 (10:11 +1000)]
drm/nouveau: return error from nouveau_ramht_remove() if not found

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: use interruptible waits during pushbuf validation
Ben Skeggs [Mon, 11 Oct 2010 23:54:54 +0000 (09:54 +1000)]
drm/nouveau: use interruptible waits during pushbuf validation

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: fix thinko in channel locking in semaphore path
Ben Skeggs [Mon, 11 Oct 2010 22:01:59 +0000 (08:01 +1000)]
drm/nouveau: fix thinko in channel locking in semaphore path

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: remove cpu_writers lock
Ben Skeggs [Mon, 11 Oct 2010 01:48:45 +0000 (11:48 +1000)]
drm/nouveau: remove cpu_writers lock

No other driver uses this, and userspace should be responsible for handling
locking between them if they share BOs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: switch to unlocked ioctls
Ben Skeggs [Wed, 6 Oct 2010 06:20:17 +0000 (16:20 +1000)]
drm/nouveau: switch to unlocked ioctls

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: add more fine-grained locking to channel list + structures
Ben Skeggs [Wed, 6 Oct 2010 06:16:59 +0000 (16:16 +1000)]
drm/nouveau: add more fine-grained locking to channel list + structures

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: add per-channel mutex, use to lock access to drm's channel
Ben Skeggs [Tue, 5 Oct 2010 06:53:48 +0000 (16:53 +1000)]
drm/nouveau: add per-channel mutex, use to lock access to drm's channel

This fixes a race condition between fbcon acceleration and TTM buffer
moves.  To reproduce:

- start X
- switch to vt and "while (true); do dmesg; done"
- switch to another vt and "sleep 2 && cat /path/to/debugfs/dri/0/evict_vram"
- switch back to vt running dmesg

We don't make use of this on any other channel yet, they're currently
protected by drm_global_mutex.  This will change in the near future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: disallow fbcon accel if running in interrupt context
Ben Skeggs [Tue, 5 Oct 2010 06:41:29 +0000 (16:41 +1000)]
drm/nouveau: disallow fbcon accel if running in interrupt context

A future commit will add locking to the DRM's channel, and there's numerous
problems that come up if we allow printk from an interrupt context to be
accelerated.  It seems saner to just disallow it completely.

As a nice side-effect, all the "to accel or not to accel" logic gets moved
out of the chipset-specific code.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: tidy fifo swmthd handler a little
Ben Skeggs [Thu, 23 Sep 2010 01:03:01 +0000 (11:03 +1000)]
drm/nouveau: tidy fifo swmthd handler a little

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agoMerge branch 'drm-radeon-fusion' of ../drm-radeon-next into drm-core-next
Dave Airlie [Fri, 3 Dec 2010 04:01:08 +0000 (14:01 +1000)]
Merge branch 'drm-radeon-fusion' of ../drm-radeon-next into drm-core-next

* 'drm-radeon-fusion' of ../drm-radeon-next:
  drm/radeon/kms: add Ontario APU ucode loading support
  drm/radeon/kms: add Ontario Fusion APU pci ids
  drm/radeon/kms: enable MSIs on fusion APUs
  drm/radeon/kms: add power table parsing support for Ontario fusion APUs
  drm/radeon/kms: refactor atombios power state fetching
  drm/radeon/kms: add bo blit support for Ontario fusion APUs
  drm/radeon/kms: add thermal sensor support for fusion APUs
  drm/radeon/kms: fill in GPU init for AMD Ontario Fusion APUs
  drm/radeon/kms: add radeon_asic struct for AMD Ontario fusion APUs
  drm/radeon/kms: evergreen.c updates for fusion
  drm/radeon/kms: MC setup changes for fusion APUs
  drm/radeon/kms: move r7xx/evergreen to its own vram_gtt setup function
  drm/radeon/kms: add support for ss overrides on Fusion APUs
  drm/radeon/kms: Add support for external encoders on fusion APUs
  drm/radeon/kms: atom changes for DCE4.1 devices
  drm/radeon/kms: add new family id for AMD Ontario APUs
  drm/radeon/kms: upstream power table updates
  drm/radeon/kms: upstream atombios.h updates
  drm/radeon/kms: upstream ObjectID.h updates
  drm/radeon/kms: setup mc chremap properly on r7xx/evergreen

13 years agoMerge branch 'drm-radeon-next' of ../drm-radeon-next into drm-core-next
Dave Airlie [Fri, 3 Dec 2010 04:00:52 +0000 (14:00 +1000)]
Merge branch 'drm-radeon-next' of ../drm-radeon-next into drm-core-next

* 'drm-radeon-next' of ../drm-radeon-next:
  drm/radeon/kms: improve pflip precision on r1xx-r4xx
  drm/kms/radeon: Use high precision timestamps for pageflip completion events.
  drm/kms/radeon: Reorder vblank and pageflip interrupt handling.
  drm/radeon/kms: add pageflip ioctl support (v3)
  drm/kms/radeon: Add support for precise vblank timestamping.

13 years agoMerge branch 'drm-ttm-next' into drm-core-next
Dave Airlie [Fri, 3 Dec 2010 03:59:36 +0000 (13:59 +1000)]
Merge branch 'drm-ttm-next' into drm-core-next

* drm-ttm-next:
  drm/radeon: Use the ttm execbuf utilities
  drm/ttm: Fix up io_mem_reserve / io_mem_free calling
  drm/ttm/vmwgfx: Have TTM manage the validation sequence.
  drm/ttm: Improved fencing of buffer object lists
  drm/ttm/radeon/nouveau: Kill the bo lock in favour of a bo device fence_lock
  drm/ttm: Don't deadlock on recursive multi-bo reservations
  drm/ttm: Optimize ttm_eu_backoff_reservation
  drm/ttm: Use kref_sub instead of repeatedly calling kref_put
  kref: Add a kref_sub function
  drm/ttm: Add a bo list reserve fastpath (v2)

14 years agodrm/radeon/kms: improve pflip precision on r1xx-r4xx
Alex Deucher [Tue, 23 Nov 2010 05:41:00 +0000 (00:41 -0500)]
drm/radeon/kms: improve pflip precision on r1xx-r4xx

The update pending bit has a separate enable bit.

Cc: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: add Ontario APU ucode loading support
Alex Deucher [Mon, 22 Nov 2010 22:56:31 +0000 (17:56 -0500)]
drm/radeon/kms: add Ontario APU ucode loading support

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: add Ontario Fusion APU pci ids
Alex Deucher [Mon, 22 Nov 2010 22:56:37 +0000 (17:56 -0500)]
drm/radeon/kms: add Ontario Fusion APU pci ids

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: enable MSIs on fusion APUs
Alex Deucher [Mon, 22 Nov 2010 22:56:36 +0000 (17:56 -0500)]
drm/radeon/kms: enable MSIs on fusion APUs

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: add power table parsing support for Ontario fusion APUs
Alex Deucher [Mon, 22 Nov 2010 22:56:35 +0000 (17:56 -0500)]
drm/radeon/kms: add power table parsing support for Ontario fusion APUs

The vbios power tables on my inagua board seem a bit funky...

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: refactor atombios power state fetching
Alex Deucher [Mon, 22 Nov 2010 22:56:34 +0000 (17:56 -0500)]
drm/radeon/kms: refactor atombios power state fetching

The function was getting too large.  Rework it to share
more state better handle new power table formats.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: add bo blit support for Ontario fusion APUs
Alex Deucher [Mon, 22 Nov 2010 22:56:33 +0000 (17:56 -0500)]
drm/radeon/kms: add bo blit support for Ontario fusion APUs

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: add thermal sensor support for fusion APUs
Alex Deucher [Mon, 22 Nov 2010 22:56:32 +0000 (17:56 -0500)]
drm/radeon/kms: add thermal sensor support for fusion APUs

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: fill in GPU init for AMD Ontario Fusion APUs
Alex Deucher [Mon, 22 Nov 2010 22:56:29 +0000 (17:56 -0500)]
drm/radeon/kms: fill in GPU init for AMD Ontario Fusion APUs

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: add radeon_asic struct for AMD Ontario fusion APUs
Alex Deucher [Mon, 22 Nov 2010 22:56:30 +0000 (17:56 -0500)]
drm/radeon/kms: add radeon_asic struct for AMD Ontario fusion APUs

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: evergreen.c updates for fusion
Alex Deucher [Mon, 22 Nov 2010 22:56:28 +0000 (17:56 -0500)]
drm/radeon/kms: evergreen.c updates for fusion

fusion chips only have 2 crtcs.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: MC setup changes for fusion APUs
Alex Deucher [Mon, 22 Nov 2010 22:56:27 +0000 (17:56 -0500)]
drm/radeon/kms: MC setup changes for fusion APUs

- CONFIG_MEMSIZE is in bytes on fusion.
- FB_BASE and FB_TOP are finer grained.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: move r7xx/evergreen to its own vram_gtt setup function
Alex Deucher [Mon, 22 Nov 2010 22:56:26 +0000 (17:56 -0500)]
drm/radeon/kms: move r7xx/evergreen to its own vram_gtt setup function

MC_VM_FB_LOCATION is at a different offset between r6xx and r7xx/evergreen.
The location is needed for vram setup on fusion chips.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: add support for ss overrides on Fusion APUs
Alex Deucher [Mon, 22 Nov 2010 22:56:25 +0000 (17:56 -0500)]
drm/radeon/kms: add support for ss overrides on Fusion APUs

System specific spread spectrum overrides can be specified in
the integrated system info table for Fusion APUs.  This adds
support for using those overrides.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: Add support for external encoders on fusion APUs
Alex Deucher [Mon, 22 Nov 2010 22:56:24 +0000 (17:56 -0500)]
drm/radeon/kms: Add support for external encoders on fusion APUs

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: atom changes for DCE4.1 devices
Alex Deucher [Mon, 22 Nov 2010 22:56:23 +0000 (17:56 -0500)]
drm/radeon/kms: atom changes for DCE4.1 devices

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: add new family id for AMD Ontario APUs
Alex Deucher [Mon, 22 Nov 2010 22:56:22 +0000 (17:56 -0500)]
drm/radeon/kms: add new family id for AMD Ontario APUs

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: upstream power table updates
Alex Deucher [Mon, 22 Nov 2010 22:56:21 +0000 (17:56 -0500)]
drm/radeon/kms: upstream power table updates

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: upstream atombios.h updates
Alex Deucher [Mon, 22 Nov 2010 22:56:20 +0000 (17:56 -0500)]
drm/radeon/kms: upstream atombios.h updates

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: upstream ObjectID.h updates
Alex Deucher [Mon, 22 Nov 2010 22:56:19 +0000 (17:56 -0500)]
drm/radeon/kms: upstream ObjectID.h updates

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: setup mc chremap properly on r7xx/evergreen
Alex Deucher [Mon, 22 Nov 2010 22:56:18 +0000 (17:56 -0500)]
drm/radeon/kms: setup mc chremap properly on r7xx/evergreen

Should improve performance slightly and possibly fix some
issues.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon: Use the ttm execbuf utilities
Thomas Hellstrom [Wed, 17 Nov 2010 12:38:32 +0000 (12:38 +0000)]
drm/radeon: Use the ttm execbuf utilities

Rather than re-implementing in the Radeon driver,
Use the execbuf / cs / pushbuf utilities that comes with TTM.
This comes with an even greater benefit now that many spinlocks have been
optimized away...

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: Fix up io_mem_reserve / io_mem_free calling
Thomas Hellstrom [Thu, 11 Nov 2010 08:41:57 +0000 (09:41 +0100)]
drm/ttm: Fix up io_mem_reserve / io_mem_free calling

This patch attempts to fix up shortcomings with the current calling
sequences.

1) There's a fastpath where no locking occurs and only io_mem_reserved is
   called to obtain needed info for mapping. The fastpath is set per
   memory type manager.
2) If the fastpath is disabled, io_mem_reserve and io_mem_free will be exactly
   balanced and not called recursively for the same struct ttm_mem_reg.
3) Optionally the driver can choose to enable a per memory type manager LRU
   eviction mechanism that, when io_mem_reserve returns -EAGAIN will attempt
   to kill user-space mappings of memory in that manager to free up needed
   resources

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm/vmwgfx: Have TTM manage the validation sequence.
Thomas Hellstrom [Wed, 17 Nov 2010 12:28:31 +0000 (12:28 +0000)]
drm/ttm/vmwgfx: Have TTM manage the validation sequence.

Rather than having the driver supply the validation sequence, leave that
responsibility to TTM. This saves some confusion and a function argument.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: Improved fencing of buffer object lists
Thomas Hellstrom [Wed, 17 Nov 2010 12:28:30 +0000 (12:28 +0000)]
drm/ttm: Improved fencing of buffer object lists

Drastically reduce the number of spin lock / unlock operations by performing
unreserving and fencing under global locks.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jerome Glisse <j.glisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm/radeon/nouveau: Kill the bo lock in favour of a bo device fence_lock
Thomas Hellstrom [Wed, 17 Nov 2010 12:28:29 +0000 (12:28 +0000)]
drm/ttm/radeon/nouveau: Kill the bo lock in favour of a bo device fence_lock

The bo lock used only to protect the bo sync object members, and since it
is a per bo lock, fencing a buffer list will see a lot of locks and unlocks.
Replace it with a per-device lock that protects the sync object members on
*all* bos. Reading and setting these members will always be very quick, so
the risc of heavy lock contention is microscopic. Note that waiting for
sync objects will always take place outside of this lock.

The bo device fence lock will eventually be replaced with a seqlock /
rcu mechanism so we can determine that a bo is idle under a
rcu / read seqlock.

However this change will allow us to batch fencing and unreserving of
buffers with a minimal amount of locking.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jerome Glisse <j.glisse@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: Don't deadlock on recursive multi-bo reservations
Thomas Hellstrom [Wed, 17 Nov 2010 12:28:28 +0000 (12:28 +0000)]
drm/ttm: Don't deadlock on recursive multi-bo reservations

Add an aid for the driver to detect deadlocks on multi-bo reservations
Update documentation.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jerome Glisse <j.glisse@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: Optimize ttm_eu_backoff_reservation
Thomas Hellstrom [Wed, 17 Nov 2010 12:28:27 +0000 (12:28 +0000)]
drm/ttm: Optimize ttm_eu_backoff_reservation

Avoid the ttm_bo_unreserve() spinlocks by calling
ttm_eu_backoff_reservation_locked under the lru spinlock.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jerome Glisse <j.glisse@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: Use kref_sub instead of repeatedly calling kref_put
Thomas Hellstrom [Tue, 16 Nov 2010 14:21:08 +0000 (15:21 +0100)]
drm/ttm: Use kref_sub instead of repeatedly calling kref_put

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agokref: Add a kref_sub function
Thomas Hellstrom [Tue, 16 Nov 2010 14:21:07 +0000 (15:21 +0100)]
kref: Add a kref_sub function

Makes it possible to optimize batched multiple unrefs.
Initial user will be drivers/gpu/ttm which accumulates unrefs to be
processed outside of atomic code.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: Add a bo list reserve fastpath (v2)
Dave Airlie [Mon, 22 Nov 2010 03:24:40 +0000 (13:24 +1000)]
drm/ttm: Add a bo list reserve fastpath (v2)

Makes it possible to reserve a list of buffer objects with a single
spin lock / unlock if there is no contention.
Should improve cpu usage on SMP kernels.

v2: Initialize private list members on reserve and don't call
ttm_bo_list_ref_sub() with zero put_count.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>