]> git.kernelconcepts.de Git - karo-tx-linux.git/log
karo-tx-linux.git
7 years agodrm/nouveau/gr/gf100-: handle GPC/TPC/MPC trap
Ben Skeggs [Sat, 10 Dec 2016 06:42:50 +0000 (16:42 +1000)]
drm/nouveau/gr/gf100-: handle GPC/TPC/MPC trap

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core: recognise GP106 chipset
Ben Skeggs [Fri, 9 Dec 2016 00:24:14 +0000 (10:24 +1000)]
drm/nouveau/core: recognise GP106 chipset

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/ttm: wait for bo fence to signal before unmapping vmas
Ben Skeggs [Mon, 12 Dec 2016 07:52:45 +0000 (17:52 +1000)]
drm/nouveau/ttm: wait for bo fence to signal before unmapping vmas

TTM was changed a while back to allow for pipelining of buffer moves, and
part of this was the removal of waiting for a BO to idle before calling
move(), placing the responsibility on the driver to do this if required.

That's all well and good, except, we make use of move_notify() to handle
mapping/unmapping from the GPU VMM as move() isn't called on all paths.

This commit adds a wait before unmapping from a VMM in move_notify(), to
prevent GPU page faults where a buffer is still being accessed.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Cc: stable@vger.kernel.org [v4.8+]
7 years agodrm/nouveau/gr/gf100-: FECS intr handling is not relevant on proprietary ucode
Ben Skeggs [Fri, 9 Dec 2016 08:50:23 +0000 (18:50 +1000)]
drm/nouveau/gr/gf100-: FECS intr handling is not relevant on proprietary ucode

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/gr/gf100-: properly ack all FECS error interrupts
Ben Skeggs [Fri, 9 Dec 2016 08:02:17 +0000 (18:02 +1000)]
drm/nouveau/gr/gf100-: properly ack all FECS error interrupts

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fifo/gf100-: recover from host mmu faults
Ben Skeggs [Fri, 9 Dec 2016 07:13:08 +0000 (17:13 +1000)]
drm/nouveau/fifo/gf100-: recover from host mmu faults

This has been on the TODO list for a while now, recovering from things
such as attempting to execute a push buffer or touch a semaphore in an
unmapped memory area.

The only thing required on the HW side here is that the offending
channel is removed from the runlist, and *not* a full reset of PFIFO.

This used to be a bit messier to handle before the rework to make use
of engine topology info, but is apparently now trivial.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/mxm: warn more loudly on unsupported DCB version
Ben Skeggs [Mon, 5 Dec 2016 23:03:59 +0000 (09:03 +1000)]
drm/nouveau/mxm: warn more loudly on unsupported DCB version

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/mxm: handle DCB 4.1 modification
Ben Skeggs [Mon, 5 Dec 2016 23:03:04 +0000 (09:03 +1000)]
drm/nouveau/mxm: handle DCB 4.1 modification

Allows MXM DCB modification to be handled on GM20x and newer boards.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/bios/mxm: handle digital connector table 1.1
Ben Skeggs [Mon, 5 Dec 2016 22:59:31 +0000 (08:59 +1000)]
drm/nouveau/bios/mxm: handle digital connector table 1.1

I suspect the version bump is just to signify that the table now specifies
pad macro/links instead of SOR/sublinks.

For our usage of the table, just recognising the new version is enough.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: Queue hpd_work on (runtime) resume
Hans de Goede [Mon, 21 Nov 2016 16:50:55 +0000 (17:50 +0100)]
drm/nouveau: Queue hpd_work on (runtime) resume

We need to call drm_helper_hpd_irq_event() on resume to properly detect
monitor connection / disconnection on some laptops, use hpd_work for
this to avoid deadlocks.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: Rename acpi_work to hpd_work
Hans de Goede [Mon, 21 Nov 2016 16:50:54 +0000 (17:50 +0100)]
drm/nouveau: Rename acpi_work to hpd_work

We need to call drm_helper_hpd_irq_event() on resume to properly detect
monitor connection / disconnection on some laptops. For runtime-resume
(which gets called on resume from normal suspend too) we must call
drm_helper_hpd_irq_event() from a workqueue to avoid a deadlock.

