firefly-linux-kernel-4.4.55.git
11 years agodrm/radeon: use HDP_MEM_COHERENCY_FLUSH_CNTL for sdma as well
Alex Deucher [Thu, 7 Nov 2013 18:43:37 +0000 (13:43 -0500)]
drm/radeon: use HDP_MEM_COHERENCY_FLUSH_CNTL for sdma as well

The new HDP flush method doesn't seem to work reliably on
sDMA either, so use the old method here too.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/kms: add crtc_disable function for legacy crtc
Ilija Hadzic [Sun, 3 Nov 2013 03:00:20 +0000 (23:00 -0400)]
drm/radeon/kms: add crtc_disable function for legacy crtc

To plug the VRAM memory leak (see previous patch for
details) we must unpin the frame buffer when disabling the
CRTC. This warrants the addition of disable function for legacy
CRTC, which puts the CRTC in DPMS-OFF state and unpins the
frame buffer if there is one associated with the CRTC.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/kms: unpin fb in atombios crtc disable
Ilija Hadzic [Sun, 3 Nov 2013 03:00:19 +0000 (23:00 -0400)]
drm/radeon/kms: unpin fb in atombios crtc disable

When drm_helper_disable_unused_functions calls disable
function of the CRTC, it also sets the crtc->fb pointer
to NULL. This can later (when the mode on that CRTC is setup
again from user space) cause ***_do_set_base functions to
"think" that there is no old buffer and skip the unpinning
code. Consequently, the buffer that has been NULL-ified in
drm_helper_disable_unused_functions will never be unpinned
causing a leak in VRAM.

This patch plugs the leak by unpinning the frame buffer
in crtc_disable function.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/audio: fix missing multichannel PCM SAD in some cases
Anssi Hannula [Mon, 28 Oct 2013 23:19:16 +0000 (01:19 +0200)]
drm/radeon/audio: fix missing multichannel PCM SAD in some cases

The current code writing SADs to the audio registers seems to assume
that there is at most a single SAD per audio format.

However, that is not the case. Especially for PCM it is somewhat common
for sinks to have two SADs, one for 8-channel and one for 2-channel
audio, which may have different supported sample rates (i.e. the sink
supports stereo audio at higher sample rates than multichannel audio).

Because of this, only the 2-channel SAD may be used if it appears before
the 8-channel SAD. Unless other SADs require otherwise, this may cause
the ALSA HDA driver to allow stereo playback only.

Fix the code to pick the PCM SAD with the highest number of channels,
while merging the rate masks of PCM SADs with lower amount of channels
into the additional stereo rate mask byte.

Technically there are even more cases to handle (multiple non-PCM SADs
of the same type, more than two PCM SADs with varying channel counts,
etc), but those have not actually been encountered in the field and
handling them would be non-trivial.

Example affected EDID from Onkyo TX-SR674 specifying 192kHz stereo
support and 96kHz 8-channel support (and other 8-channel compressed
formats):
00ffffffffffff003dcb010000000001
ffff0103800000780a0dc9a057479827
12484c00000001010101010101010101
010101010101011d8018711c1620582c
2500c48e2100009e011d007251d01e20
6e285500c48e2100001e000000fc0054
582d53523637342020202020000000fd
00313d0f2e08000a202020202020019b
02032f724f8504030f0e07069413121e
1d1615012f097f070f1f071707503707
503f07c0834f000066030c00ffff808c
0ad08a20e02d10103e9600c48e210000
18011d80d0721c1620102c2580c48e21
00009e011d00bc52d01e20b8285540c4
8e2100001e8c0ad090204031200c4055
00c48e210000180000000000000000a8

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Tested-by: Andre Heider <a.heider@gmail.com>
Cc: Rafał Miłecki <zajec5@gmail.com>
Acked-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agoMerge tag 'drm-intel-fixes-2013-11-07' of git://people.freedesktop.org/~danvet/drm...
Dave Airlie [Fri, 8 Nov 2013 06:34:39 +0000 (16:34 +1000)]
Merge tag 'drm-intel-fixes-2013-11-07' of git://people.freedesktop.org/~danvet/drm-intel into drm-next

Bit a bit -fixes pull request in the merge window than usual dua to two
feauture-y things:
- Display CRCs are now enabled on all platforms, including the odd DP case
  on gm45/vlv. Since this is a testing-only feature it should ever hurt,
  but I figured it'll help with regression-testing -fixes. So I left it
  in and didn't postpone it to 3.14.
- Display power well refactoring from Imre. Would have caused major pain
  conflict with the bdw stage 1 patches if I'd postpone this to -next.
  It's only an relatively small interface rework, so shouldn't cause pain.
  It's also been in my tree since almost 3 weeks already.

That accounts for about two thirds of the pull, otherwise just bugfixes:
- vlv backlight fix from Jesse/Jani
- vlv vblank timestamp fix from Jesse
- improved edp detection through vbt from Ville (fixes a vlv issue)
- eDP vdd fix from Paulo
- fixes for dvo lvds on i830M
- a few smaller things all over

