platform/kernel/linux-exynos.git
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/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 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>
11 years agodrm: make drm_get_minor() static
David Herrmann [Sun, 20 Oct 2013 16:55:42 +0000 (18:55 +0200)]
drm: make drm_get_minor() static

drm_get_minor() is only used in one file. Make it static and add a
kernel-doc comment which documents the current semantics.

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

Allow passing NULL as minor to simplify DRM destruction paths. Also remove
the double-pointer reset as it is no longer needed. drm_put_minor() is
only called when the underlying object is destroyed. Hence, resetting
minors to NULL is not necessary.

As drm_put_minor() is no longer used by other DRM files, we can make it
static, too.

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

This protects drm_unplug_minor() against repeated calls so we can use it
in drm_put_minor(). This allows us to further simplify it in follow-ups as
we no longer do minor-destruction in both functions but only in
drm_unplug_minor().
Also add kernel-doc comments about what these calls do.

[airlied: fixup for changes to kdev stuff]
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: eliminate bit-copy restoration of crtc
Ilija Hadzic [Tue, 29 Oct 2013 15:09:46 +0000 (11:09 -0400)]
drm: eliminate bit-copy restoration of crtc

Bit-copying restoration of CRTC structure in failure-recovery
path of drm_crtc_helper_set_config function evokes a
subtle and rare, but very dangerous, corruption of
CRTC mutex structure.

Namely, if drm_crtc_helper_set_config takes the path under
'fail:' label *and* some other process has attempted to
grab the crtc mutex (and got blocked), restoring the CRTC
structure by bit-copying it will overwrite the CRTC mutex
state and the waiters list pointer within the mutex structure.
Consequently the blocked process will never be scheduled.

This patch fixes the issue by eliminating the bit-copy
restoration. The elimination is possible because previous
patches have cleaned up the resoration path so that only
the fields touched by the drm_crtc_helper_set_config function
are saved and restored if necessary.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: do not set crtc enabled field twice
Ilija Hadzic [Tue, 29 Oct 2013 15:09:45 +0000 (11:09 -0400)]
drm: do not set crtc enabled field twice

There is no need to set crtc->enabled field in
drm_crtc_helper_set_config. This is already done (and
properly restored in case of failure) in
drm_crtc_helper_set_mode that is called by
drm_crtc_helper_set_config. Doing it at only one
place makes restoration in case of failure easier.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: fix error recovery path in drm_crtc_helper_set_mode
Ilija Hadzic [Tue, 29 Oct 2013 15:09:44 +0000 (11:09 -0400)]
drm: fix error recovery path in drm_crtc_helper_set_mode

There is no need to save or restore hwmode field, because by
the time this function sets this field, it cannot fail any more.
However, we should save old enabled field because if
the function fails, we want to return with unchanged CRTC.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: restore crtc origin if mode_set_base fails
Ilija Hadzic [Tue, 29 Oct 2013 15:09:43 +0000 (11:09 -0400)]
drm: restore crtc origin if mode_set_base fails

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: eliminate old_fb from drm_crtc_helper_set_config
Ilija Hadzic [Tue, 29 Oct 2013 15:09:42 +0000 (11:09 -0400)]
drm: eliminate old_fb from drm_crtc_helper_set_config

Old framebuffer is stored in save_set.fb and it is
the same value that is later stored in old_fb.
This makes old_fb redundant so we can replace
it with save_set.fb.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: remove redundant if statement
Ilija Hadzic [Tue, 29 Oct 2013 15:09:41 +0000 (11:09 -0400)]
drm: remove redundant if statement

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: Compact booleans within struct drm_file
Chris Wilson [Tue, 29 Oct 2013 08:55:58 +0000 (08:55 +0000)]
drm: Compact booleans within struct drm_file

Replace the sparse array of booleans with a bitfield.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: Do not drop root privileges for a fancier younger process
Chris Wilson [Tue, 29 Oct 2013 08:55:57 +0000 (08:55 +0000)]
drm: Do not drop root privileges for a fancier younger process

When a second process opens the device and master transferrence is
complete, we walk the list of open devices and remove their
authentication. This also revokes our root privilege. Instead of simply
dropping the authentication, this patch reverts the authenticated state
back to its original value.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agonouveau: drop interrupt busy setting.
Dave Airlie [Wed, 6 Nov 2013 03:48:16 +0000 (13:48 +1000)]
nouveau: drop interrupt busy setting.

This causes problems with never going busy due to ptherm polling,
and after talking to Ben I can't see it being required.

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/sysfs: Remove stale comments about calling drm_sysfs_connector_add() multiple...
Ville Syrjälä [Mon, 4 Nov 2013 19:18:46 +0000 (21:18 +0200)]
drm/sysfs: Remove stale comments about calling drm_sysfs_connector_add() multiple times

drm_connector_sysfs_add() explicitly checks if connector->kdev
is already populated and returns success. So it clearly now allows
being called multiple times. Remove some stale comments to the contrary.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/radeon: fix radeon_fence_wait_empty_locked
Christian König [Tue, 5 Nov 2013 13:09:54 +0000 (14:09 +0100)]
drm/radeon: fix radeon_fence_wait_empty_locked