Rename acpi_work to hpd_work, and move it out of the #ifdef CONFIG_ACPI
blocks to make it suitable for generic work.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: Fix atomic pageflip events.
Mario Kleiner [Wed, 23 Nov 2016 06:58:54 +0000 (07:58 +0100)]
drm/nouveau/kms/nv50: Fix atomic pageflip events.

The new atomic modesetting/pageflip code for nv50+ for
Linux 4.10+ no longer uses pageflip irq's to signal
flip completion. Instead it polls for flip completion
from within a kthread/work queue.

This creates a race between the vblank irq handler
updating the vblank count and timestamp for the
vblank of flip completion, and the kthread's
polling code detecting flip completion and sending
out the flip completion event.

Depending on who executes a few microseconds earlier,
the flip completion event will either contain correct
count/timestamp or a stale count/timestamp from the
previous vblank. This error was observed for about
50% of all executed flips, e.g., observable under DRI2
by the Xorg.log filling with flip handler warning
messages.

Call drm_accurate_vblank_count() before sending
out flip completion events to enforce a vblank
count/ts update for the vblank of flip completion
and avoid stale counts/timestamps.

This fix leads to one redundant call to drm_update_vblank_count
for each completed flip, but no other side effects. On
a ~6 year old Core i7 M620@ 2.67GHz the redundant call
costs about 10 usecs per flip

Successfully tested on GeForce 9500/9600/330M so far.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fb/ram/gp100-: fix memory detection where FBP_NUM != FBPA_NUM
Ben Skeggs [Mon, 21 Nov 2016 01:01:33 +0000 (11:01 +1000)]
drm/nouveau/fb/ram/gp100-: fix memory detection where FBP_NUM != FBPA_NUM

In this situation, we'd have ended up detecting less VRAM than we have.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/bios/volt: pointers are 32-bit
Ben Skeggs [Fri, 18 Nov 2016 01:18:45 +0000 (11:18 +1000)]
drm/nouveau/bios/volt: pointers are 32-bit

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/bios/vmap: pointers are 32-bit
Ben Skeggs [Fri, 18 Nov 2016 01:22:33 +0000 (11:22 +1000)]
drm/nouveau/bios/vmap: pointers are 32-bit

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/bios/timing: pointers are 32-bit
Ben Skeggs [Fri, 18 Nov 2016 01:16:49 +0000 (11:16 +1000)]
drm/nouveau/bios/timing: pointers are 32-bit

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/bios/therm: pointers are 32-bit
Ben Skeggs [Fri, 18 Nov 2016 01:20:32 +0000 (11:20 +1000)]
drm/nouveau/bios/therm: pointers are 32-bit

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/bios/perf: pointers are 32-bit
Ben Skeggs [Fri, 18 Nov 2016 01:14:23 +0000 (11:14 +1000)]
drm/nouveau/bios/perf: pointers are 32-bit

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/bios/iccsense: pointers are 32-bit
Ben Skeggs [Fri, 18 Nov 2016 01:31:27 +0000 (11:31 +1000)]
drm/nouveau/bios/iccsense: pointers are 32-bit

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/bios/fan: pointers are 32-bit
Ben Skeggs [Fri, 18 Nov 2016 01:30:20 +0000 (11:30 +1000)]
drm/nouveau/bios/fan: pointers are 32-bit

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/bios/cstep: pointers are 32-bit
Ben Skeggs [Fri, 18 Nov 2016 01:28:42 +0000 (11:28 +1000)]
drm/nouveau/bios/cstep: pointers are 32-bit

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/bios/boost: pointers are 32-bit
Ben Skeggs [Fri, 18 Nov 2016 01:24:35 +0000 (11:24 +1000)]
drm/nouveau/bios/boost: pointers are 32-bit

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/disp/gp102: rename from gp104
Ben Skeggs [Wed, 16 Nov 2016 05:03:07 +0000 (15:03 +1000)]
drm/nouveau/disp/gp102: rename from gp104

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/ce/gp102: rename from gp104
Ben Skeggs [Wed, 16 Nov 2016 05:01:37 +0000 (15:01 +1000)]
drm/nouveau/ce/gp102: rename from gp104

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fb/gp102: rename from gp104
Ben Skeggs [Wed, 16 Nov 2016 04:59:49 +0000 (14:59 +1000)]
drm/nouveau/fb/gp102: rename from gp104

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/disp/gp102: fix cursor/overlay immediate channel indices
Ben Skeggs [Wed, 16 Nov 2016 04:53:08 +0000 (14:53 +1000)]
drm/nouveau/disp/gp102: fix cursor/overlay immediate channel indices

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/disp/nv50-: specify ctrl/user separately when constructing classes
Ben Skeggs [Wed, 16 Nov 2016 04:49:35 +0000 (14:49 +1000)]
drm/nouveau/disp/nv50-: specify ctrl/user separately when constructing classes

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/disp/nv50-: split chid into chid.ctrl and chid.user
Ben Skeggs [Wed, 16 Nov 2016 04:38:44 +0000 (14:38 +1000)]
drm/nouveau/disp/nv50-: split chid into chid.ctrl and chid.user