Note: This contains a backmerge of v3.12. Since the -internal branch
always applied on top of -nightly I need that unified base to merge bdw
patches. So you'll get a conflict with radeon connector props when pulling
this (and nouveau/master will also conflict a bit when Ben doesn't
rebase). The backmerge itself only had conflicts in drm/i915.

There's also a tiny conflict between Jani's backlight fix and your sysfs
lifetime fix in drm-next.

* tag 'drm-intel-fixes-2013-11-07' of git://people.freedesktop.org/~danvet/drm-intel: (940 commits)
  drm/i915/vlv: use per-pipe backlight controls v2
  drm/i915: make backlight functions take a connector
  drm/i915: move opregion asle request handling to a work queue
  drm/i915/vlv: use PIPE_START_VBLANK interrupts on VLV
  drm/i915: Make intel_dp_is_edp() less specific
  drm/i915: Give names to the VBT child device type bits
  drm/i915/vlv: enable HDA display audio for Valleyview2
  drm/i915/dvo: call ->mode_set callback only when the port is running
  drm/i915: avoid unclaimed registers when capturing the error state
  drm/i915: Enable DP port CRC for the "auto" source on g4x/vlv
  drm/i915: scramble reset support for DP port CRC on vlv
  drm/i915: scramble reset support for DP port CRC on g4x
  drm/i916: add "auto" pipe CRC source
  ...

Conflicts:
MAINTAINERS
drivers/gpu/drm/i915/intel_panel.c
drivers/gpu/drm/nouveau/core/subdev/mc/base.c
drivers/gpu/drm/radeon/atombios_encoders.c
drivers/gpu/drm/radeon/radeon_connectors.c

11 years agodrm/vmwgfx: fix warning if config intel iommu is off.
Dave Airlie [Fri, 8 Nov 2013 06:12:42 +0000 (16:12 +1000)]
drm/vmwgfx: fix warning if config intel iommu is off.

Though I'm not really happy with how ugly this code is now.

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/nouveau: consider CLASS_DISPLAY_3D devices while detecting dsm/optimus
Emil Velikov [Wed, 9 Oct 2013 07:25:16 +0000 (08:25 +0100)]
drm/nouveau: consider CLASS_DISPLAY_3D devices while detecting dsm/optimus

The present code assumes that optimus is present whenever two
VGA (PCI_CLASS_DISPLAY_VGA) devices are present. This does not
seem to be the case of newer laptops with optimus, in which
case the nvidia gpu is a PCI_CLASS_DISPLAY_3D device.

Rework the logic so that we count both VGA and 3D devices,
when contemplating if optimus is present on the platform.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70208
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agoMerge branch 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux...
Dave Airlie [Fri, 8 Nov 2013 06:01:02 +0000 (16:01 +1000)]
Merge branch 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6 into drm-next

- Ilia's PMPEG improvements
- MSI fixes, and another attempt at enabling by default
- Initial GK208 support, just modesetting
- "Old" PM code gone, new infrastructure and various different stages of support (depending which chipset / ram type etc) is in its place.  This includes support that goes beyond what the previous code was capable of.  User control has been deliberately sabotaged, it's not safe to use still.
- Thermal management / fan control that's been present for a while is turned ON by default now.
- Misc other fixes that have accumulated

* 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6: (74 commits)
  drm/nouveau/fb: implement various bits of work towards memory reclocking
  drm/nouveau: implement a simple sysfs interface to new pm code
  drm/nouveau/device: initial control object class, with pstate control methods
  drm/nouveau/clk: implement power state and engine clock control in core
  drm/nouveau/volt: implement voltage control in core
  drm/nouveau/bios: parsing for various tables required for power management
  drm/nouveau/perfmon: initial infrastructure to expose performance counters
  drm/nouveau/bus: add interfaces/helpers for sequencer
  drm/nouveau/bus: make external class definitions pointers
  drm/nouveau/pwr: initial implementation
  drm/nouveau/therm: update target fanspeed outside of therm lock
  drm/nouveau/therm: automatic mode by default
  drm/nouveau/therm: no toggle fan control either if we can't guarantee no pwm connected
  drm/nvc0/therm: allow fan control if we've killed the vbios ppwr ucode
  drm/nouveau/therm: if no bios trip/linear info, default to perf-suggested speed
  drm/nouveau/therm: add hook for clk to suggest fanspeed to therm
  drm/nouveau/pwr: assign a subdev id for upcoming implementation
  drm/nouveau/gpio: return different error code for not found vs invalid
  drm/nouveau/drm/pm: remove everything except the hwmon interfaces to THERM
  drm/nouveau/core: make all info-level messages silent for runtime pm
  ...

