History log of /drivers/gpu/drm/nouveau/nouveau_drm.c
Revision Date Author Comments
8b62c8c6df08ca567c78afa51aa7bbc554cede06 02-Dec-2014 Dave Airlie <airlied@redhat.com> nouveau: move the hotplug ignore to correct place.

Introduced in b440bde74f, however it was added to
the wrong function in nouveau.

https://bugzilla.kernel.org/show_bug.cgi?id=86011
Cc: Bjorn Helgaas <bhelgaas@google.com>
CC: stable@vger.kernel.org # v3.15+
Signed-off-by: Dave Airlie <airlied@redhat.com>
6fbb702e27d78ad2458df048b58cca3454bc0965 02-Oct-2014 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: make sure display hardware is reinitialised on runtime resume

Linus commit 05c63c2ff23a80b654d6c088ac3ba21628db0173 modified the
runtime suspend/resume paths to skip over display-related tasks to
avoid locking issues on resume.

Unfortunately, this resulted in the display hardware being left in
a partially initialised state, preventing subsequent modesets from
completing.

This commit unifies the (many) suspend/resume paths, bringing back
display (and fbcon) handling in the runtime paths.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
703fa264b1c09ff9d0526553f5448fef77fda898 18-Aug-2014 Pierre Moreau <pierre.morrow@free.fr> drm/nouveau: Display Nouveau boot options at launch