GP102/GP104 make life difficult by redefining the channel indices for
some registers, but not others.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: Intercept ACPI_VIDEO_NOTIFY_PROBE
Hans de Goede [Wed, 9 Nov 2016 17:17:44 +0000 (18:17 +0100)]
drm/nouveau: Intercept ACPI_VIDEO_NOTIFY_PROBE

Various notebooks with nvidia GPUs generate an ACPI_VIDEO_NOTIFY_PROBE
acpi-video event when an external device gets plugged in (and again on
modesets on that connector), the default behavior in the acpi-video
driver for this is to send a KEY_SWITCHVIDEOMODE evdev event, which
causes e.g. gnome-settings-daemon to ask us to rescan the connectors
(good), but also causes g-s-d to switch to mirror mode on a newly plugged
monitor rather then using the monitor to extend the desktop (bad)
as KEY_SWITCHVIDEOMODE is supposed to switch between extend the desktop
vs mirror mode.

More troublesome are the repeated ACPI_VIDEO_NOTIFY_PROBE events on
changing the mode on the connector, which cause g-s-d to switch
between mirror/extend mode, which causes a new ACPI_VIDEO_NOTIFY_PROBE
event and we end up with an endless loop.

This commit fixes this by adding an acpi notifier block handler to
nouveau_display.c to intercept ACPI_VIDEO_NOTIFY_PROBE and:

1) Wake-up runtime suspended GPUs and call drm_helper_hpd_irq_event()
   on them, this is necessary in some cases for the GPU to detect connector
   hotplug events while runtime suspended
2) Return NOTIFY_BAD to stop acpi-video from emitting a bogus
   KEY_SWITCHVIDEOMODE key-press event

There already is another acpi notifier block handler registered in
drivers/gpu/drm/nouveau/nvkm/engine/device/acpi.c, but that is not
suitable since that one gets unregistered on runtime suspend, and
we also want to intercept ACPI_VIDEO_NOTIFY_PROBE when runtime suspended.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
7 years agodrm/nouveau/devinit/gm200: drop pmu reset sequence
Ben Skeggs [Wed, 9 Nov 2016 00:42:47 +0000 (10:42 +1000)]
drm/nouveau/devinit/gm200: drop pmu reset sequence

This sequence is incorrect for GP102/GP104 boards.  This is now being
handled correctly by the PMU subdev during preinit();

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/devinit/gm200: replace while loops with PTIMER-based timeout loops
Ben Skeggs [Tue, 8 Nov 2016 01:54:24 +0000 (11:54 +1000)]
drm/nouveau/devinit/gm200: replace while loops with PTIMER-based timeout loops

It appears to be safe to access PTIMER on an unposted board with newer
chipsets.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pmu/gp102: initial implementation
Ben Skeggs [Wed, 9 Nov 2016 00:41:43 +0000 (10:41 +1000)]
drm/nouveau/pmu/gp102: initial implementation

GP102/GP104 require a harder reset of PMU prior to DEVINIT, or the IFR
image will hang.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pmu/gp100: initial implementation
Ben Skeggs [Wed, 9 Nov 2016 00:37:56 +0000 (10:37 +1000)]
drm/nouveau/pmu/gp100: initial implementation

Just enough to hookup preinit reset(), which DEVINIT will depend on later.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pmu: execute reset before running devinit
Ben Skeggs [Wed, 9 Nov 2016 00:39:08 +0000 (10:39 +1000)]
drm/nouveau/pmu: execute reset before running devinit

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pmu: move ucode handling into gt215 implementation
Ben Skeggs [Wed, 9 Nov 2016 00:23:55 +0000 (10:23 +1000)]
drm/nouveau/pmu: move ucode handling into gt215 implementation

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core: initial support for GP102
Ben Skeggs [Mon, 7 Nov 2016 07:38:43 +0000 (17:38 +1000)]
drm/nouveau/core: initial support for GP102