11 years agodrm/mgag200: drop pointless info print.
Dave Airlie [Tue, 5 Nov 2013 03:21:17 +0000 (13:21 +1000)]
drm/mgag200: drop pointless info print.

This isn't useful anymore.

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/nouveau/fb: implement various bits of work towards memory reclocking
Ben Skeggs [Mon, 4 Mar 2013 05:01:37 +0000 (15:01 +1000)]
drm/nouveau/fb: implement various bits of work towards memory reclocking

Not even remotely ready for the vast majority of the world.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: implement a simple sysfs interface to new pm code
Ben Skeggs [Tue, 15 Oct 2013 01:52:56 +0000 (11:52 +1000)]
drm/nouveau: implement a simple sysfs interface to new pm code

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/device: initial control object class, with pstate control methods
Ben Skeggs [Wed, 16 Oct 2013 23:56:02 +0000 (09:56 +1000)]
drm/nouveau/device: initial control object class, with pstate control methods

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/clk: implement power state and engine clock control in core
Ben Skeggs [Sun, 13 Jan 2013 22:28:28 +0000 (08:28 +1000)]
drm/nouveau/clk: implement power state and engine clock control in core

User control of this has been hard-coded as disabled for now.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/volt: implement voltage control in core
Ben Skeggs [Thu, 7 Feb 2013 23:34:56 +0000 (09:34 +1000)]
drm/nouveau/volt: implement voltage control in core

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/bios: parsing for various tables required for power management
Ben Skeggs [Mon, 14 Jan 2013 22:33:25 +0000 (08:33 +1000)]
drm/nouveau/bios: parsing for various tables required for power management

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/perfmon: initial infrastructure to expose performance counters
Ben Skeggs [Wed, 13 Feb 2013 05:29:11 +0000 (15:29 +1000)]
drm/nouveau/perfmon: initial infrastructure to expose performance counters

Internal use only at this point.  Userspace later.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/bus: add interfaces/helpers for sequencer
Ben Skeggs [Tue, 15 Oct 2013 00:49:39 +0000 (10:49 +1000)]
drm/nouveau/bus: add interfaces/helpers for sequencer

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/bus: make external class definitions pointers
Ben Skeggs [Wed, 23 Oct 2013 23:39:05 +0000 (09:39 +1000)]
drm/nouveau/bus: make external class definitions pointers

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/pwr: initial implementation
Ben Skeggs [Mon, 14 Oct 2013 23:38:12 +0000 (09:38 +1000)]
drm/nouveau/pwr: initial implementation

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/therm: update target fanspeed outside of therm lock
Ben Skeggs [Sun, 3 Nov 2013 23:34:55 +0000 (09:34 +1000)]
drm/nouveau/therm: update target fanspeed outside of therm lock

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/therm: automatic mode by default
Ben Skeggs [Thu, 25 Jul 2013 23:51:43 +0000 (09:51 +1000)]
drm/nouveau/therm: automatic mode by default

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/therm: no toggle fan control either if we can't guarantee no pwm connected
Ben Skeggs [Mon, 4 Nov 2013 23:58:27 +0000 (09:58 +1000)]
drm/nouveau/therm: no toggle fan control either if we can't guarantee no pwm connected

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nvc0/therm: allow fan control if we've killed the vbios ppwr ucode
Ben Skeggs [Tue, 15 Oct 2013 00:31:05 +0000 (10:31 +1000)]
drm/nvc0/therm: allow fan control if we've killed the vbios ppwr ucode

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/therm: if no bios trip/linear info, default to perf-suggested speed
Ben Skeggs [Thu, 25 Jul 2013 23:58:47 +0000 (09:58 +1000)]
drm/nouveau/therm: if no bios trip/linear info, default to perf-suggested speed

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/therm: add hook for clk to suggest fanspeed to therm
Ben Skeggs [Thu, 25 Jul 2013 23:15:57 +0000 (09:15 +1000)]
drm/nouveau/therm: add hook for clk to suggest fanspeed to therm

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/pwr: assign a subdev id for upcoming implementation
Ben Skeggs [Tue, 15 Oct 2013 00:07:31 +0000 (10:07 +1000)]
drm/nouveau/pwr: assign a subdev id for upcoming implementation

