Commit Graph

483186 Commits

Author SHA1 Message Date
Ville Syrjälä
73bbf6bd90 drm/i915: Fix gen4 GPU reset
On pre-ctg the reset bit directly controls the reset signal. We must
assert it for >=20usec and then deassert it. Bit 1 is a RO status bit
which should also go down when the reset is no longer asserted.

Tested-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-12-03 09:29:36 +01:00
Daniel Vetter
aaecdf611a drm/i915: Stop gathering error states for CS error interrupts
There's quite a few bug reports with error states where the error
reasons makes just about no sense at all. Like dying on tlbs for a
display plane that's not even there. Also users don't really report a
lot of bad side effects generally, just the error states.

Furthermore we don't even enable these interrupts any more on gen5+
(though the handling code is still there). So this mostly concerns old
platforms.

Given all that lets make our lives a bit easier and stop capturing
error states, in the hopes that we can just ignore them. In case
that's not true and the gpu indeed dies the hangcheck should
eventually kick in. And I've left some debug log in to make this case
noticeble. Referenced bug is just an example.

v2: Fix missing \n Jani spotted.

References: https://bugs.freedesktop.org/show_bug.cgi?id=82095
References: https://bugs.freedesktop.org/show_bug.cgi?id=85944
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-12-03 09:29:36 +01:00
Daniel Vetter
d472fcc837 drm/i915: Disallow pin ioctl completely for kms drivers
The problem here is that SNA pins batchbuffers to etch out a bit more
performance. Iirc it started out as a w/a for i830M (which we've
implemented in the kernel since a long time already). The problem is
that the pin ioctl wasn't added in

commit d23db88c3a
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri May 23 08:48:08 2014 +0200

    drm/i915: Prevent negative relocation deltas from wrapping

Fix this by simply disallowing pinning from userspace so that the
kernel is in full control of batch placement again. Especially since
distros are moving towards running X as non-root, so most users won't
even be able to see any benefits.

UMS support is dead now, but we need this minimal patch for
backporting. Follow-up patch will remove the pin ioctl code
completely.

Note to backporters: You must have both

commit b45305fce5
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Mon Dec 17 16:21:27 2012 +0100

    drm/i915: Implement workaround for broken CS tlb on i830/845

which laned in 3.8 and

commit c4d69da167
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Sep 8 14:25:41 2014 +0100

    drm/i915: Evict CS TLBs between batches

which is also marked cc: stable. Otherwise this could introduce a
regression by disabling the userspace w/a without the kernel w/a being
fully functional on i830/45.

References: https://bugs.freedesktop.org/show_bug.cgi?id=76554#c116
Cc: stable@vger.kernel.org # requires c4d69da167 and v3.8
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2014-12-03 09:29:35 +01:00
Chris Wilson
2b38705981 drm/i915: Only warn the first time we attempt to mmio whilst suspended
In all likelihood we will do a few hundred errnoneous register
operations if we do a single invalid register access whilst the device
is suspended. As each instance causes a WARN, this floods the system
logs and can make the system unresponsive.

The warning was first introduced in
commit b2ec142cb0
Author: Paulo Zanoni <paulo.r.zanoni@intel.com>
Date:   Fri Feb 21 13:52:25 2014 -0300

    drm/i915: call assert_device_not_suspended at gen6_force_wake_work

and despite the claims the WARN is still encountered in the wild today.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-12-03 09:29:35 +01:00
Clint Taylor
b4eb156462 drm/i915/chv: Enable AVI, SPD and HDMI infoframes for CHV.
CHV infoframes were not being enabled.

Signed-off-by: Clint Taylor <clinton.a.taylor@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-12-03 09:29:34 +01:00
Ville Syrjälä
b9950a133f drm/i915: Don't clobber crtc->new_config when nothing changes
When doing a nop modeset we currently leave crtc->new_config point at
the already freed temporary pipe_config. That will anger the sanity
checks in intel_modeset_update_state() when the nop modeset gets
followed by a GPU reset on gen3/4 where the display block gets fully
reinitialized during the reset.

So leave crtc->new_config alone until we know a modeset is actually
required.

Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-12-03 09:29:34 +01:00
Laurent Pinchart
4fcd01d0f3 drm: rcar-du: Fix NULL encoder pointer dereference
The DRM connector's encoder pointer is managed internally by the DRM
core and set to NULL when the DRM connector is disconnected from the
CRTC it was attached to. This results in a NULL pointer dereference in
the HDMI connector functions when trying to call the associated slave
encoder's operations.