From visual inspection of traces, what we currently implement appears to
be identical to GP104.  Seems to work well enough too.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/device/pci: fix oops if no mmu subdev present
Ben Skeggs [Mon, 7 Nov 2016 23:43:50 +0000 (09:43 +1000)]
drm/nouveau/device/pci: fix oops if no mmu subdev present

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: avoid touching DP_MSTM_CTRL if !DP_MST_CAP
Ben Skeggs [Mon, 7 Nov 2016 04:51:53 +0000 (14:51 +1000)]
drm/nouveau/kms/nv50: avoid touching DP_MSTM_CTRL if !DP_MST_CAP

Fixes certain displays not being detected due to DPAUX errors.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fifo/gf100-: protect channel preempt with subdev mutex
Ben Skeggs [Sat, 5 Nov 2016 04:33:14 +0000 (14:33 +1000)]
drm/nouveau/fifo/gf100-: protect channel preempt with subdev mutex

This avoids an issue that occurs when we're attempting to preempt multiple
channels simultaneously.  HW seems to ignore preempt requests while it's
still processing a previous one, which, well, makes sense.

Fixes random "fifo: SCHED_ERROR 0d []" + GPCCS page faults during parallel
piglit runs on (at least) GM107.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Cc: stable@vger.kernel.org
7 years agodrm/nouveau/gr: fallback to legacy paths during firmware lookup
Alexandre Courbot [Fri, 4 Nov 2016 09:36:17 +0000 (18:36 +0900)]
drm/nouveau/gr: fallback to legacy paths during firmware lookup

Look for firmware files using the legacy ("nouveau/nvxx_fucxxxx") path
if they cannot be found in the new, "official" path. User setups were
broken by the switch, which is bad.

There are only 4 firmware files we may want to look up that way, so
hardcode them into the lookup function. All new firmware files should
use the standard "nvidia/<chip>/gr/" path.

Fixes: 8539b37acef7 ("drm/nouveau/gr: use NVIDIA-provided external firmwares")
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Cc: stable@vger.kernel.org
7 years agodrm/nouveau/kms/nv50: initial support for DP 1.2 multi-stream
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: initial support for DP 1.2 multi-stream

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: allow encoder update to be called from other modules
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: allow encoder update to be called from other modules

MST encoders will make use of this to share code with SOR>

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: rename remaining nv50_crtc to nv50_head
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: rename remaining nv50_crtc to nv50_head

No code changes, just renames + shuffles.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: remove code to create ctxdma for every framebuffer
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: remove code to create ctxdma for every framebuffer

This is now handled by prepare_fb().  Legacy flips were the last user.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: remove code to support non-atomic page flips
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: remove code to support non-atomic page flips

Made completely unreachable (and broken) by atomic commits.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: remove code to support non-atomic connector properties
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: remove code to support non-atomic connector properties

Made completely unreachable by atomic commits.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: remove code to support non-atomic dpms
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: remove code to support non-atomic dpms

Made completely unreachable (and broken) by atomic commits.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: remove code to support non-atomic modesets
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: remove code to support non-atomic modesets

Make completely unreachable (and broken) by atomic commits.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: transition to atomic interfaces internally
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: transition to atomic interfaces internally

This commit implements the atomic commit interfaces, and implements the
legacy modeset and page flipping interfaces on top of them.

There's two major changes in behavior from before:

- We're now making use of interlocks between core and satellite EVO
  channels, which greatly improves our ability to keep their states
  synchronised.
- DPMS is now implemented as a full modeset to either tear down the
  entire pipe (or bring it back up).  This choice was made mostly
  to ease the initial implementation, but I'm also not sure what we
  gain by bring backing the old behaviour.  We shall see.

This does NOT currently expose the atomic ioctl by default, due to
limited testing having been performed.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: turn mode_set_base_atomic() into a stub
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: turn mode_set_base_atomic() into a stub

This cannot currently be supported with atomic modesettting.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: convert encoder mode_fixup into an atomic_check()
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: convert encoder mode_fixup into an atomic_check()

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: clean-up encoder functions
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: clean-up encoder functions