THERM will use this before it exists.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/gpio: return different error code for not found vs invalid
Ben Skeggs [Thu, 31 Oct 2013 00:07:51 +0000 (10:07 +1000)]
drm/nouveau/gpio: return different error code for not found vs invalid

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/drm/pm: remove everything except the hwmon interfaces to THERM
Ben Skeggs [Mon, 14 Oct 2013 23:44:02 +0000 (09:44 +1000)]
drm/nouveau/drm/pm: remove everything except the hwmon interfaces to THERM

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/core: make all info-level messages silent for runtime pm
Ben Skeggs [Fri, 8 Nov 2013 04:38:40 +0000 (14:38 +1000)]
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>
11 years agodrm/nouveau/fifo: make external class definitions into pointers
Ben Skeggs [Tue, 5 Nov 2013 04:26:58 +0000 (14:26 +1000)]
drm/nouveau/fifo: make external class definitions into pointers

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/device: recognise GK208
Ben Skeggs [Tue, 5 Nov 2013 03:14:25 +0000 (13:14 +1000)]
drm/nouveau/device: recognise GK208

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nvc0-/gr: fix a number of missing explicit array terminators...
Ben Skeggs [Mon, 4 Nov 2013 23:28:26 +0000 (09:28 +1000)]
drm/nvc0-/gr: fix a number of missing explicit array terminators...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/mc: fix (incorrect) reporting of unknown pending intr bits
Ben Skeggs [Mon, 4 Nov 2013 23:09:30 +0000 (09:09 +1000)]
drm/nouveau/mc: fix (incorrect) reporting of unknown pending intr bits

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/disp: semi-complete link training sequence even if display disappears
Ben Skeggs [Mon, 4 Nov 2013 03:40:36 +0000 (13:40 +1000)]
drm/nouveau/disp: semi-complete link training sequence even if display disappears

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/bios: some older boards have shorter displayport tables
Ben Skeggs [Mon, 4 Nov 2013 03:40:03 +0000 (13:40 +1000)]
drm/nouveau/bios: some older boards have shorter displayport tables

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/fbcon: bracket entrypoints with a per-device enabled check
Ben Skeggs [Mon, 4 Nov 2013 01:15:38 +0000 (11:15 +1000)]
drm/nouveau/fbcon: bracket entrypoints with a per-device enabled check

We don't necessarily have fbcon on all devices these days.

Fixes suspend on (at least) Quadro NVS 450.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nvd0-/disp: reorder writes to lane current control regs
Ben Skeggs [Mon, 4 Nov 2013 01:00:59 +0000 (11:00 +1000)]
drm/nvd0-/disp: reorder writes to lane current control regs

Matches the nv94-nvc0 commit with the same title.  Doesn't fix a reported issue,
but NVIDIA use this ordering here too, so let's do it just in case.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv94-nvc0/disp: reorder writes to lane current control regs
Ben Skeggs [Mon, 4 Nov 2013 00:52:29 +0000 (10:52 +1000)]
drm/nv94-nvc0/disp: reorder writes to lane current control regs

Fixes link training issues on some boards.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/disp: log if DP link training fails
Ben Skeggs [Thu, 31 Oct 2013 23:36:42 +0000 (09:36 +1000)]
drm/nouveau/disp: log if DP link training fails

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/i2c: use a custom bitbanging delay for the adt7473
Martin Peres [Sun, 20 Oct 2013 23:48:55 +0000 (01:48 +0200)]
drm/nouveau/i2c: use a custom bitbanging delay for the adt7473

This patch adds a way to define a custom delay when scanning for i2c devices
because the adt7473 sometimes doesn't like the default bitbanging udelay.

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/agp: add a quirk list to limit agp modes
Ilia Mirkin [Sun, 27 Oct 2013 15:54:09 +0000 (11:54 -0400)]
drm/nouveau/agp: add a quirk list to limit agp modes

Certain combinations of hardware can't actually support the maximum
detected speed. Add a quirk list that lists pairs of hostbridge/chip pci
ids and the mode that they should work with.

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

Reported-by: Jason Detring <detringj@gmail.com>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nvd9-/disp: disable display underflow reporting at init
Ben Skeggs [Thu, 24 Oct 2013 23:59:14 +0000 (09:59 +1000)]
drm/nvd9-/disp: disable display underflow reporting at init

Reported-by: Andy Ritger <aritger@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nva0/clk: fix accidental limiting of pll coefficients
Ben Skeggs [Tue, 22 Oct 2013 03:45:16 +0000 (13:45 +1000)]
drm/nva0/clk: fix accidental limiting of pll coefficients

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50-nvaf/fb: split fbram oclass in preparation for reclocking
Ben Skeggs [Mon, 21 Oct 2013 02:04:43 +0000 (12:04 +1000)]
drm/nv50-nvaf/fb: split fbram oclass in preparation for reclocking

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/fb: merge more bits and pieces into oclass definitions
Ben Skeggs [Mon, 21 Oct 2013 00:26:04 +0000 (10:26 +1000)]
drm/nouveau/fb: merge more bits and pieces into oclass definitions

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/fb: remove ram oclass argument from base fb constructor
Ben Skeggs [Sun, 20 Oct 2013 22:50:25 +0000 (08:50 +1000)]
drm/nouveau/fb: remove ram oclass argument from base fb constructor

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50-nvaf/fb: split the class definitions up a bit
Ben Skeggs [Fri, 18 Oct 2013 04:44:23 +0000 (14:44 +1000)]
drm/nv50-nvaf/fb: split the class definitions up a bit