It can help to remove any ambiguity about which options were passed to Nouveau,
especially in case the user had some options set in /etc/modprobe.d/*.conf that
he forgot about, as they won't appear in a dmesg.

Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
b440bde74f043c8ec31081cb59c9a53ade954701 10-Sep-2014 Bjorn Helgaas <bhelgaas@google.com> PCI: Add pci_ignore_hotplug() to ignore hotplug events for a device

Powering off a hot-pluggable device, e.g., with pci_set_power_state(D3cold),
normally generates a hot-remove event that unbinds the driver.

Some drivers expect to remain bound to a device even while they power it
off and back on again. This can be dangerous, because if the device is
removed or replaced while it is powered off, the driver doesn't know that
anything changed. But some drivers accept that risk.

Add pci_ignore_hotplug() for use by drivers that know their device cannot
be removed. Using pci_ignore_hotplug() tells the PCI core that hot-plug
events for the device should be ignored.

The radeon and nouveau drivers use this to switch between a low-power,
integrated GPU and a higher-power, higher-performance discrete GPU. They
power off the unused GPU, but they want to remain bound to it.

This is a reimplementation of f244d8b623da ("ACPIPHP / radeon / nouveau:
Fix VGA switcheroo problem related to hotplug") but extends it to work with
both acpiphp and pciehp.

This fixes a problem where systems with dual GPUs using the radeon drivers
become unusable, freezing every few seconds (see bugzillas below). The
resume of the radeon device may also fail, e.g.,

This fixes problems on dual GPU systems where the radeon driver becomes
unusable because of problems while suspending the device, as in bug 79701:

[drm] radeon: finishing device.
radeon 0000:01:00.0: Userspace still has active objects !
radeon 0000:01:00.0: ffff8800cb4ec288 ffff8800cb4ec000 16384 4294967297 force free
...
WARNING: CPU: 0 PID: 67 at /home/apw/COD/linux/drivers/gpu/drm/radeon/radeon_gart.c:234 radeon_gart_unbind+0xd2/0xe0 [radeon]()
trying to unbind memory from uninitialized GART !

or while resuming it, as in bug 77261:

radeon 0000:01:00.0: ring 0 stalled for more than 10158msec
radeon 0000:01:00.0: GPU lockup ...
radeon 0000:01:00.0: GPU pci config reset
pciehp 0000:00:01.0:pcie04: Card not present on Slot(1-1)
radeon 0000:01:00.0: GPU reset succeeded, trying to resume
*ERROR* radeon: dpm resume failed
radeon 0000:01:00.0: Wait for MC idle timedout !

Link: https://bugzilla.kernel.org/show_bug.cgi?id=77261
Link: https://bugzilla.kernel.org/show_bug.cgi?id=79701
Reported-by: Shawn Starr <shawn.starr@rogers.com>
Reported-by: Jose P. <lbdkmjdf@sharklasers.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Rajat Jain <rajatxjain@gmail.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Dave Airlie <airlied@redhat.com>
CC: stable@vger.kernel.org # v3.15+
915b4d11b8b9e7b84ba4a4645b6cc7fbc0c071cf 29-Aug-2014 David Herrmann <dh.herrmann@gmail.com> drm: add driver->set_busid() callback

One step closer to dropping all the drm_bus_* code:
Add a driver->set_busid() callback and make all drivers use the generic
helpers. Nouveau is the only driver that uses two different bus-types with
the same drm_driver. This is totally broken if both buses are available on
the same machine (unlikely, but lets be safe). Therefore, we create two
different drivers for each platform during module_init() and set the
set_busid() callback respectively.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
27111a23d01c1dba3180c998629004ab4c9ac985 09-Aug-2014 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: expose the full object/event interfaces to userspace

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
771fa0e4d0c5cf6f5cfc915603e7a4a196346048 09-Aug-2014 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: fix headless mode

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
648d4dfde721885737b33a06f2b73ee125acf271 09-Aug-2014 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/disp: audit and version display classes

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
bbf8906b2cad17cf9530b06db7509d0e39b02d16 09-Aug-2014 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/fifo: audit and version fifo channel classes

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4acfd707e28c820ba8ed8c12b497413a133d8c8f 09-Aug-2014 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/dma: audit and version NV_DMA classes

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
586491e6fc27f1783081955fd26d70789ddb3a07 09-Aug-2014 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/device: audit and version NV_DEVICE class

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
fdb751ef2bbc78314d1e01d3425cfacfb19b9f86 09-Aug-2014 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove as much direct use of core headers as possible

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
0ad72863ea426d46b2786cba9430e122a40aad0b 09-Aug-2014 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: port to nvif client/device/objects

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
967e7bde8739fe3b215f7537e8f1f39c044902af 09-Aug-2014 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: initial pass at moving to struct nvif_device

This is an attempt at isolating some of the changes necessary to port
to NVIF in a separate commit.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
db2bec187dd68e79d512112df1f6e7a849e7f0ce 09-Aug-2014 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: kill nouveau_dev() + wrap register macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
3ee6f5b5036be4fd4e64be4233f29ee1c552c005 09-Aug-2014 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: store a pointer to vm in nouveau_cli

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8ba9ff11632cb05d6f55555711d8425e32ee44b0 26-Jun-2014 Alexandre Courbot <acourbot@nvidia.com> drm/nouveau: support for probing platform devices

Add a platform driver for Nouveau devices declared using the device tree
or platform data. This driver currently supports GK20A on Tegra
platforms and is only compiled for these platforms if Nouveau is
enabled.

Nouveau will probe the chip type itself using the BOOT0 register, so all
this driver really needs to do is to make sure the module is powered and
its clocks active before calling nouveau_drm_platform_probe().

Heavily based on work done by Thierry Reding.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
3aac4502fd3f80dcf7e65dbf6edd8676893c1f46 01-Jul-2014 Maarten Lankhorst <maarten.lankhorst@canonical.com> dma-buf: use reservation objects

This allows reservation objects to be used in dma-buf. it's required
for implementing polling support on the fences that belong to a dma-buf.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Mauro Carvalho Chehab <m.chehab@samsung.com> #drivers/media/v4l2-core/
Acked-by: Thomas Hellstrom <thellstrom@vmware.com> #drivers/gpu/drm/ttm
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Acked-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net> #drivers/gpu/drm/armada/
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
028791bb7d662550c7435d38daeb1f0b88ed5b17 30-Jun-2014 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/kms: restore fbcon after display has been resumed

Under some complicated circumstances (boot, suspend, resume, attach
second display, suspend, resume, suspend, detach second display,
resume, suspend, attach second display, resume), the fb_set_suspend()
call can somehow result in a modeset being attempted before we're
ready for it and things blow up in fun ways.

Running display init first fixes the issue.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
05c63c2ff23a80b654d6c088ac3ba21628db0173 26-Mar-2014 Dave Airlie <airlied@redhat.com> drm/nouveau: don't suspend/resume display on runtime s/r

This should ensure we don't hit a locking problem when someone
wakes us up via a connector, we should never go into suspend
while the display is on anyways.

Signed-off-by: Dave Airlie <airlied@redhat.com>
adbbdbac04f093c0abf946b1e93e4e5291808491 26-Mar-2014 Dave Airlie <airlied@redhat.com> drm/nouveau: fail runtime pm properly.

If we were on a non-optimus device, we'd return -EINVAL, this would
lead to the over engineered runtime pm system to go into an error
state, subsequent get_sync's would fail, so we'd never be able
to open the device again.

(like really get_sync shouldn't fail if the device isn't powered
down).

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
40189b0c6551359a9268c8d6f730914b28623817 24-Mar-2014 Alexandre Courbot <acourbot@nvidia.com> drm/nouveau: fix missing newline

Add a missing newline at the end of a DRM_INFO message.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
420b94697722512a2c0732970dc1530197a49adb 17-Feb-2014 Alexandre Courbot <acourbot@nvidia.com> support for platform devices

Upcoming mobile Kepler GPUs (such as GK20A) use the platform bus instead
of PCI to which Nouveau is tightly dependent. This patch allows Nouveau
to handle platform devices by:

- abstracting PCI-dependent functions that were typically used for
resource querying and page mapping,
- introducing a nv_device_is_pci() function that allows to make
PCI-dependent code conditional,
- providing a nouveau_drm_platform_probe() function that takes a GPU
platform device to be probed.

Core code as well as engine/subdev drivers are updated wherever possible
to make use of these functions. Some older drivers are too dependent on
PCI to be properly updated, but all newer code on which future chips may
depend should at least be runnable with platform devices.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
c33e05a1369262ce7930e536af1e049646275198 14-Feb-2014 Ilia Mirkin <imirkin@alum.mit.edu> drm/nouveau: use nv_debug for NV_DEBUG, make DRM a separate subflag

It's really confusing for NV_DEBUG's printing to be controlled via
drm.debug while everything else is controlled via nouveau.debug. These
messages can be turned on with nouveau.debug=DRM=debug.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
46941b0fb6e398e0966f1694f6463dc417af95a6 13-Feb-2014 Ilia Mirkin <imirkin@alum.mit.edu> drm/nouveau: make hdmi device finding failure prints debug level

The hdmi device is required for runtime pm. However it is not available
on many esp older devices, which were all seeing these error messages.
Take this opportunity to also convert to nv_debug instead of the DRM_*
messages, like the rest of nouveau does.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
b6c4285afa66f2f258a237771fd90905a194957d 12-Feb-2014 Alexandre Courbot <acourbot@nvidia.com> drm/nouveau: handle -EACCES runtime PM return code

pm_runtime_get*() may return -EACCES to indicate a device does not have
runtime PM enabled. This is currently the case with platform devices
on Nouveau, and is not an error in that context. Handle this case
without failure.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7d3428cd4b2ad51af86fdbdf8284ca38fa95e601 30-Jan-2014 Ilia Mirkin <imirkin@alum.mit.edu> drm/nouveau: set irq_enabled manually

Since commit 0fa9061ae8c ("drm/nouveau/mc: handle irq-related setup
ourselves"), drm_device->irq_enabled remained unset. This is needed in
order to properly wait for a vblank event in the generic drm code.

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

Reported-by: Jan Janecek <janjanjanx@gmail.com>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: stable@vger.kernel.org # 3.10+
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
f3980dc50c5117a952baee7135aae50d48304af3 23-Jan-2014 Ilia Mirkin <imirkin@alum.mit.edu> drm/nouveau: resume display if any later suspend bits fail

If either idling channels or suspending the fence were to fail, the
display would never be resumed. Also if a client fails, resume the fence
(not functionally important, but it would potentially leak memory).

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

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
d83ef85395c9c1fae7636dca59f95c64963b307d 14-Nov-2013 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: implement hooks for needed for drm vblank timestamping support

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
b25b4427e9dfba073cf9bc86603956ed395eb6e3 12-Dec-2013 Ilia Mirkin <imirkin@alum.mit.edu> drm/nouveau: only runtime suspend by default in optimus configuration

The intent was to only enable it by default for optimus, e.g. see the
runtime_idle callback. The suspend callback may be called directly, e.g.
as a result of nouveau_crtc_set_config.

Reported-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Tested-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
69a6146d1e06b50d070ea40064fccd910371b3b0 13-Nov-2013 Ben Skeggs <bskeggs@redhat.com> drm/nv10-: we no longer need to create nvsw object on user channels

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
26fdd78cce3f51a49e1f2d3ad27ee893a28d220e 15-Oct-2013 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: implement a simple sysfs interface to new pm code

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
b9ed919f1c8f18f419ca6159fdfec656690800b6 15-Oct-2013 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/drm/pm: remove everything except the hwmon interfaces to THERM

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
c52f4fa61d7504bacd94fd54f43fd0b5bdf74bbc 08-Nov-2013 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/core: make all info-level messages silent for runtime pm

Removes the need for special handling of messages in init paths.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8aa816b0bbcefa8517d7e10586d7dbb0ead3c4c1 05-Sep-2013 Ilia Mirkin <imirkin@alum.mit.edu> drm/nv10: fix chipset checks, mostly for the benefit of nv1a

NV1A is numerically higher than NV17 but generationally lower. Use the
new card type to help disambiguate.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
51cb4b392a307a8293b4f1f300ab803d7ad3b036 02-Oct-2013 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/core: convert event handler apis to split create/enable semantics

This is a necessary step towards being able to work with the insane locking
requirements of the DRM core's vblank routines, and a nice cleanup as a
side-effect.

This is similar in spirit to the interfaces that Peter Hurley arrived at
with his nouveau_event rcu conversion series.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ac51bb09837098c422a8825bc155ccd736b9632d 27-Aug-2013 Peter Hurley <peter@hurleysoftware.com> drm/nouveau/core: Allow asymmetric nouveau_event_get/_put

Most nouveau event handlers have storage in 'static' containers
(structures with lifetimes nearly equivalent to the drm_device),
but are dangerously reused via nouveau_event_get/_put. For
example, if nouveau_event_get is called more than once for a
given handler, the event handler list will be corrupted.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ca3562226a901ddf77c7da36077c25316c4c0bb7 27-Sep-2013 Dan Carpenter <dan.carpenter@oracle.com> drm/nouveau: off by one in nouveau_drm_vblank_enable()

The test here should be ">= ARRAY_SIZE()" instead of "> ARRAY_SIZE()".

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
16eb5f4379b2097438a224381be3b4d9e56ac979 02-Oct-2013 David Herrmann <dh.herrmann@gmail.com> drm: kill ->gem_init_object() and friends

All drivers embed gem-objects into their own buffer objects. There is no
reason to keep drm_gem_object_alloc(), gem->driver_private and
->gem_init_object() anymore.

New drivers are highly encouraged to do the same. There is no benefit in
allocating gem-objects separately.

Cc: Dave Airlie <airlied@gmail.com>
Cc: Alex Deucher <alexdeucher@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Ben Skeggs <skeggsb@gmail.com>
Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
01172772c7c973debf5b4881fcb9463891ea97ec 08-Sep-2013 Dave Airlie <airlied@gmail.com> drm/nouveau: fix oops on runtime suspend/resume

if we have no crtcs we need to not call the display resume code.

Reported-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7d7612582c15af8772c2fb2473d5fc7eebfefae2 25-Aug-2013 Martin Peres <martin.peres@labri.fr> drm/nouveau: Support render nodes

Enable support for drm render nodes for nouveau by flagging the ioctls that
are safe and just needed for rendering.

Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
5addcf0a5f0fadceba6bd562d0616a1c5d4c1a4d 10-Sep-2012 Dave Airlie <airlied@redhat.com> nouveau: add runtime PM support (v0.9)

This hooks nouveau up to the runtime PM system to enable
dynamic power management for secondary GPUs in switchable
and optimus laptops.

a) rewrite suspend/resume printks to hide them during dynamic s/r
to avoid cluttering logs
b) add runtime pm suspend to irq handler, crtc display, ioctl handler,
connector status,
c) handle hdmi audio dynamic power on/off using magic register.

v0.5:
make sure we hit D3 properly
fix fbdev_set_suspend locking interaction, we only will poweroff if we have no
active crtcs/fbcon anyways.
add reference for active crtcs.
sprinkle mark last busy for autosuspend timeout

v0.6:
allow more flexible debugging - to avoid log spam
add option to enable/disable dynpm
got to D3Cold

v0.7:
add hdmi audio support.

v0.8:
call autosuspend from idle, so pci config space access doesn't go straight
back to sleep, this makes starting X faster.
only signal usage if we actually handle the irq, otherwise usb keeps us awake.
fix nv50 display active powerdown

v0.9:
use masking function to enable hdmi audio
set busy when we fail to suspend

Signed-off-by: Dave Airlie <airlied@redhat.com>
b0e898ac555e96e7863a5ee95d70f3625f1db5e2 08-Aug-2013 Daniel Vetter <daniel.vetter@ffwll.ch> drm: remove FASYNC support

So I've stumbled over drm_fasync and wondered what it does. Digging
that up is quite a story.

First I've had to read up on what this does and ended up being rather
bewildered why peopled loved signals so much back in the days that
they've created SIGIO just for that ...

Then I wondered how this ever works, and what that strange "No-op."
comment right above it should mean. After all calling the core fasync
helper is pretty obviously not a noop. After reading through the
kernels FASYNC implementation I've noticed that signals are only sent
out to the processes attached with FASYNC by calling kill_fasync.

No merged drm driver has ever done that.

After more digging I've found out that the only driver that ever used
this is the so called GAMMA driver. I've frankly never heard of such a
gpu brand ever before. Now FASYNC seems to not have been the only bad
thing with that driver, since Dave Airlie removed it from the drm
driver with prejudice:

commit 1430163b4bbf7b00367ea1066c1c5fe85dbeefed
Author: Dave Airlie <airlied@linux.ie>
Date: Sun Aug 29 12:04:35 2004 +0000

Drop GAMMA DRM from a great height ...

Long story short, the drm fasync support seems to be doing absolutely
nothing. And the only user of it was never merged into the upstream
kernel. And we don't need any fops->fasync callback since the fcntl
implementation in the kernel already implements the noop case
correctly.

So stop this particular cargo-cult and rip it all out.

v2: Kill drm_fasync assignments in rcar (newly added) and imx drivers
(somehow I've missed that one in staging). Also drop the reference in
the drm DocBook. ARM compile-fail reported by Rob Clark.

v3: Move the removal of dev->buf_asnyc assignment in drm_setup to this
patch here.

v4: Actually git add ... tsk.

Cc: Dave Airlie <airlied@linux.ie>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Rob Clark <robdclark@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
baa7094355a10b432bbccacb925da4bdac861c8d 02-Aug-2013 Rob Clark <robdclark@gmail.com> drm: const'ify ioctls table (v2)

Because, there is no reason for it not to be const.

v1: original
v2: fix compile break in vmwgfx, and couple related cleanups suggested
by Ville Syrjälä

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
43387b37fa2d0f368142b8fa8c9440da92e5381b 16-Jul-2013 Daniel Vetter <daniel.vetter@ffwll.ch> drm/gem: create drm_gem_dumb_destroy

All the gem based kms drivers really want the same function to
destroy a dumb framebuffer backing storage object.

So give it to them and roll it out in all drivers.

This still leaves the option open for kms drivers which don't use GEM
for backing storage, but it does decently simplify matters for gem
drivers.

Acked-by: Inki Dae <inki.dae@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Ben Skeggs <skeggsb@gmail.com>
Reviwed-by: Rob Clark <robdclark@gmail.com>
Cc: Alex Deucher <alexdeucher@gmail.com>
Acked-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
4cb4ea39cd61a9d71bf7227c5927c870fdde710c 10-Jul-2013 Daniel Vetter <daniel.vetter@ffwll.ch> drm/nouveau: drop DRIVER_PCI_DMA and DRIVER_SG

The former doesn't do anything without DRIVER_HAVE_DMA (which is
force-disabled for kms drivers anyway). The latter isn't used by the
(kms) nouveau ddx.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@gmail.com>
00fc6f6f731efb7b76b839598e494b01890d901d 09-Jul-2013 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: use dedicated channel for async moves on GT/GF chipsets.

The moves themselves were generally async to graphics previously, with
the exception that if the "main" channel is used to synchronise a
page flip at the same time, it can end up blocked for a noticable amount
of time for large buffer moves.

Not really critical, and there's better ways of handling this, but they
are all rather invasive, so this is fine for now.

Based on a patch by Maarten Lankhorst addressing the same issue.

Reported-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Acked-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
060810d7abaabcab282e062c595871d661561400 08-Jul-2013 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: fix locking issues in page flipping paths

b580c9e2b7ba5030a795aa2fb73b796523d65a78 introduced additional problems
while trying to solve issues that became apparent while porting to the
new reservation stuff.

The major problem was that the the previously mentioned patch took the
client mutex earlier than previously, but the pinning of new_bo can
can potentially cause a buffer move, which would result in attempting to
acquire the same mutex again.

This commit attempts to fix that "fix".

Thanks to Maarten for the tips on keeping lockdep happy and cooking :)

Reported-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Acked-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
1af7c7dd2142b04f5e70746f8b65f5988e226e77 27-Jun-2013 Maarten Lankhorst <m.b.lankhorst@gmail.com> drm/nouveau: implement prime helper unpin function

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
81dff21b643f48c14010a97ffc799e1920d751e5 07-May-2013 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: ensure channels are stopped before saving fences for suspend

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
9fe72f9e8370f1931e5e3137fe497d6167057340 02-May-2013 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: force noaccel when no PFIFO support present

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
dded35dee323e286ef444f148abaf88adb58d4f3 25-Apr-2013 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/device: convert to engine, rather than subdev

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
0fa9061ae8c10a9178d696cf48d94c3bf2848f9f 22-Mar-2013 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/mc: handle irq-related setup ourselves

We need to be able to process interrupts before the DRM code is able to
actually enable them, set it up ourselves. Also, it's less convoluted
to *not* use the DRM wrappers it appears...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
e4604d8fe8492f8120cf92d4b60b3cc90ba87bd0 24-Mar-2013 Maarten Lankhorst <maarten.lankhorst@canonical.com> drm/nouveau: fix NULL ptr dereference from nv50_disp_intr()

Op 23-03-13 12:47, Peter Hurley schreef:
> On Tue, 2013-03-19 at 11:13 -0400, Peter Hurley wrote:
>> On vanilla 3.9.0-rc3, I get this 100% repeatable oops after login when
>> the user X session is coming up:
> Perhaps I wasn't clear that this happens on every boot and is a
> regression from 3.8
>
> I'd be happy to help resolve this but time is of the essence; it would
> be a shame to have to revert all of this for 3.9

Well it broke on my system too, so it was easy to fix.

I didn't even need gdm to trigger it!

>8----
This fixes regression caused by 1d7c71a3e2f7 (drm/nouveau/disp: port vblank handling to event interface),

which causes a oops in the following way:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000001
IP: [<0000000000000001>] 0x0
PGD 0
Oops: 0010 [#1] PREEMPT SMP
Modules linked in: ip6table_filter ip6_tables ebtable_nat ebtables ...<snip>...
CPU 3
Pid: 0, comm: swapper/3 Not tainted 3.9.0-rc3-xeon #rc3 Dell Inc. Precision WorkStation T5400 /0RW203
RIP: 0010:[<0000000000000001>] [<0000000000000001>] 0x0
RSP: 0018:ffff8802afcc3d80 EFLAGS: 00010087
RAX: ffff88029f6e5808 RBX: 0000000000000001 RCX: 0000000000000000
RDX: 0000000000000096 RSI: 0000000000000001 RDI: ffff88029f6e5808
RBP: ffff8802afcc3dc8 R08: 0000000000000000 R09: 0000000000000004
R10: 000000000000002c R11: ffff88029e559a98 R12: ffff8802a376cb78
R13: ffff88029f6e57e0 R14: ffff88029f6e57f8 R15: ffff88029f6e5808
FS: 0000000000000000(0000) GS:ffff8802afcc0000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000001 CR3: 000000029fa67000 CR4: 00000000000007e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process swapper/3 (pid: 0, threadinfo ffff8802a355e000, task ffff8802a3535c40)
Stack:
ffffffffa0159d8a 0000000000000082 ffff88029f6e5820 0000000000000001
ffff88029f71aa00 0000000000000000 0000000000000000 0000000004000000
0000000004000000 ffff8802afcc3e38 ffffffffa01843b5 ffff8802afcc3df8
Call Trace:
<IRQ>
[<ffffffffa0159d8a>] ? nouveau_event_trigger+0xaa/0xe0 [nouveau]
[<ffffffffa01843b5>] nv50_disp_intr+0xc5/0x200 [nouveau]
[<ffffffff816fbacc>] ? _raw_spin_unlock_irqrestore+0x2c/0x50
[<ffffffff816ff98d>] ? notifier_call_chain+0x4d/0x70
[<ffffffffa017a105>] nouveau_mc_intr+0xb5/0x110 [nouveau]
[<ffffffffa01d45ff>] nouveau_irq_handler+0x6f/0x80 [nouveau]
[<ffffffff810eec95>] handle_irq_event_percpu+0x75/0x260
[<ffffffff810eeec8>] handle_irq_event+0x48/0x70
[<ffffffff810f205a>] handle_fasteoi_irq+0x5a/0x100
[<ffffffff810182f2>] handle_irq+0x22/0x40
[<ffffffff8170561a>] do_IRQ+0x5a/0xd0
[<ffffffff816fc2ad>] common_interrupt+0x6d/0x6d
<EOI>
[<ffffffff810449b6>] ? native_safe_halt+0x6/0x10
[<ffffffff8101ea1d>] default_idle+0x3d/0x170
[<ffffffff8101f736>] cpu_idle+0x116/0x130
[<ffffffff816e2a06>] start_secondary+0x251/0x258
Code: Bad RIP value.
RIP [<0000000000000001>] 0x0
RSP <ffff8802afcc3d80>
CR2: 0000000000000001
---[ end trace 907323cb8ce6f301 ]---

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
33b903e82873ba9233bd89c44d016b87347ed158 08-Feb-2013 Marcin Slusarz <marcin.slusarz@gmail.com> drm/nouveau: restore debugfs/vbios.rom support

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
60e5cb79cbd27a36836fc04177d7c323ee873563 13-Feb-2013 Ben Skeggs <bskeggs@redhat.com> drm/nv17/fence: split from nv10 code

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
1d7c71a3e2f77336df536855b0efd2dc5bdeb41b 31-Jan-2013 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/disp: port vblank handling to event interface

This removes the nastiness with the interactions between display and
software engines when handling vblank semaphore release interrupts.

Now, all the semantics are handled in one place (sw) \o/.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
cd897837eacc6ce0b883b5e6c9000cb2e5f11c39 27-Jan-2013 Marcin Slusarz <marcin.slusarz@gmail.com> drm/nouveau: quiet static-related sparse noise

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
a2896cede08ddeed4f2c4fca616943a63dff5fa8 09-Dec-2012 Marcin Slusarz <marcin.slusarz@gmail.com> drm/nouveau: prepare for reporting channel owner

- record channel owner process name
- add some helpers for accessing this information
- let nouveau_enum hold additional value (will be needed in the next patch)

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5f97ab913cf0fbc378ea8ffc3ee66f4890d11c55 04-Feb-2013 Marcin Slusarz <marcin.slusarz@gmail.com> drm/nouveau: add lockdep annotations

1) Lockdep thinks all nouveau subdevs belong to the same class and can be
locked in arbitrary order, which is not true (at least in general case).
Tell it to distinguish subdevs by (o)class type.
2) DRM client can be locked under user client lock - tell lockdep to put
DRM client lock in a separate class.

Reported-by: Arend van Spriel <arend@broadcom.com>
Reported-by: Peter Hurley <peter@hurleysoftware.com>
Reported-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reported-by: Daniel J Blueman <daniel@quora.org>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: stable@vger.kernel.org [3.7, but needs s/const ofuncs/ofuncs/ to build]
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ab9ccb96a6e6f95bcde6b8b2a524370efdbfdcd6 15-Jan-2013 Aaron Plattner <aplattner@nvidia.com> drm/nouveau: use prime helpers

Simplify the Nouveau prime implementation by using the default behavior provided
by drm_gem_prime_import and drm_gem_prime_export.

v2: Rename functions to nouveau_gem_prime_get_sg_table and
nouveau_gem_prime_import_sg_table.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
Signed-off-by: Dave Airlie <airlied@redhat.com>
dd5700ea98ad0b375a72525ce7d7edddf15b2693 10-Dec-2012 Marcin Slusarz <marcin.slusarz@gmail.com> drm/nouveau: fix nouveau_client allocation failure path

Depending on the point of failure, freed object would be returned
or memory leak would happen.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
56550d94cbaeaa195cb98c95d012b301cbd65a8d 22-Dec-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Drivers: gpu: remove __dev* attributes.

CONFIG_HOTPLUG is going away as an option. As a result, the __dev*
markings need to be removed.

This change removes the use of __devinit, __devexit_p, and __devexit
from these drivers.

Based on patches originally written by Bill Pemberton, but redone by me
in order to handle some of the coding style issues better, by hand.

Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: David Airlie <airlied@linux.ie>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24c89e9b630639d081066f8c3d21568b5e4c61d8 20-Nov-2012 Sachin Kamat <sachin.kamat@linaro.org> drm/nouveau: remove duplicate inclusion of nouveau_ttm.h

nouveau_ttm.h was included twice.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4946980099c617ba7612f97f77cba7ece5b7f820 22-Nov-2012 Ben Skeggs <bskeggs@redhat.com> drm/nve0: allow specification of channel engine type in abi16 call

Previously, if either vram/gart handles were specified as ~0, the ioctl
call would fail. In order to hack engine selection into the ioctl for
kepler, we now define (fb_ctxdma_handle == ~0) to mean "engine mask is
in tt_ctxdma_handle".

This approach also allows new userspace to detect lack of support for
non-PGRAPH channels on older kernels.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2d8b9ccbcee694c9ce681ec596df642e52ddcb15 02-Nov-2012 Dave Airlie <airlied@redhat.com> drm/nouveau: convert to dev_pm_ops

This is a precursor to dynamic power management support for nouveau,

we need to use pm ops for that, so first convert the driver to using pm ops
interfaces.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ace5a9b8dbc66ada0aa8c5f67b93527590822c7c 21-Nov-2012 Maarten Lankhorst <maarten.lankhorst@canonical.com> drm/nouveau: use the correct fence implementation for nv50

Only compile time tested, noticed nv50_fence_create was never used,
so fix this. This will probably fix vblank on nv50 cards.

Hopefully this is still in time for 3.7 final release.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
83ef7777aa5ffbf08a71e14f0a127de315293113 09-Nov-2012 Tommi Rantala <tt.rantala@gmail.com> drm/nouveau: free memory allocated with alloc_apertures()

Fix a memory leak by deallocating the memory we got from
alloc_apertures().

Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
e412e95a268fa8544858ebfe066826b290430d51 30-Oct-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: headless mode by default if pci class != vga display

This is to prevent nouveau from taking over the console on headless boards
such as Tesla.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
9430738d80223a1cd791a2baa74fa170d3df1262 30-Oct-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: resurrect headless mode since rework

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
fa6df8c163ddf1fba658059695ab9587f344712c 12-Sep-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/core: have client-id be a string, rather than an integer

Can be somewhat more informative that way...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5b8a43aeb9cbf6b965f67f6c850382788076325a 19-Aug-2012 Marcin Slusarz <marcin.slusarz@gmail.com> drm/nouveau: quiet some static-related sparse noise

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
49981046e3dc2f934663548a270d4bf1a4534bb9 06-Aug-2012 Ben Skeggs <bskeggs@redhat.com> drm/nve0: use async copy engine for ttm buffer moves if available

Kepler PFIFO lost the ability to address multiple engines from a single
channel, so we need a separate one for the copy engine.

v2: Marcin Slusarz <marcin.slusarz@gmail.com>
- regression fix: restore hw accelerated buffer copies

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
77145f1cbdf8d28b46ff8070ca749bad821e0774 31-Jul-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: port remainder of drm code, and rip out compat layer

v2: Ben Skeggs <bskeggs@redhat.com>
- fill in nouveau_pm.dev to prevent oops
- fix ppc issues (build + OF shadow)

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ebb945a94bba2ce8dff7b0942ff2b3f2a52a0a69 20-Jul-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: port all engines to new engine module format

This is a HUGE commit, but it's not nearly as bad as it looks - any problems
can be isolated to a particular chipset and engine combination. It was
simply too difficult to port each one at a time, the compat layers are
*already* ridiculous.

Most of the changes here are simply to the glue, the process for each of the
engine modules was to start with a standard skeleton and copy+paste the old
code into the appropriate places, fixing up variable names etc as needed.

v2: Marcin Slusarz <marcin.slusarz@gmail.com>
- fix find/replace bug in license header

v3: Ben Skeggs <bskeggs@redhat.com>
- bump indirect pushbuf size to 8KiB, 4KiB barely enough for userspace and
left no space for kernel's requirements during GEM pushbuf submission.
- fix duplicate assignments noticed by clang

v4: Marcin Slusarz <marcin.slusarz@gmail.com>
- add sparse annotations to nv04_fifo_pause/nv04_fifo_start
- use ioread32_native/iowrite32_native for fifo control registers

v5: Ben Skeggs <bskeggs@redhat.com>
- rebase on v3.6-rc4, modified to keep copy engine fix intact
- nv10/fence: unmap fence bo before destroying
- fixed fermi regression when using nvidia gr fuc
- fixed typo in supported dma_mask checking

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
cb75d97e9c77743ecfcc43375be135a55a4d9b25 11-Jul-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: implement devinit subdev, and new init table parser

v2:
- make sure not to execute display scripts unless resuming

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
9458029940ffc64bca0c5a30ea626c377205842e 05-Jul-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: implement module init functions in nouveau_drm.c

These currently just call the existing ones in nouveau_drv.c, but will be
extended in upcoming commits. This needed to be separated from the current
code as there will be some header clashes until things are ported.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>