Don't block forever if there is nothing to wait for.

Signed-off-by: Christian König <christian.koenig@amd.com>
Tested-by: Rafa? Mi?ecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/qxl: add some surface memory logging
Gerd Hoffmann [Fri, 11 Oct 2013 08:01:11 +0000 (10:01 +0200)]
drm/qxl: add some surface memory logging

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/qxl: support 64bit surface bar
Gerd Hoffmann [Fri, 11 Oct 2013 08:01:10 +0000 (10:01 +0200)]
drm/qxl: support 64bit surface bar

qxl devices can have a 64bit surface bar, which is quite handy if
you need a bit more surface memory.  So try to use it if it is
present.  Note that this bar might be mapped above 4g.

QEMU command line to check that out:

    qemu-system-x86_64 -m 4g \
        -vga qxl -global qxl-vga.vram64_size_mb=512 \
        $otheroptions

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/cirrus: use drm_set_preferred_mode
Gerd Hoffmann [Fri, 11 Oct 2013 08:01:09 +0000 (10:01 +0200)]
drm/cirrus: use drm_set_preferred_mode

Explicitly set 1024x768 as default mode, so the display doesn't come up
with the largest supported mode.

While being at it drop first three drm_add_modes_noedid calls.  As
drm_add_modes_noedid fills the mode list with modes from the database
*up to* the specified size it is pretty pointless to call it multiple
times with different sizes.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: add drm_set_preferred_mode
Gerd Hoffmann [Fri, 11 Oct 2013 08:01:08 +0000 (10:01 +0200)]
drm: add drm_set_preferred_mode

New helper function to set the preferred video mode.  Can be called
after drm_add_modes_noedid if you don't want the largest supported
video mode be used by default.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: Pretty print pixel format in drm_fb_get_bpp_depth() and format_check()
Ville Syrjälä [Tue, 15 Oct 2013 18:06:51 +0000 (21:06 +0300)]
drm: Pretty print pixel format in drm_fb_get_bpp_depth() and format_check()

drm_fb_get_bpp_depth() likes to complain about unsupported pixel formats
but doesn't bother telling us what the format was. Also format_check()
just returns an error when it encouters an invalid format, leaving the
user scratching his head trying to figure out why addfb failed. Make
life a bit easier by using drm_get_format_name() in both places.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/edid: Yank a helpful comment about EST modes from xf86EdidModes.c
Ville Syrjälä [Mon, 14 Oct 2013 13:44:27 +0000 (16:44 +0300)]
drm/edid: Yank a helpful comment about EST modes from xf86EdidModes.c

I got very confused when I tried to compare the EST modes with the spec.
Bring over a comment from xf86EdidModes.c that actually describes some
of history where these things came from.

Signed-off-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>
11 years agodrm/edid: Don't skip every eighth EST III mode
Ville Syrjälä [Mon, 14 Oct 2013 13:44:26 +0000 (16:44 +0300)]
drm/edid: Don't skip every eighth EST III mode

Also check the est3 modes whose presence is indicated by bit 0.

Signed-off-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>
11 years agodrm/edid: Fix the 1792x1344-75 EST III mode
Ville Syrjälä [Mon, 14 Oct 2013 13:44:25 +0000 (16:44 +0300)]
drm/edid: Fix the 1792x1344-75 EST III mode

The correct refresh rate for this mode is 75, not 85.

Signed-off-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>
11 years agodrm/vmwgfx: Return -ENOENT when a framebuffer can't be found
Ville Syrjälä [Thu, 17 Oct 2013 10:35:06 +0000 (13:35 +0300)]
drm/vmwgfx: Return -ENOENT when a framebuffer can't be found

Let's be a bit more consistent with our error values.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/vmwgfx: Return -ENOENT when a mode object can't be found
Ville Syrjälä [Thu, 17 Oct 2013 10:35:05 +0000 (13:35 +0300)]
drm/vmwgfx: Return -ENOENT when a mode object can't be found

Let's be a bit more consistent with our error values.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/radeon: Return -ENOENT when a mode object can't be found
Ville Syrjälä [Thu, 17 Oct 2013 10:35:04 +0000 (13:35 +0300)]
drm/radeon: Return -ENOENT when a mode object can't be found

Let's be a bit more consistent with our error values.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/i915: Return -ENOENT when a mode object can't be found
Ville Syrjälä [Thu, 17 Oct 2013 10:35:03 +0000 (13:35 +0300)]
drm/i915: Return -ENOENT when a mode object can't be found

Let's be a bit more consistent with our error values.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/gma500: Return -ENOENT when a mode object can't be found
Ville Syrjälä [Thu, 17 Oct 2013 10:35:02 +0000 (13:35 +0300)]
drm/gma500: Return -ENOENT when a mode object can't be found

Let's be a bit more consistent with our error values.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: Return -ENOENT when a framebuffer can't be found
Ville Syrjälä [Thu, 17 Oct 2013 10:35:01 +0000 (13:35 +0300)]
drm: Return -ENOENT when a framebuffer can't be found

Return -ENOENT for framebuffers like we do for other mode objects that
can't be found.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>