These will diverge further in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/fb: make external class definitions pointers
Ben Skeggs [Fri, 18 Oct 2013 04:18:04 +0000 (14:18 +1000)]
drm/nouveau/fb: make external class definitions pointers

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nvaa/mc: blacklist msi to off by default
Ben Skeggs [Tue, 22 Oct 2013 04:14:33 +0000 (14:14 +1000)]
drm/nvaa/mc: blacklist msi to off by default

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50-nv86,nv92/mc: rearm msi via pci config space, rather than mmio mirror
Ben Skeggs [Mon, 14 Oct 2013 04:58:16 +0000 (14:58 +1000)]
drm/nv50-nv86,nv92/mc: rearm msi via pci config space, rather than mmio mirror

This is what NVIDIA do on these chipsets, let's hope it works around
the reported MSI failures for us on NV86.

v2: updated to include G92, as per information provided by NVIDIA.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nvc0,nvc4/mc: handle 0xc0's "special" msi rearm
Ben Skeggs [Fri, 11 Oct 2013 05:38:15 +0000 (15:38 +1000)]
drm/nvc0,nvc4/mc: handle 0xc0's "special" msi rearm

v2. updated to cover GF104, as per information provided by NVIDIA.

Reported-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/mc: store static data in nouveau_mc class definition
Ben Skeggs [Fri, 11 Oct 2013 05:34:08 +0000 (15:34 +1000)]
drm/nouveau/mc: store static data in nouveau_mc class definition

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/mc: fetch NV_PMC_INTR again after re-arming MSI
Ben Skeggs [Fri, 11 Oct 2013 04:56:39 +0000 (14:56 +1000)]
drm/nouveau/mc: fetch NV_PMC_INTR again after re-arming MSI

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/mc: bracket interrupt handler with NV_PMC_INTR_EN disable/re-enable
Ben Skeggs [Fri, 11 Oct 2013 04:42:47 +0000 (14:42 +1000)]
drm/nouveau/mc: bracket interrupt handler with NV_PMC_INTR_EN disable/re-enable

This looks to be what NVIDIA do pretty much everywhere, since forever.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/mc: have single entry and exit points to the interrupt handler
Ben Skeggs [Fri, 11 Oct 2013 04:41:27 +0000 (14:41 +1000)]
drm/nouveau/mc: have single entry and exit points to the interrupt handler

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/mc: msi rearm write via subdev, not device
Ben Skeggs [Fri, 11 Oct 2013 04:28:04 +0000 (14:28 +1000)]
drm/nouveau/mc: msi rearm write via subdev, not device

This way we can catch it with debugging on for PMC subdev.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/device: use an additional bit from NV_PMC_BOOT_0 to identify chipset
Ben Skeggs [Fri, 27 Sep 2013 21:31:07 +0000 (07:31 +1000)]
drm/nouveau/device: use an additional bit from NV_PMC_BOOT_0 to identify chipset

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/bios/init: return failure condition on invalid opcodes
Ben Skeggs [Tue, 10 Sep 2013 02:42:25 +0000 (12:42 +1000)]
drm/nouveau/bios/init: return failure condition on invalid opcodes

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv31/mpeg: remove need for separate refcnt on engine use
Ben Skeggs [Mon, 9 Sep 2013 05:26:07 +0000 (15:26 +1000)]
drm/nv31/mpeg: remove need for separate refcnt on engine use

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/therm: ack any pending IRQ at init
Martin Peres [Sun, 8 Sep 2013 22:43:27 +0000 (00:43 +0200)]
drm/nouveau/therm: ack any pending IRQ at init

This is safe because ptherm hasn't been configured yet and will be a
little further down the initialization path. Ptherm should be safe
regarding to runtime reconfiguration.

v2:
  - do not limit this patch to nv84-a3 and make it nv84+

v3:
  - move the ack to fini()
  - disable IRQs on fini()
  - silently ignore un-requested IRQs

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv31/mpeg: split the nv31 and nv40 dma setting implementations
Ilia Mirkin [Sun, 8 Sep 2013 01:04:12 +0000 (21:04 -0400)]
drm/nv31/mpeg: split the nv31 and nv40 dma setting implementations

NV31 has different config bits than NV40+ do. Also fix the DMA_IMAGE
VRAM-only setting to check the right bits.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv31/mpeg: store chan singleton in engine, use it for dispatch
Ilia Mirkin [Sun, 8 Sep 2013 01:04:11 +0000 (21:04 -0400)]
drm/nv31/mpeg: store chan singleton in engine, use it for dispatch

This makes nv31+ able to actually perform the nv_call, since previously
the inst was not available.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv40/mpeg: use the nv31-provided classes
Ilia Mirkin [Sun, 8 Sep 2013 01:04:10 +0000 (21:04 -0400)]
drm/nv40/mpeg: use the nv31-provided classes