Just a shuffle of blocks into an order consistent with the rest of the
code, renaming hdmi/audio funtions for atomic, and removal of unused
code.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: ensure encoder normal power state is enabled at startup
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: ensure encoder normal power state is enabled at startup

To handle low-power DPMS states, we currently change an OR's (Output
Resource) normal (active) power state to be off, leaving the rest of
the display configured as usual.

Under atomic modesetting, we will instead be doing a full modeset to
tear down the pipe fully when entering a low-power state.

As we'll no longer be touching the OR's PWR registers during runtime
operation, we need to ensure the normal power state is set correctly
during initialisation.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: prepare ctxdma interface to be usable with atomic
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: prepare ctxdma interface to be usable with atomic

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: separate out cursor channel commit
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: separate out cursor channel commit

This commit separates the calculation of EVO state from the commit, in
order to make the same code useful for atomic modesetting.

The legacy interfaces have been wrapped on top of them.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: separate out base channel commit
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: separate out base channel commit

This commit separates the calculation of EVO state from the commit, in
order to make the same code useful for atomic modesetting.

The legacy interfaces have been wrapped on top of them.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: separate out vblank dmi commit
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: separate out vblank dmi commit

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: separate out procamp commit
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: separate out procamp commit

This commit separates the calculation of EVO state from the commit, in
order to make the same code useful for atomic modesetting.

The legacy interfaces have been wrapped on top of them.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: separate out dither commit
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: separate out dither commit

This commit separates the calculation of EVO state from the commit, in
order to make the same code useful for atomic modesetting.

The legacy interfaces have been wrapped on top of them.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: separate out viewport commit
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: separate out viewport commit

This commit separates the calculation of EVO state from the commit, in
order to make the same code useful for atomic modesetting.

The legacy interfaces have been wrapped on top of them.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: separate out base/ovly channel usage bounds commit
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: separate out base/ovly channel usage bounds commit

This commit separates the calculation of EVO state from the commit, in
order to make the same code useful for atomic modesetting.

The legacy interfaces have been wrapped on top of them.

We're no longer touching the overlay channel usage bounds as of this
commit.  The code to do so is in place for when overlay planes are
added.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: separate out cursor surface commit
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: separate out cursor surface commit

This commit separates the calculation of EVO state from the commit, in
order to make the same code useful for atomic modesetting.

The legacy interfaces have been wrapped on top of them.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: separate out lut commit
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: separate out lut commit

This commit separates the calculation of EVO state from the commit, in
order to make the same code useful for atomic modesetting.

The legacy interfaces have been wrapped on top of them.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: separate out core surface commit
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: separate out core surface commit

This commit separates the calculation of EVO state from the commit, in
order to make the same code useful for atomic modesetting.

The legacy interfaces have been wrapped on top of them.

As of this commit, we're no longer bothering to point the core surface
at a valid framebuffer.  Prior to this, we'd initially point the core
channel to the framebuffer passed in a mode_set()/mode_set_base(), and
then use the base channel for any page-flip updates, leaving the core
channel pointing at stale information.

The important thing here is to configure the core surface parameters in
such a way that EVO's error checking is satisfied.

TL;DR: The situation isn't too much different to before.

There may be brief periods of times during modesets where the (garbage)
core surface will be showing.  This issue will be resolved once support
for atomic commits has been implemented and we're able to interlock the
updates that involve multiple channels.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: separate out mode commit
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: separate out mode commit

This commit separates the calculation of EVO state from the commit, in
order to make the same code useful for atomic modesetting.

The legacy interfaces have been wrapped on top of them.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: give more useful names to encoders
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: give more useful names to encoders

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: control evo trace output with DRM_UT_KMS
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: control evo trace output with DRM_UT_KMS

Will be useful in debugging the transition to atomic.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms/nv50: switch mst sink back into sst mode
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50: switch mst sink back into sst mode

Sometimes we load with a sink already in MST mode.  If, however, we can't
or don't want to use MST, we need to be able to switch it back to SST.