Fix this by retrieving the slave encoder pointer from the R-Car
connector structure instead of the DRM connector structure.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-12-03 08:28:48 +10:00
Dave Airlie
26045b53c9 Merge tag 'drm-intel-next-2014-11-21-fixed' of git://anongit.freedesktop.org/drm-intel into drm-next
drm-intel-next-2014-11-21:
- infoframe tracking (for fastboot) from Jesse
- start of the dri1/ums support removal
- vlv forcewake timeout fixes (Imre)
- bunch of patches to polish the rps code (Imre) and improve it on bdw (Tom
  O'Rourke)
- on-demand pinning for execlist contexts
- vlv/chv backlight improvements (Ville)
- gen8+ render ctx w/a work from various people
- skl edp programming (Satheeshakrishna et al.)
- psr docbook (Rodrigo)
- piles of little fixes and improvements all over, as usual

* tag 'drm-intel-next-2014-11-21-fixed' of git://anongit.freedesktop.org/drm-intel: (117 commits)
  drm/i915: Don't pin LRC in GGTT when dumping in debugfs
  drm/i915: Update DRIVER_DATE to 20141121
  drm/i915/g4x: fix g4x infoframe readout
  drm/i915: Only call mod_timer() if not already pending
  drm/i915: Don't rely upon encoder->type for infoframe hw state readout
  drm/i915: remove the IRQs enabled WARN from intel_disable_gt_powersave
  drm/i915: Use ggtt error obj capture helper for gen8 semaphores
  drm/i915: vlv: increase timeout when setting idle GPU freq
  drm/i915: vlv: fix cdclk setting during modeset while suspended
  drm/i915: Dump hdmi pipe_config state
  drm/i915: Gen9 shadowed registers
  drm/i915/skl: Gen9 multi-engine forcewake
  drm/i915: Read power well status before other registers for drpc info
  drm/i915: Pin tiled objects for L-shaped configs
  drm/i915: Update ring freq for full gpu freq range
  drm/i915: change initial rps frequency for gen8
  drm/i915: Keep min freq above floor on HSW/BDW
  drm/i915: Use efficient frequency for HSW/BDW
  drm/i915: Can i915_gem_init_ioctl
  drm/i915: Sanitize ->lastclose
  ...
2014-12-03 08:25:59 +10:00
Thomas Daniel
064ca1d250 drm/i915: Don't pin LRC in GGTT when dumping in debugfs
LRC object does not need to be mapped into the GGTT when dumping. A side-effect
of this patch is that a compiler warning goes away (not checking return value
of i915_gem_obj_ggtt_pin).

v2: Broke out individual context dumping into a new function as the indentation
was getting a bit crazy.  Added notification of contexts with no gem object for
debugging purposes.  Removed unnecessary pin_pages and unpin_pages, replaced
with explicit get_pages for the context object as there may be no backing store
allocated at this time (Comment for get_pages says "Ensure that the associated
pages are gathered from the backing storage and pinned into our object").
Improved error checking - get_pages and get_page are checked for failure.

Signed-off-by: Thomas Daniel <thomas.daniel@intel.com>
[danvet: Align paramter continuation lines properly. Also add some
braces to the nested loops again for readability.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-12-02 15:23:30 +01:00
Dave Airlie
1a92b7a241 Merge branch 'linux-3.19' of git://anongit.freedesktop.org/git/nouveau/linux-2.6 into drm-next
- Tegra K1 voltage support, and coherency improvements
- GM204 support (modesetting, still waiting on NVIDIA for signed fw to
proceed further), and a lot of bios/i2c/devinit adjustments needed to
support it
- GT21x memory reclocking work
- Various other bits and pieces, most of which are prep-work for a
couple of bigger projects I didn't get finished in time

* 'linux-3.19' of git://anongit.freedesktop.org/git/nouveau/linux-2.6: (73 commits)
  drm/nv50/kms: drop requirement that framebuffer bos be contig up-front
  drm/nv50/kms: directly use cursor image from userspace buffer
  drm/nouveau/kms: when pinning display-related buffers, force contig vram
  drm/nouveau: teach nouveau_bo_pin() how to force a contig vram allocation
  drm/nouveau/volt: add support for GK20A
  drm/nouveau/platform: add GPU speedo information to nouveau platform
  drm/nouveau/volt: allow non-bios voltage scaling
  drm/gf100-/gr: return non-fatal error code when fw not present
  drm/nouveau/devinit: bump priv ring timeouts before executing scripts
  drm/nouveau/bios: translate ramcfg strap through M0203
  drm/nouveau/fb: make use of M0203 routines for ram type determination
  drm/nouveau/bios: add parsing of BIT M(v2) +0x03 table
  drm/nouveau/core: allow vbios parsing without knowing chipset type
  drm/nouveau/lib: add null backend
  drm/nouveau/device: store revision
  drm/nouveau/core: add some forgotten subdevs to disable mask
  drm/gk20a/clk: fix max VCO value
  drm/nouveau: we need pin_refcnt for nouveau_bo_placement_set()
  drm/nv50-/kms: add some evo tracing ability for debugging
  drm/nv50/kms: use sclass() instead of trial-and-error
  ...
2014-12-02 16:13:12 +10:00
Ben Skeggs
9f6d2ce305 drm/nv50/kms: drop requirement that framebuffer bos be contig up-front
We'll move them at pin() time if necessary.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:10 +10:00
Ben Skeggs
5a56025238 drm/nv50/kms: directly use cursor image from userspace buffer
Preparation for transition to planes, which use framebuffers for the
cursor image.  We've always done copies from the userspace buffer up
until now for legacy reasons, there's no good reason to do so on the
chipsets this code covers.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:09 +10:00
Ben Skeggs
547ad07283 drm/nouveau/kms: when pinning display-related buffers, force contig vram
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:09 +10:00
Ben Skeggs
ad76b3f7c7 drm/nouveau: teach nouveau_bo_pin() how to force a contig vram allocation
We have the ability to move buffers around in the kernel if necessary,
and should probably use it rather than failing if userspace passes us
a non-contig buffer for a plane.

The NOUVEAU_GEM_TILE_NONCONTIG flag from userspace will become a mere
initial placement hint once all the relevant paths have been updated.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:09 +10:00
Vince Hsu
ef1df1bc11 drm/nouveau/volt: add support for GK20A
The voltage value are calculated by the hardware characterized
result.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:08 +10:00
Vince Hsu
37025602f6 drm/nouveau/platform: add GPU speedo information to nouveau platform
For GK20A we need the GPU speedo value to calculate voltage levels.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:08 +10:00
Vince Hsu
08c7f248be drm/nouveau/volt: allow non-bios voltage scaling
Move the vbios parsing out of init() and call it conditionally if the
platform has a vbios. Non-vbios platforms can use the ctor() to init the
data structures.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
Acked-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:07 +10:00
Ben Skeggs
c6f37e0ce6 drm/gf100-/gr: return non-fatal error code when fw not present
This allows the module to load without acceleration.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:07 +10:00
Ben Skeggs
c49c0b4411 drm/nouveau/devinit: bump priv ring timeouts before executing scripts
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:06 +10:00
Ben Skeggs
15606cb466 drm/nouveau/bios: translate ramcfg strap through M0203
A machine has been spotted where the ramcfg strap is "8", and the ramcfg
xlat table goes 0-7,0-7, resulting in us selecting config 0 for memory
items.  On this particular system, config "8" is available and supposed
to be used.  It appears that starting from GT21x (where Mv2 appears),
we're supposed to use the value in this table instead.

One concern here is that not all the places we currently use ramcfg xlat
are supposed to be treated the same now.  The strap xlat table wasn't
removed from the vbios either, presumably for some kind of good reason.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:06 +10:00
Ben Skeggs
1a72f2bd1e drm/nouveau/fb: make use of M0203 routines for ram type determination
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:05 +10:00
Ben Skeggs
4766ec5394 drm/nouveau/bios: add parsing of BIT M(v2) +0x03 table
We only support one kind of matching here (ramcfg strap), but it appears
alternate methods are possible.  I wrote a tool to scan our vbios repo
for other types, but did not see any used.  Hopefully this means there
aren't any in the wild that will now break.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:05 +10:00
Ben Skeggs
ddbb55ab04 drm/nouveau/core: allow vbios parsing without knowing chipset type
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:04 +10:00
Ben Skeggs
34acf100dd drm/nouveau/lib: add null backend
For the moment, just used to speed up vbios-only testing.  Have some
ideas for extending in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:04 +10:00
Ben Skeggs
3704791d97 drm/nouveau/device: store revision
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:04 +10:00
Ben Skeggs
373535431b drm/nouveau/core: add some forgotten subdevs to disable mask
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:03 +10:00
Alexandre Courbot
c50d3b2b4a drm/gk20a/clk: fix max VCO value
For some reason max_vco was set to a lower value that it can support,
which prevented some clock states to be applied. Fix this by setting it
to the same value as downstream.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:03 +10:00
Ben Skeggs
50ab2e5206 drm/nouveau: we need pin_refcnt for nouveau_bo_placement_set()
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:02 +10:00
Ben Skeggs
2b1930c3f3 drm/nv50-/kms: add some evo tracing ability for debugging
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:02 +10:00
Ben Skeggs
6af5289e85 drm/nv50/kms: use sclass() instead of trial-and-error
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:01 +10:00
Ben Skeggs
036a12b681 drm/nv50/kms: remove a couple of cursor-related stub functions
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:01 +10:00
Ben Skeggs
6aac6ced4e drm/nouveau: fix pin refcnt leak in failure path
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:00 +10:00
Alexandre Courbot
b22870ba6a drm/nouveau: synchronize BOs when required
On architectures for which access to GPU memory is non-coherent,
caches need to be flushed and invalidated explicitly when BO control
changes between CPU and GPU.

This patch adds buffer synchronization functions which invokes the
correct API (PCI or DMA) to ensure synchronization is effective.

Based on the TTM DMA cache helper patches by Lucas Stach.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:00 +10:00
Alexandre Courbot
a81349a7b2 drm/nouveau: allocate GPFIFOs and fences coherently
Specify TTM_PL_FLAG_UNCACHED when allocating GPFIFOs and fences to
allow them to be safely accessed by the kernel without being synced
on non-coherent architectures.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:43:59 +10:00
Alexandre Courbot
c3a0c771e5 drm/nouveau: implement explicitly coherent BOs
Allow nouveau_bo_new() to recognize the TTM_PL_FLAG_UNCACHED flag, which
means that we want the allocated BO to be perfectly coherent between the
CPU and GPU. This is useful on non-coherent architectures for which we
do not want to manually sync some rarely-accessed buffers: typically,
fences and pushbuffers.

A TTM BO allocated with the TTM_PL_FLAG_UNCACHED on a non-coherent
architecture will be populated using the DMA API, and accesses to it
performed using the coherent mapping performed by dma_alloc_coherent().

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:43:59 +10:00
Alexandre Courbot
c5d7ddf70a drm/nouveau: introduce nv_device_is_cpu_coherent()
Add a function allowing us to know whether a device is CPU-coherent,
i.e. accesses performed by the CPU on GPU-mapped buffers will
be immediately visible on the GPU side and vice-versa.

For now, a device is considered to be coherent if it uses the PCI bus on
a non-ARM architecture.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:43:59 +10:00
Alexandre Courbot
5be5a15a43 drm/nouveau: warn when moving a pinned object
Pinned BOs are supposed to remain in their current location until
unpinned. Display a warning for the supposedly-erroneous case where we
are trying to move such objects.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:43:58 +10:00
Ben Skeggs
f9895e6dbe drm/nouveau/disp: clear notify intr status when enabling, to prevent races
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:43:58 +10:00
Ben Skeggs
2832271d64 drm/nv50-/disp: rename class members to match nvidia channel names
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:43:57 +10:00
Ben Skeggs
868e34f784 drm/nouveau/core: remove some dead code that got forgotten
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:43:57 +10:00
Roy Spliet
f67a8ff533 drm/nouveau/pwr/fuc: Fix thinko in nouveau_memx_wait()
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:43:56 +10:00
Roy Spliet
f10e55c9fc drm/nva3/clock: Allow user reclocking
Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:43:56 +10:00
Roy Spliet
598a39e79a drm/nouveau/fb/ramnva3: Reclocking script for GDDR3
Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:43:55 +10:00
Roy Spliet
b0c7336b1a drm/nouveau/fb/ramnva3: Reclocking script for DDR2
Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:43:55 +10:00
Roy Spliet
b6a7907f6b drm/nouveau/fb/ramnva3: Reclocking script for DDR3
Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:43:54 +10:00
Roy Spliet
bf504b3fbb drm/nouveau/fb/ramnva3: Ressurect timing calculation code
Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:43:54 +10:00
Roy Spliet
7f4b961618 drm/nouveau/fb/ramnva3: Link training for DDR3
V2: fix whitespace errors in memx.fuc

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:43:54 +10:00
Roy Spliet
f648cab0ad drm/nouveau/fb/gddr3: Generate MR values
Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:43:53 +10:00
Roy Spliet
13a757dbc7 drm/nouveau/bios/ramcfg: 10_02_40 -> DLLoff
Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:43:53 +10:00
Ben Skeggs
7bb6d4428d drm/nouveau: move the (far too many...) different s/r paths to the same place
No code changes.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:43:52 +10:00