Since nv40 only covers pre-nv44 now, it can use the nv31-provided
functions.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv44/mpeg: create a copy of the nv31/nv40 impls
Ilia Mirkin [Sun, 8 Sep 2013 01:04:09 +0000 (21:04 -0400)]
drm/nv44/mpeg: create a copy of the nv31/nv40 impls

The nv31/nv40 impls are actually fairly nv44-specific, since they assume
the presence of the instance register/context switching. Create a copy
before nv31/nv40 get fixed.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv31/mpeg: no need to set compat mode differently for nv44 gr
Ilia Mirkin [Sun, 8 Sep 2013 01:04:08 +0000 (21:04 -0400)]
drm/nv31/mpeg: no need to set compat mode differently for nv44 gr

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv10/kms: add plane support for nv10-nv40
Ilia Mirkin [Sun, 8 Sep 2013 00:33:43 +0000 (20:33 -0400)]
drm/nv10/kms: add plane support for nv10-nv40

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv10: fix chipset checks, mostly for the benefit of nv1a
Ilia Mirkin [Thu, 5 Sep 2013 08:45:03 +0000 (04:45 -0400)]
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>
11 years agodrm/nv10: introduce a new NV_11 card type
Ilia Mirkin [Thu, 5 Sep 2013 08:45:02 +0000 (04:45 -0400)]
drm/nv10: introduce a new NV_11 card type

NV11/17/1F/18 come after NV10/15/16/1A. In order to facilitate using
numerical comparisons, split up the two sets into different card types.

This change should be a no-op except that the relevant cards will see
NV11 printed instead of NV10 for the family.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: fix backlight mask on ppc powerbook
Ilia Mirkin [Thu, 5 Sep 2013 08:45:01 +0000 (04:45 -0400)]
drm/nouveau: fix backlight mask on ppc powerbook

This code was originally moved to using nv_mask by d31e078d84. This
should not have any actual effect since the mask isn't applied to the
value.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: remove prototype for non-existent nouveau_connector_bpp
Ilia Mirkin [Thu, 5 Sep 2013 08:45:00 +0000 (04:45 -0400)]
drm/nouveau: remove prototype for non-existent nouveau_connector_bpp

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/vic: rename PUNK1C1 to PVIC
Ben Skeggs [Wed, 21 Aug 2013 03:26:42 +0000 (13:26 +1000)]
drm/nouveau/vic: rename PUNK1C1 to PVIC

NVIDIA's name for what rnndb calls PVCOMP.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/therm: kill some over-zealous debugging
Ben Skeggs [Mon, 16 Sep 2013 22:22:01 +0000 (08:22 +1000)]
drm/nouveau/therm: kill some over-zealous debugging

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/core: split lock into list+exec and enable refcount locks
Ben Skeggs [Wed, 2 Oct 2013 23:59:16 +0000 (09:59 +1000)]
drm/nouveau/core: split lock into list+exec and enable refcount locks

This fixes a reported locking inversion when interacting with the DRM
core's vblank routines.

Reviewed-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/core: convert event handler apis to split create/enable semantics
Ben Skeggs [Wed, 2 Oct 2013 21:02:29 +0000 (07:02 +1000)]
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>
11 years agodrm/nv50-/sw: share engine/channel constructor between implementations
Ben Skeggs [Wed, 2 Oct 2013 21:42:41 +0000 (07:42 +1000)]
drm/nv50-/sw: share engine/channel constructor between implementations

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/sw: prepare for the sharing of constructors between implementations
Ben Skeggs [Wed, 2 Oct 2013 21:30:11 +0000 (07:30 +1000)]
drm/nouveau/sw: prepare for the sharing of constructors between implementations

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50-/sw: make vblank tracking data private to the implementations
Ben Skeggs [Wed, 2 Oct 2013 21:21:34 +0000 (07:21 +1000)]
drm/nv50-/sw: make vblank tracking data private to the implementations

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50-/sw: share engine/channel struct definitions between implementations
Ben Skeggs [Wed, 2 Oct 2013 21:17:02 +0000 (07:17 +1000)]
drm/nv50-/sw: share engine/channel struct definitions between implementations

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/core: Allow asymmetric nouveau_event_get/_put
Peter Hurley [Tue, 27 Aug 2013 20:12:57 +0000 (16:12 -0400)]
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>
11 years agodrm/nouveau/core: Move event index check from critical section
Peter Hurley [Tue, 27 Aug 2013 20:12:55 +0000 (16:12 -0400)]
drm/nouveau/core: Move event index check from critical section

The index_nr field is constant for the lifetime of the event, so
serialized access is unnecessary.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/core: Add priv field for event handlers
Peter Hurley [Tue, 27 Aug 2013 20:12:54 +0000 (16:12 -0400)]
drm/nouveau/core: Add priv field for event handlers