This commit instantiates a stub topology manager for any output path that
we believe (the detection of this could use some improvement) has support
for MST, and adds the connector detect() logic for detecting sink support
and switching between modes.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms: never call drm_helper_disable_unused_functions() with atomic
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms: never call drm_helper_disable_unused_functions() with atomic

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms: prepare to support suspend/resume of display state with atomic
Ben Skeggs [Fri, 4 Nov 2016 07:20:36 +0000 (17:20 +1000)]
drm/nouveau/kms: prepare to support suspend/resume of display state with atomic

This is different from the equivilant functions in the atomic helpers in
that we fully disable the pipe instead of just setting it to inactive.

We do this (primarily) to ensure the framebuffer cleanup paths are hit,
allowing buffers to be un-pinned from memory so they can be evicted to
system memory and not lose their contents while suspended.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms: prepare to support vbl timestamp calculation with atomic
Ben Skeggs [Fri, 4 Nov 2016 07:20:35 +0000 (17:20 +1000)]
drm/nouveau/kms: prepare to support vbl timestamp calculation with atomic

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms: prepare to support legacy connector set_property with atomic
Ben Skeggs [Fri, 4 Nov 2016 07:20:35 +0000 (17:20 +1000)]
drm/nouveau/kms: prepare to support legacy connector set_property with atomic

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms: prepare to support legacy connector dpms with atomic
Ben Skeggs [Fri, 4 Nov 2016 07:20:35 +0000 (17:20 +1000)]
drm/nouveau/kms: prepare to support legacy connector dpms with atomic

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms: separate connector property attach from nouveau_connector
Ben Skeggs [Fri, 4 Nov 2016 07:20:35 +0000 (17:20 +1000)]
drm/nouveau/kms: separate connector property attach from nouveau_connector

These will also be used by MST connectors.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms: subclass atomic connector state
Ben Skeggs [Fri, 4 Nov 2016 07:20:35 +0000 (17:20 +1000)]
drm/nouveau/kms: subclass atomic connector state

This commit implements the atomic property hooks for a connector, and
wraps the legacy interface handling on top of those.

For the moment, a full modeset will be done after any property change
in order to ease subsequent changes.  The optimised behaviour will be
restored for Tesla and later (earlier boards always do full modesets)
once atomic commits are implemented.

Some functions are put under the "nouveau_conn" namespace now, rather
than "nouveau_connector", to distinguish functions that will work for
(upcoming) MST connectors too.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms: execute drm_mode_config_reset() after constructing display
Ben Skeggs [Fri, 4 Nov 2016 07:20:35 +0000 (17:20 +1000)]
drm/nouveau/kms: execute drm_mode_config_reset() after constructing display

This will ensure we have some kind of initial atomic state for all objects
after initialisation.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms: move drm_crtc_force_disable_all() earlier
Ben Skeggs [Fri, 4 Nov 2016 07:20:35 +0000 (17:20 +1000)]
drm/nouveau/kms: move drm_crtc_force_disable_all() earlier

nouveau_display_fini() is responsible for quiescing the hardware, so
this is where such actions belong.

More than that, nouveau_display_fini() switches off the receiving of
sink irqs, which MST will require while shutting down an active head.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms: drop dpms off/on in response to hotplug
Ben Skeggs [Fri, 4 Nov 2016 07:20:35 +0000 (17:20 +1000)]
drm/nouveau/kms: drop dpms off/on in response to hotplug

This primarily existed to ensure the DP link got retrained, and is
now unnecessary as that's handled by NVKM already.

For anything beyond that, we send an event to userspace and let it
decide on an appropriate action to take.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fbcon: refcount the drm_framebuffer
Ben Skeggs [Fri, 4 Nov 2016 07:20:35 +0000 (17:20 +1000)]
drm/nouveau/fbcon: refcount the drm_framebuffer

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fbcon: make use of drm_fb_helper.fb
Ben Skeggs [Fri, 4 Nov 2016 07:20:35 +0000 (17:20 +1000)]
drm/nouveau/fbcon: make use of drm_fb_helper.fb

Transitional step towards properly refcounting the fbcon fb.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fbcon: make use of drm_fb_helper.dev
Ben Skeggs [Fri, 4 Nov 2016 07:20:35 +0000 (17:20 +1000)]
drm/nouveau/fbcon: make use of drm_fb_helper.dev

