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
...
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>
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>
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>
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.
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>
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>
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
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
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
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
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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>