Provide private field for event handlers exclusive use.
Convert nouveau_fence_wait_uevent() and
nouveau_fence_wait_uevent_handler(); drop struct nouveau_fence_uevent.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: off by one in nouveau_drm_vblank_enable()
Dan Carpenter [Fri, 27 Sep 2013 20:17:14 +0000 (23:17 +0300)]
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>
11 years agodrm/nouveau: remove pointless assignment
Dave Jones [Tue, 17 Sep 2013 21:26:34 +0000 (17:26 -0400)]
drm/nouveau: remove pointless assignment

self-assignment of a variable doesn't make a lot of sense.

Signed-off-by: Dave Jones <davej@fedoraproject.org>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agoMerge branch 'ttm-next-3.13' of git://people.freedesktop.org/~thomash/linux into...
Dave Airlie [Thu, 7 Nov 2013 02:22:10 +0000 (12:22 +1000)]
Merge branch 'ttm-next-3.13' of git://people.freedesktop.org/~thomash/linux into drm-next

- A couple of fixes that never made it into fixes-3.12
- Make NO_EVICT bo's available for shrinkers when on delayed-delete list
- Allow retrying page-faults that need to wait for GPU.

* 'ttm-next-3.13' of git://people.freedesktop.org/~thomash/linux:
  drm/ttm: Fix memory type compatibility check
  drm/ttm: Fix ttm_bo_move_memcpy
  drm/ttm: Handle in-memory region copies
  drm/ttm: Make NO_EVICT bos available to shrinkers pending destruction
  drm/ttm: Allow vm fault retries

11 years agoMerge branch 'vmwgfx-next-3.13' of git://people.freedesktop.org/~thomash/linux into...
Dave Airlie [Thu, 7 Nov 2013 02:21:42 +0000 (12:21 +1000)]
Merge branch 'vmwgfx-next-3.13' of git://people.freedesktop.org/~thomash/linux into drm-next

Pull request for vmwgfx. Currently just the DMA address stuff.

* 'vmwgfx-next-3.13' of git://people.freedesktop.org/~thomash/linux:
  drm/vmwgfx: Use the linux DMA api to get valid device addresses of pages
  drm/ttm: Enable the dma page pool also for intel IOMMUs

11 years agodrm/i915/vlv: use per-pipe backlight controls v2
Jesse Barnes [Thu, 31 Oct 2013 16:55:50 +0000 (18:55 +0200)]
drm/i915/vlv: use per-pipe backlight controls v2

With the connector and pipe passed around, we can now set the backlight
on the right pipe on VLV/BYT.

v2: drop combination mode check for VLV (Jani)
    add save/restore code for VLV backlight regs (Jani)
    check for existing modulation freq when initializing backlight regs (Jani)

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67245
Tested-by: Joe Konno <joe.konno@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
11 years agodrm/i915: make backlight functions take a connector
Jesse Barnes [Thu, 31 Oct 2013 16:55:49 +0000 (18:55 +0200)]
drm/i915: make backlight functions take a connector

On VLV/BYT, backlight controls a per-pipe, so when adjusting the
backlight we need to pass the correct info.  So make the externally
visible backlight functions take a connector argument, which can be used
internally to figure out the pipe backlight to adjust.

v2: make connector pipe lookup check for NULL crtc (Jani)
    fixup connector check in ASLE code (Jani)
v3: make sure we take the mode config lock around lookups (Daniel)
v4: fix double unlock in panel_get_brightness (Daniel)
v5: push ASLE work into a work queue (Daniel)
v6: separate ASLE work to a prep patch, rebase (Jani)

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
11 years agodrm/i915: move opregion asle request handling to a work queue
Jani Nikula [Thu, 31 Oct 2013 16:55:48 +0000 (18:55 +0200)]
drm/i915: move opregion asle request handling to a work queue

Doing this has been long overdue anyway, but now we really need it in
preparation for per connector backlight handling.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
11 years agodrm/ttm: Fix memory type compatibility check
Thomas Hellstrom [Mon, 28 Oct 2013 09:02:19 +0000 (02:02 -0700)]
drm/ttm: Fix memory type compatibility check

Also check the busy placements before deciding to move a buffer object.
Failing to do this may result in a completely unneccessary move within a
single memory type.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Cc: stable@vger.kernel.org
11 years agodrm/ttm: Fix ttm_bo_move_memcpy
Thomas Hellstrom [Wed, 30 Oct 2013 10:29:50 +0000 (03:29 -0700)]
drm/ttm: Fix ttm_bo_move_memcpy

All error paths will want to keep the mm node, so handle this at the
function exit. This fixes an ioremap failure error path.
Also add some comments to make the function a bit easier to understand.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Cc: stable@vger.kernel.org
11 years agodrm/ttm: Handle in-memory region copies
Jakob Bornecrantz [Wed, 30 Oct 2013 09:46:56 +0000 (02:46 -0700)]
drm/ttm: Handle in-memory region copies