No need to store the pointer ourselves when it's already present in
the base struct.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/disp/g94-: stop listening for dp (sst) retrain irq when disabling link
Ben Skeggs [Fri, 4 Nov 2016 07:20:35 +0000 (17:20 +1000)]
drm/nouveau/disp/g94-: stop listening for dp (sst) retrain irq when disabling link

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/disp/sor/gf119-: add method to program mst payload information
Ben Skeggs [Fri, 4 Nov 2016 07:20:35 +0000 (17:20 +1000)]
drm/nouveau/disp/sor/gf119-: add method to program mst payload information

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/disp/sor/gf119-: add method to control mst enable
Ben Skeggs [Fri, 4 Nov 2016 07:20:35 +0000 (17:20 +1000)]
drm/nouveau/disp/sor/gf119-: add method to control mst enable

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/disp/dp: remove workqueue for link training
Ben Skeggs [Fri, 4 Nov 2016 07:20:35 +0000 (17:20 +1000)]
drm/nouveau/disp/dp: remove workqueue for link training

There haven't been any callers from an atomic context for a while now,
so let's remove the extra complexity.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/nvif: helper to match against supported class list
Ben Skeggs [Fri, 4 Nov 2016 07:20:35 +0000 (17:20 +1000)]
drm/nouveau/nvif: helper to match against supported class list

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: silence sparse warnings about symbols not being marked static
Ben Skeggs [Fri, 4 Nov 2016 01:44:21 +0000 (11:44 +1000)]
drm/nouveau: silence sparse warnings about symbols not being marked static

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/tegra: Fix error handling
Christophe JAILLET [Mon, 31 Oct 2016 06:35:50 +0000 (07:35 +0100)]
drm/nouveau/tegra: Fix error handling

'iommu_domain_alloc()' returns NULL in case of error, not an error pointer.
So test it accordingly.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fb: add gm20b device
Alexandre Courbot [Thu, 27 Oct 2016 07:55:54 +0000 (16:55 +0900)]
drm/nouveau/fb: add gm20b device

gm20b's FB has the same capabilities as gm200, minus the ability to
allocate RAM. Create a device that reflects this instead of re-using the
gk20a device which may be incorrect.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-By: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fb/gk20a: use regular gf100's functions
Alexandre Courbot [Thu, 27 Oct 2016 07:55:53 +0000 (16:55 +0900)]
drm/nouveau/fb/gk20a: use regular gf100's functions

gk20a's FB is not special compared to other Kepler chips, besides the
fact it does not have VRAM. Use the regular gf100 hooks instead of the
incomplete versions we rewrote.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-By: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fb/gk20a: fix constructor call
Alexandre Courbot [Thu, 27 Oct 2016 07:55:52 +0000 (16:55 +0900)]
drm/nouveau/fb/gk20a: fix constructor call

The gf100 constructor should be called, otherwise we will allocate a
smaller object than expected. This was without effect so far because
gk20a did not allocate a page, but with gf100's page allocation moved
to the oneinit() hook this problem has become apparent.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pmu: remove reset() hook
Alexandre Courbot [Thu, 27 Oct 2016 03:48:51 +0000 (12:48 +0900)]
drm/nouveau/pmu: remove reset() hook

The reset hook of pmu_func is never called, and gt215 was the only chip
to implement. Remove this dead code.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: fix notify data leak
Lucas Stach [Wed, 26 Oct 2016 11:11:06 +0000 (13:11 +0200)]
drm/nouveau: fix notify data leak

There is no reason to not free the notify data if the NTFY_DEL ioctl
failed. As nvif_notify_fini() is also called from the cleanup path of
nvif_notify_init(), the notifier may not have been successfully created
at that point. But it should also be the right thing to just free the
data in the regular fini calls, as there is nothing much we can do if
the ioctl fails, so better not leak memory.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: fix nv84 fence context leak
Lucas Stach [Tue, 25 Oct 2016 19:55:12 +0000 (21:55 +0200)]
drm/nouveau: fix nv84 fence context leak

uevent based fences hold a reference to the fence context,
just like the legacy ones. So they need to drop this reference
in the same way.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: hide gcc-4.9 -Wmaybe-uninitialized
Arnd Bergmann [Mon, 24 Oct 2016 15:30:38 +0000 (17:30 +0200)]
drm/nouveau: hide gcc-4.9 -Wmaybe-uninitialized