Fix the case where the ttm pointer may be NULL causing
a NULL pointer dereference.

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Thomas Hellström <thellstrom@vmware.com>
Cc: stable@vger.kernel.org
11 years agodrm/ttm: Make NO_EVICT bos available to shrinkers pending destruction
Thomas Hellstrom [Thu, 10 Oct 2013 18:09:03 +0000 (11:09 -0700)]
drm/ttm: Make NO_EVICT bos available to shrinkers pending destruction

NO_EVICT bos that are not idle when all references are dropped are put on
the delayed destroy list. However, since they are not on LRU lists, they
are not available to shrinkers at that point, and buffers on the delayed
destroy list are not checked very often for idle.

So when these buffers are put on the delayed destroy list, clear the
NO_EVICT flag and put them on the right LRU list. This way they are
immediately available for eviction or shrinkers and will not cause false
OOMS.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
11 years agodrm/ttm: Allow vm fault retries
Thomas Hellstrom [Wed, 9 Oct 2013 10:18:07 +0000 (03:18 -0700)]
drm/ttm: Allow vm fault retries

Make use of the FAULT_FLAG_ALLOW_RETRY flag to allow dropping the
mmap_sem while waiting for bo idle.

FAULT_FLAG_ALLOW_RETRY appears to be primarily designed for disk waits
but should work just as fine for GPU waits..

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
11 years agodrm/vmwgfx: Use the linux DMA api to get valid device addresses of pages
Thomas Hellstrom [Thu, 24 Oct 2013 08:49:26 +0000 (01:49 -0700)]
drm/vmwgfx: Use the linux DMA api to get valid device addresses of pages

The code handles three different cases:
1) physical page addresses. The ttm page array is used.
2) DMA subsystem addresses. A scatter-gather list is used.
3) Coherent pages. The ttm dma pool is used, together with the dma_ttm
array os dma_addr_t

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
11 years agodrm/ttm: Enable the dma page pool also for intel IOMMUs
Thomas Hellstrom [Thu, 24 Oct 2013 08:24:54 +0000 (01:24 -0700)]
drm/ttm: Enable the dma page pool also for intel IOMMUs

Used by the vmwgfx driver

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
11 years agodrm/i915/vlv: use PIPE_START_VBLANK interrupts on VLV
Jesse Barnes [Tue, 5 Nov 2013 23:48:01 +0000 (15:48 -0800)]
drm/i915/vlv: use PIPE_START_VBLANK interrupts on VLV

This fixes a mismatch between our vblank enable code and our IRQ
handler.  Also, since vblank start events come in before page flips
reliably, it also fixes the kms_flip plain-flip test on my BYT system.

Spotted-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
11 years agoqxl: add a connector property to denote hotplug should rescan modes.
Dave Airlie [Fri, 11 Oct 2013 01:05:00 +0000 (11:05 +1000)]
qxl: add a connector property to denote hotplug should rescan modes.

So GNOME userspace has an issue with when it rescans for modes on hotplug
events, if the monitor has no EDID it assumes that nothing has changed on
EDID as with real hw we'd never have new modes without a new EDID, and they
kind off rely on the behaviour now, however with virtual GPUs we would
like to rescan the modes and get a new preferred mode on hotplug events
to handle dynamic guest resizing (where you resize the host window and the
guest resizes with it).

This is a simple property we can make userspace watch for to trigger new
behaviour based on it, and can be used to replaced EDID hacks in virtual
drivers.

Acked-by: Marc-André Lureau <marcandre.lureau@gmail.com> (on irc)
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: delay minor destruction to drm_dev_free()
David Herrmann [Sun, 20 Oct 2013 16:55:45 +0000 (18:55 +0200)]
drm: delay minor destruction to drm_dev_free()

Instead of freeing minors in drm_dev_unregister(), we only unplug them and
delay the free to drm_dev_free(). Note that if drm_dev_register() has
never been called, minors are NULL and this has no effect.

This change is needed to allow early device unregistration. If we want to
call drm_dev_unregister() on live devices, we need to guarantee that
minors are still valid (but unplugged). This way, any open file can still
access file_priv->minor->dev to get the DRM device. However, the minor is
unplugged so no new users can occur.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: remove minor-id during unplug
David Herrmann [Sun, 20 Oct 2013 16:55:44 +0000 (18:55 +0200)]
drm: remove minor-id during unplug

Don't delay minor removal to drm_put_minor(). Otherwise, user-space can
still open the minor and cause the kernel to oops. Instead, remove the
minor during unplug so any new open() will fail to access this minor.

Note that open() and drm_unplug_minor() are both protected by the global
DRM mutex so we're fine.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: cleanup debugfs in drm_unplug_minor()
David Herrmann [Sun, 20 Oct 2013 16:55:43 +0000 (18:55 +0200)]
drm: cleanup debugfs in drm_unplug_minor()

There is no reason to delay debugfs-cleanup to drm_put_minor(). We should
forbid any access to debugfs files once the device is dead. Chances they
oops once a card was unplugged are very high, anyway.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>