gcc-4.9 notices that the validate_init() function returns unintialized
data when called with a zero 'nr_buffers' argument, when called with the
-Wmaybe-uninitialized flag:

drivers/gpu/drm/nouveau/nouveau_gem.c: In function ‘validate_init.isra.6’:
drivers/gpu/drm/nouveau/nouveau_gem.c:457:5: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

However, the only caller of this function always passes a nonzero
argument, and gcc-6 is clever enough to take this into account and
not warn about it any more.

Adding an explicit initialization to -EINVAL here is correct even if
the caller changed, and it avoids the warning on gcc-4.9 as well.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-By: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: mark symbols static where possible
Baoyou Xie [Mon, 24 Oct 2016 03:09:03 +0000 (11:09 +0800)]
drm/nouveau: mark symbols static where possible

We get a few warnings when building kernel with W=1:
drivers/gpu/drm/nouveau/nvkm/subdev/bios/fan.c:29:1: warning: no previous prototype for 'nvbios_fan_table' [-Wmissing-prototypes]
drivers/gpu/drm/nouveau/nvkm/subdev/bios/fan.c:56:1: warning: no previous prototype for 'nvbios_fan_entry' [-Wmissing-prototypes]
drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c:184:1: warning: no previous prototype for 'gt215_clk_info' [-Wmissing-prototypes]
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c:99:1: warning: no previous prototype for 'gt215_link_train_calc' [-Wmissing-prototypes]
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c:153:1: warning: no previous prototype for 'gt215_link_train' [-Wmissing-prototypes]
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c:271:1: warning: no previous prototype for 'gt215_link_train_init' [-Wmissing-prototypes]
....

In fact, both functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
So this patch marks these functions with 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: add missing header dependencies
Baoyou Xie [Mon, 24 Oct 2016 03:09:02 +0000 (11:09 +0800)]
drm/nouveau: add missing header dependencies

We get a few warnings when building kernel with W=1:
drivers/gpu/drm/nouveau/nvkm/core/firmware.c:34:1: warning: no previous prototype for 'nvkm_firmware_get' [-Wmissing-prototypes]
drivers/gpu/drm/nouveau/nvkm/core/firmware.c:58:1: warning: no previous prototype for 'nvkm_firmware_put' [-Wmissing-prototypes]
drivers/gpu/drm/nouveau/nvkm/subdev/fb/sddr3.c:69:1: warning: no previous prototype for 'nvkm_sddr3_calc' [-Wmissing-prototypes]
drivers/gpu/drm/nouveau/nvkm/subdev/fb/sddr2.c:60:1: warning: no previous prototype for 'nvkm_sddr2_calc' [-Wmissing-prototypes]
....

In fact, these functions are declared in
drivers/gpu/drm/nouveau/include/nvkm/core/firmware.h
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ram.h
drivers/gpu/drm/nouveau/nvkm/subdev/volt/priv.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv50.h
drivers/gpu/drm/nouveau/dispnv04/disp.h.
So this patch adds missing header dependencies.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/i2c/gk110b,gm10x: use the correct implementation
Ben Skeggs [Thu, 3 Nov 2016 06:37:33 +0000 (16:37 +1000)]
drm/nouveau/i2c/gk110b,gm10x: use the correct implementation

DPAUX registers moved on Kepler, these chipsets were still using the
Fermi implementation for some reason.

This fixes detection of hotplug/sink IRQs on DP connectors.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Cc: stable@vger.kernel.org
7 years agodrm/nouveau/i2c/aux/g94-: retry transactions after hw reports an error
Ben Skeggs [Thu, 3 Nov 2016 06:37:33 +0000 (16:37 +1000)]
drm/nouveau/i2c/aux/g94-: retry transactions after hw reports an error

This fixes (works around?) link training failures seen on (at least)
the Lenovo P50's internal panel.

It's also an important fix on the same system for MST support on the
dock.  Sometimes, right after receiving an IRQ from the sink, there's
an error bit (SINKSTAT_ERR) set in the DPAUX registers before we've
even attempted a transaction.

v2. Fixed regression on passive DP->DVI adapters.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/kms: lvds panel strap moved again on maxwell
Ben Skeggs [Wed, 19 Oct 2016 02:15:52 +0000 (12:15 +1000)]
drm/nouveau/kms: lvds panel strap moved again on maxwell

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Cc: stable@vger.kernel.org