GitHub/LineageOS/android_kernel_motorola_exynos9610.git
8 years agodrm/vmwgfx: Send a hotplug event at master_set
Thomas Hellstrom [Fri, 12 Feb 2016 09:01:28 +0000 (10:01 +0100)]
drm/vmwgfx: Send a hotplug event at master_set

Make sure drm clients (mostly the X server) are communicated the current
layout when switched in.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
8 years agodrm/vmwgfx: Default to explicit crtc placement for screen targets and screen objects
Thomas Hellstrom [Fri, 12 Feb 2016 08:59:50 +0000 (09:59 +0100)]
drm/vmwgfx: Default to explicit crtc placement for screen targets and screen objects

Enables using multiple framebuffers. For legacy display units,
explicit crtc placement is not supported due to hardware limitations.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
8 years agodrm/vmwgfx: Calculate the cursor position based on the crtc gui origin
Thomas Hellstrom [Fri, 12 Feb 2016 08:57:15 +0000 (09:57 +0100)]
drm/vmwgfx: Calculate the cursor position based on the crtc gui origin

Base the cursor position on the coordinate of the crtc origin in the
gui coordinate system rather than in the framebuffer coordinate system.

With explicit placement, these may differ (for example when two crtcs
scan out of the same framebuffer location).

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
8 years agodrm/vmwgfx: Add connector properties to switch between explicit and implicit placement
Thomas Hellstrom [Fri, 12 Feb 2016 08:55:45 +0000 (09:55 +0100)]
drm/vmwgfx: Add connector properties to switch between explicit and implicit placement

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
8 years agodrm/vmwgfx: Add suggested screen x and y connector properties
Thomas Hellstrom [Fri, 12 Feb 2016 08:45:42 +0000 (09:45 +0100)]
drm/vmwgfx: Add suggested screen x and y connector properties

Introduced by qxl, add these properties as a generic way to tell a
display manager about the GUI layout.

Also add the hotplug_mode_update_property which advises display managers to
reread the mode list on a hotplug event.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
8 years agodrm/vmwgfx: Add implicit framebuffer checks to the screen target code
Thomas Hellstrom [Fri, 12 Feb 2016 08:01:29 +0000 (09:01 +0100)]
drm/vmwgfx: Add implicit framebuffer checks to the screen target code

Just like for screen objects, make sure we use only a single framebuffer
for implicit placement.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
8 years agodrm/vmwgfx: Break out implicit fb code
Thomas Hellstrom [Fri, 12 Feb 2016 08:00:26 +0000 (09:00 +0100)]
drm/vmwgfx: Break out implicit fb code

Preparation for supporting explicit fbs for screen objects and screen
targets.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
8 years agodrm/vmwgfx: Rework screen target page flips v2
Thomas Hellstrom [Fri, 12 Feb 2016 07:54:07 +0000 (08:54 +0100)]
drm/vmwgfx: Rework screen target page flips v2

Gnome-Shell / Wayland assumes that page-flips can be done on a crtc
regardless of framebuffer size and the crtc position within the
framebuffer.

Therefore rework the screen target code to correctly handle changes in
framebuffer size and content_fb_type. Also make sure that we update
the screen target correctly when the content_fb_type is not
SAME_AS_DISPLAY.

This commit breaks out the framebuffer binding code from crtc_set so it
can be used both from page_flip() and crtc_set() and reworks those
functions a bit to be more robust.

v2: Address review comments by Sinclair Yeh.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
8 years agodrm/vmwgfx: Fix screen object page flips for large framebuffers
Thomas Hellstrom [Fri, 12 Feb 2016 07:32:08 +0000 (08:32 +0100)]
drm/vmwgfx: Fix screen object page flips for large framebuffers

For page flips the framebuffer may be much larger than the crtc
scanout area and may be attached to multiple crtcs.
When flipping a crtc, make sure we dirty only that crtc's area of the
framebuffer.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
8 years agodrm/vmwgfx: Fix a screen object framebuffer dirty corner case
Thomas Hellstrom [Fri, 12 Feb 2016 07:26:37 +0000 (08:26 +0100)]
drm/vmwgfx: Fix a screen object framebuffer dirty corner case

If there are no cliprects for a particular crtc, an invalid command would
have been generated. If that's the case, instead ditch the generated
command sequence.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
8 years agodrm/vmwgfx: Add DXGenMips support
Charmaine Lee [Fri, 12 Feb 2016 07:11:56 +0000 (08:11 +0100)]
drm/vmwgfx: Add DXGenMips support

Add support for DXGenMips command.

Signed-off-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
8 years agoMerge branch 'linux-4.6' of git://github.com/skeggsb/linux into drm-next
Dave Airlie [Mon, 14 Mar 2016 00:49:40 +0000 (10:49 +1000)]
Merge branch 'linux-4.6' of git://github.com/skeggsb/linux into drm-next

- GM20x secure boot support (hence, acceleration, finally \o/)
- GM200 support
- GM20B clock driver
- Support for power sensors on some GPUs
- Various other fixes all over the place

* 'linux-4.6' of git://github.com/skeggsb/linux: (95 commits)
  drm/nouveau/clk/gm20b: add basic driver
  drm/nouveau/clk/gk20a: share reusable structures/functions
  drm/nouveau/clk/gk20a: set lowest frequency during init()
  drm/nouveau/clk/gk20a: split gk20a_clk_new()
  drm/nouveau/clk/gk20a: abstract pl_to_div
  drm/nouveau/clk/gk20a: put mnp values into their own struct
  drm/nouveau/clk/gk20a: emit parent rate as debug message
  drm/nouveau/clk/gk20a: only restore divider to 1:1 if needed
  drm/nouveau/clk/gk20a: only compute n_lo if needed
  drm/nouveau/clk/gk20a: fix VCO bit mask
  drm/nouveau/clk/gk20a: rename enable/disable functions
  drm/nouveau/clk/gk20a: reorganize variables in gk20a_pllg_calc_mnp()
  drm/nouveau/clk/gk20a: convert parameters to Khz
  drm/nouveau/volt: add GM20B driver
  drm/nouveau/volt/gk20a: split constructor
  drm/nouveau/volt/gk20a: share reusable members & functions
  drm/nouveau/ce/gm107: expose MaxwellDmaCopyA
  drm/nouveau/fifo/gm107: KeplerChannelGpfifoB, and 2048 channels
  drm/nouveau/fifo/gk110: expose KeplerChannelGpfifoB
  drm/nouveau/fifo/gk104: submit NOP after all PBDMA_INTR_0, not just DEVICE
  ...

8 years agodrm/nouveau/clk/gm20b: add basic driver
Alexandre Courbot [Fri, 12 Feb 2016 05:38:18 +0000 (14:38 +0900)]
drm/nouveau/clk/gm20b: add basic driver

Add a basic clock driver that reuses the GK20A logic.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/clk/gk20a: share reusable structures/functions
Alexandre Courbot [Fri, 12 Feb 2016 05:23:22 +0000 (14:23 +0900)]
drm/nouveau/clk/gk20a: share reusable structures/functions

Make functions/structures that the GM20B driver will reuse public.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/clk/gk20a: set lowest frequency during init()
Alexandre Courbot [Fri, 12 Feb 2016 07:59:16 +0000 (16:59 +0900)]
drm/nouveau/clk/gk20a: set lowest frequency during init()

Err on the safe side by setting the lowest frequency (and thus voltage)
during device init.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/clk/gk20a: split gk20a_clk_new()
Alexandre Courbot [Fri, 12 Feb 2016 05:22:17 +0000 (14:22 +0900)]
drm/nouveau/clk/gk20a: split gk20a_clk_new()

This allows to instanciate drivers that use the same logic as gk20a with
different parameters.

Add a constructor function to allow other chips that inherit from this
clock to easily initialize its members

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/clk/gk20a: abstract pl_to_div
Alexandre Courbot [Fri, 12 Feb 2016 04:56:38 +0000 (13:56 +0900)]
drm/nouveau/clk/gk20a: abstract pl_to_div

pl_to_div may be done differently depending on the chip. Abstract this
operation so the same logic can be reused for them as well.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/clk/gk20a: put mnp values into their own struct
Alexandre Courbot [Wed, 28 Oct 2015 09:31:28 +0000 (18:31 +0900)]
drm/nouveau/clk/gk20a: put mnp values into their own struct

This allows us to read them using one single function and will be handy
to the GM20B driver.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/clk/gk20a: emit parent rate as debug message
Alexandre Courbot [Fri, 12 Feb 2016 08:22:53 +0000 (17:22 +0900)]
drm/nouveau/clk/gk20a: emit parent rate as debug message

Most users are probably not interested in this information.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/clk/gk20a: only restore divider to 1:1 if needed
Alexandre Courbot [Fri, 12 Feb 2016 05:19:27 +0000 (14:19 +0900)]
drm/nouveau/clk/gk20a: only restore divider to 1:1 if needed

Only restore the 1:1 divider if it is not set already. Also use the
proper masks for this operation and add a second write as done in the
Android code.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/clk/gk20a: only compute n_lo if needed
Alexandre Courbot [Fri, 12 Feb 2016 05:15:57 +0000 (14:15 +0900)]
drm/nouveau/clk/gk20a: only compute n_lo if needed

n_lo is used if we are going to slide. Compute it only if that condition
succeeds to avoid confusion about future usage of this computation.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/clk/gk20a: fix VCO bit mask
Alexandre Courbot [Fri, 12 Feb 2016 05:13:21 +0000 (14:13 +0900)]
drm/nouveau/clk/gk20a: fix VCO bit mask

Fix the mask specified to switch to VCO mode was given as an (incorrect)
immediate value. Although the side-effect happens to be the same, this
is clearly incorrect.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/clk/gk20a: rename enable/disable functions
Alexandre Courbot [Fri, 12 Feb 2016 05:07:07 +0000 (14:07 +0900)]
drm/nouveau/clk/gk20a: rename enable/disable functions

gk20a_pllg_disable() is only used in the context of gk20a_clk_fini().
Move its body there and rename _gk20a_pllg_enable() and
_gk20a_pllg_disable() to non-underscored versions.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/clk/gk20a: reorganize variables in gk20a_pllg_calc_mnp()
Alexandre Courbot [Fri, 12 Feb 2016 05:05:01 +0000 (14:05 +0900)]
drm/nouveau/clk/gk20a: reorganize variables in gk20a_pllg_calc_mnp()

Move some variables declarations to the scope where they are actually
used to make the code easier to follow.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/clk/gk20a: convert parameters to Khz
Alexandre Courbot [Wed, 28 Oct 2015 08:36:06 +0000 (17:36 +0900)]
drm/nouveau/clk/gk20a: convert parameters to Khz

Perform computations in Khz instead of Mhz for better precision.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/volt: add GM20B driver
Alexandre Courbot [Tue, 27 Oct 2015 03:35:14 +0000 (12:35 +0900)]
drm/nouveau/volt: add GM20B driver

Add basic GM20B volt driver that reuses the GK20A logic.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/volt/gk20a: split constructor
Alexandre Courbot [Fri, 12 Feb 2016 08:44:21 +0000 (17:44 +0900)]
drm/nouveau/volt/gk20a: split constructor

Split the constructor function so we can reuse the same logic in other
chips.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/volt/gk20a: share reusable members & functions
Vince Hsu [Mon, 27 Apr 2015 03:48:02 +0000 (11:48 +0800)]
drm/nouveau/volt/gk20a: share reusable members & functions

The CVB calculation and voltage setting functions can be reused for the
future chips. So move the declaration to gk20a.h.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/ce/gm107: expose MaxwellDmaCopyA
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/ce/gm107: expose MaxwellDmaCopyA

The HW accepts KeplerDmaCopyA and MaxwellDmaCopyA classes.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gm107: KeplerChannelGpfifoB, and 2048 channels
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/fifo/gm107: KeplerChannelGpfifoB, and 2048 channels

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk110: expose KeplerChannelGpfifoB
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/fifo/gk110: expose KeplerChannelGpfifoB

This class supports a WFI method (0x0078) that's not present on the
KeplerChannelGpfifoA class.

The binary driver exposes both classes on these GPUs for some reason,
though there doesn't appear to be any difference in the setup that's
done for each (ie. even if you allocate GpfifoA, the WFI method will
still work).

We shall just expose GpfifoB, as I don't see a good reason to report
the presence of both.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104: submit NOP after all PBDMA_INTR_0, not just DEVICE
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/fifo/gk104: submit NOP after all PBDMA_INTR_0, not just DEVICE

Prevents the same interrupt from re-triggering forever.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104: add vic plumbing
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/fifo/gk104: add vic plumbing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104: add sec plumbing
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/fifo/gk104: add sec plumbing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104: add nvdec plumbing
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/fifo/gk104: add nvdec plumbing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104: add nvenc plumbing
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/fifo/gk104: add nvenc plumbing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104: add msenc plumbing
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/fifo/gk104: add msenc plumbing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/core: add vic plumbing
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/core: add vic plumbing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/core: add nvdec plumbing
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/core: add nvdec plumbing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/core: add nvenc plumbing
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/core: add nvenc plumbing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/core: add msenc plumbing
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/core: add msenc plumbing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/core: sort engine indices alphabetically
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/core: sort engine indices alphabetically

Unlike subdevs, these aren't initialised in a defined order.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104: make use of topology info during gpfifo construction
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/fifo/gk104: make use of topology info during gpfifo construction

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104: make use of topology info during fault recovery
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/fifo/gk104: make use of topology info during fault recovery

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104: make use of topology info when handling ctxsw timeout
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/fifo/gk104: make use of topology info when handling ctxsw timeout

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104: read device topology information from hw
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/fifo/gk104: read device topology information from hw

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104: cosmetic engine->runlist changes
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/fifo/gk104: cosmetic engine->runlist changes

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104: don't attempt recovery of unknown mmu engines
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/fifo/gk104: don't attempt recovery of unknown mmu engines

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104: identify fault-recovery members more clearly
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/fifo/gk104: identify fault-recovery members more clearly

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104: rename spoon to pbdma, and move detection to oneinit
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/fifo/gk104: rename spoon to pbdma, and move detection to oneinit

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gf100: fix certain engines not being recovered after a fault
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/fifo/gf100: fix certain engines not being recovered after a fault

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gf100: don't attempt recovery of unknown mmu engines
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/fifo/gf100: don't attempt recovery of unknown mmu engines

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gf100: identify fault-recovery members more clearly
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/fifo/gf100: identify fault-recovery members more clearly

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gf100: rename spooon to pbdma, and move detection to oneinit
Ben Skeggs [Fri, 11 Mar 2016 03:09:28 +0000 (13:09 +1000)]
drm/nouveau/fifo/gf100: rename spooon to pbdma, and move detection to oneinit

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/fuc: Store $r0 in interrupt handler
Roy Spliet [Thu, 10 Mar 2016 11:19:00 +0000 (11:19 +0000)]
drm/nouveau/gr/fuc: Store $r0 in interrupt handler

It's supposed to always be 0, but at least nv_iowr() temporarily violates
this. Since the ih touches $r0, it should be stored.

Signed-off-by: Roy Spliet <rs855@cam.ac.uk>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/pmu/fuc: use imm32 in ld/st macros
Karol Herbst [Wed, 2 Mar 2016 16:23:07 +0000 (17:23 +0100)]
drm/nouveau/pmu/fuc: use imm32 in ld/st macros

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Reviewed-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/pmu/fuc: use the call macro instead of using the call instruction directly
Karol Herbst [Wed, 2 Mar 2016 16:23:06 +0000 (17:23 +0100)]
drm/nouveau/pmu/fuc: use the call macro instead of using the call instruction directly

the macro deals with target specific differences and so we should always use
this

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Reviewed-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/pmu/fuc: replace mov+sethi with imm32
Karol Herbst [Wed, 2 Mar 2016 16:23:05 +0000 (17:23 +0100)]
drm/nouveau/pmu/fuc: replace mov+sethi with imm32

on gk208+ we can simply mov 32bits, so we should have a single mov there

v2: use or operator instead of add

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Reviewed-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/pmu/fuc: fix imm32 for gk208+
Karol Herbst [Wed, 2 Mar 2016 16:23:04 +0000 (17:23 +0100)]
drm/nouveau/pmu/fuc: fix imm32 for gk208+

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Reviewed-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/core: use vzalloc for allocating ramht
Ilia Mirkin [Sun, 6 Mar 2016 21:06:06 +0000 (16:06 -0500)]
drm/nouveau/core: use vzalloc for allocating ramht

Most calls to nvkm_ramht_new use 0x8000 as the size. This results in a
fairly sizeable chunk of memory to be allocated, which may not be
available with kzalloc. Since this is done fairly rarely (once per
channel), use vzalloc instead.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104: kick channel upon removal
Alexandre Courbot [Tue, 1 Mar 2016 07:59:05 +0000 (16:59 +0900)]
drm/nouveau/fifo/gk104: kick channel upon removal

A channel may still be processed by the PBDMA even after removal, unless
it is properly kicked. Some chips are more sensible to this than others,
with GM20B triggering the issue very easily (the PBDMA will try to fetch
methods from the previously-removed channel after a new one is added).

Make sure this cannot happen by kicking the channel right after it is
disabled, and before the new runlist is submitted.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/instmem/gk20a: add write barrier when releasing DMA object
Alexandre Courbot [Thu, 3 Mar 2016 07:38:12 +0000 (16:38 +0900)]
drm/nouveau/instmem/gk20a: add write barrier when releasing DMA object

When using the DMA-API for instmem, we may obtain a write-combined
mapping. For such cases, add a write barrier in
gk20a_instobj_release_dma() to make sure that all writes have reached
memory at this time.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/device/pci: set as non-CPU-coherent on ARM64
Alexandre Courbot [Thu, 3 Mar 2016 07:03:02 +0000 (16:03 +0900)]
drm/nouveau/device/pci: set as non-CPU-coherent on ARM64

Without this buffer inconsistencies may appear between the CPU
and GPU when using a PCI GPU on an ARM64 board.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/hwmon: fix crash on non-PCI platforms
Alexandre Courbot [Wed, 2 Mar 2016 10:13:42 +0000 (19:13 +0900)]
drm/nouveau/hwmon: fix crash on non-PCI platforms

Registration of the hwmon device will fail on non-PCI systems since
dev->pdev is NULL in that case. Use the more generic drm_device::dev
member that points to the same and is always set no matter the platform.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau: silence unimportant HDMI status message
Alexandre Courbot [Wed, 2 Mar 2016 10:13:03 +0000 (19:13 +0900)]
drm/nouveau: silence unimportant HDMI status message

On non-PCI devices, nobody should really care if the device does not
provide HDMI...

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/bo: consider DMA buffers on x86 only
Alexandre Courbot [Wed, 2 Mar 2016 10:12:27 +0000 (19:12 +0900)]
drm/nouveau/bo: consider DMA buffers on x86 only

The DMA API has different semantics on different architectures.
Currently on arm64, it can only provide memory from a small pool which
dries up quickly if we attempt to allocate big buffers from it.

Do not consider that option when running on non-x86, since regular TTM
buffers are the (current) best-fit for ARM platforms.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/ltc/gf100: use more reasonable timeout value
Alexandre Courbot [Tue, 1 Mar 2016 08:39:00 +0000 (17:39 +0900)]
drm/nouveau/ltc/gf100: use more reasonable timeout value

LTC operations timeout was set to 2ms, which may be too low for devices
that run at very low clocks (e.g. GM20B) and trigger timeout messages.

Set the timeout to the default 2s. Also remove the redundant error
messages since nvkm_wait_msec() will already display a warning.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104: take runlist target into account
Alexandre Courbot [Tue, 1 Mar 2016 07:51:58 +0000 (16:51 +0900)]
drm/nouveau/fifo/gk104: take runlist target into account

Bits 28:29 of RUNLIST_BASE specify the memory target of the runlist. Set
it to 0x3 (SYS_MEM_NONCOHERENT) if the runlist object resides in system
memory.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gf100: take runlist target into account
Alexandre Courbot [Tue, 1 Mar 2016 07:51:57 +0000 (16:51 +0900)]
drm/nouveau/fifo/gf100: take runlist target into account

Bits 28:29 of RUNLIST_BASE specify the memory target of the runlist. Set
it to 0x3 (SYS_MEM_NONCOHERENT) if the runlist object resides in system
memory.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104: fix chid bit mask
Xia Yang [Thu, 25 Feb 2016 08:59:08 +0000 (17:59 +0900)]
drm/nouveau/fifo/gk104: fix chid bit mask

Fix the channel id bit mask in FIFO schedule timeout error handling.

FIFO_ENGINE_STATUS_NEXT_ID is bit 27:16 thus 0x0fff0000.
FIFO_ENGINE_STATUS_ID      is bit 11:0  thus 0x00000fff.

Signed-off-by: Xia Yang <xiay@nvidia.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/instmem/gk20a: set DMA mask early
Alexandre Courbot [Thu, 25 Feb 2016 06:08:42 +0000 (15:08 +0900)]
drm/nouveau/instmem/gk20a: set DMA mask early

DMA mask is typically set in nouveau_ttm_init(), but this function is
called late during initialization and GK20A's instmem will have called
DMA functions before this happens.

Having a wrongly set DMA mask can result in the use of unneeded bounce
buffers. Set it early to avoid this.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gm206: remove implementation, it's now identical to gm200
Ben Skeggs [Thu, 25 Feb 2016 00:40:51 +0000 (10:40 +1000)]
drm/nouveau/gr/gm206: remove implementation, it's now identical to gm200

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gm200: switch over to using sw_nonctx from firmware
Ben Skeggs [Thu, 25 Feb 2016 00:03:13 +0000 (10:03 +1000)]
drm/nouveau/gr/gm200: switch over to using sw_nonctx from firmware

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gm200: switch over to using sw_method_init from firmware
Ben Skeggs [Thu, 25 Feb 2016 00:00:17 +0000 (10:00 +1000)]
drm/nouveau/gr/gm200: switch over to using sw_method_init from firmware

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gm200: switch over to using sw_bundle_init from firmware
Ben Skeggs [Wed, 24 Feb 2016 23:58:12 +0000 (09:58 +1000)]
drm/nouveau/gr/gm200: switch over to using sw_bundle_init from firmware

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gm200: switch over to using sw_ctx from firmware
Ben Skeggs [Wed, 24 Feb 2016 23:48:37 +0000 (09:48 +1000)]
drm/nouveau/gr/gm200: switch over to using sw_ctx from firmware

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/bios/extdev: also parse v4.1 table
Karol Herbst [Sat, 20 Feb 2016 16:12:19 +0000 (17:12 +0100)]
drm/nouveau/bios/extdev: also parse v4.1 table

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Reviewed-by: Martin Peres <martin.peres@free.fr>
8 years agodrm/nouveau/hwmon: don't require therm to be valid to get any data
Karol Herbst [Sat, 20 Feb 2016 16:10:12 +0000 (17:10 +0100)]
drm/nouveau/hwmon: don't require therm to be valid to get any data

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Reviewed-by: Martin Peres <martin.peres@free.fr>
8 years agodrm/nouveau/hwmon: add power consumption
Karol Herbst [Thu, 18 Feb 2016 19:10:19 +0000 (20:10 +0100)]
drm/nouveau/hwmon: add power consumption

v2: expose only if the sensor reading is valid

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Reviewed-by: Martin Peres <martin.peres@free.fr>
8 years agodrm/nouveau/iccsense: implement for ina209, ina219 and ina3221
Karol Herbst [Thu, 18 Feb 2016 15:53:44 +0000 (16:53 +0100)]
drm/nouveau/iccsense: implement for ina209, ina219 and ina3221

based on Martins initial work

v3: fix ina2x9 calculations
v4: don't kmalloc(0), fix the lsb/pga stuff
v5: add a field to tell if the power reading may be invalid
    add nkvm_iccsense_read_all function
    check for the device on the i2c bus

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Reviewed-by: Martin Peres <martin.peres@free.fr>
8 years agodrm/nouveau/nvbios/iccsense: add parsing of the SENSE table
Martin Peres [Thu, 18 Feb 2016 13:35:12 +0000 (14:35 +0100)]
drm/nouveau/nvbios/iccsense: add parsing of the SENSE table

Karol Herbst:
v4: don't kmalloc(0)
v5: stricter validation

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Reviewed-by: Martin Peres <martin.peres@free.fr>
8 years agodrm/nouveau/subdev/iccsense: add new subdev for power sensors
Martin Peres [Thu, 18 Feb 2016 13:10:49 +0000 (14:10 +0100)]
drm/nouveau/subdev/iccsense: add new subdev for power sensors

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Reviewed-by: Martin Peres <martin.peres@free.fr>
8 years agodrm/nouveau/secboot/gm20b: add secure boot support
Alexandre Courbot [Wed, 24 Feb 2016 05:42:24 +0000 (14:42 +0900)]
drm/nouveau/secboot/gm20b: add secure boot support

Add secure boot support for the GM20B chip found in Tegra X1. Secure
boot on Tegra works slightly differently from desktop, notably in the
way the WPR region is set up.

In addition, the firmware bootloaders use a slightly different header
format.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/secboot/gm200: add secure-boot support
Alexandre Courbot [Wed, 24 Feb 2016 05:42:23 +0000 (14:42 +0900)]
drm/nouveau/secboot/gm200: add secure-boot support

Add secure-boot for the dGPU set of GM20X chips, using the PMU as the
high-secure falcon.

This work is based on Deepak Goyal's initial port of Secure Boot to
Nouveau.

v2. use proper memory target function

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gm200: do not load firmware for secure falcons
Alexandre Courbot [Wed, 24 Feb 2016 05:42:22 +0000 (14:42 +0900)]
drm/nouveau/gr/gm200: do not load firmware for secure falcons

Secure falcons' firmware is managed by secboot. Do not load it in GR for
them.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gf100: add support for securely-managed falcons
Alexandre Courbot [Wed, 24 Feb 2016 05:42:21 +0000 (14:42 +0900)]
drm/nouveau/gr/gf100: add support for securely-managed falcons

Start securely-managed falcons using secboot functions since the process
for them is different from just writing CPUCTL.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/core: add support for secure boot
Alexandre Courbot [Wed, 24 Feb 2016 05:42:20 +0000 (14:42 +0900)]
drm/nouveau/core: add support for secure boot

On GM200 and later GPUs, firmware for some essential falcons (notably
GR ones) must be authenticated by a NVIDIA-produced signature and
loaded by a high-secure falcon in order to be able to access privileged
registers, in a process known as Secure Boot.

Secure Boot requires building a binary blob containing the firmwares
and signatures of the falcons to be loaded. This blob is then given to
a high-secure falcon running a signed loader firmware that copies the
blob into a write-protected region, checks that the signatures are
valid, and finally loads the verified firmware into the managed falcons
and switches them to privileged mode.

This patch adds infrastructure code to support this process on chips
that require it.

v2:
- The IRQ mask of the PMU falcon was left - replace it with the proper
  irq_mask variable.
- The falcon reset procedure expecting a falcon in an initialized state,
  which was accidentally provided by the PMU subdev. Make sure that
  secboot can manage the falcon on its own.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gm200: load external firmware and bundles
Alexandre Courbot [Wed, 24 Feb 2016 05:42:19 +0000 (14:42 +0900)]
drm/nouveau/gr/gm200: load external firmware and bundles

Load firmware and bundles in GM200's constructor. The previously called
GF100 function did not care about the bundles.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gk20a: share external bundles loading functions
Alexandre Courbot [Wed, 24 Feb 2016 05:42:18 +0000 (14:42 +0900)]
drm/nouveau/gr/gk20a: share external bundles loading functions

There functions are going to be used by other chips that rely on
NVIDIA-provided firmware. Export them.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gk20a: simplify external bundle loading functions
Alexandre Courbot [Wed, 24 Feb 2016 05:42:17 +0000 (14:42 +0900)]
drm/nouveau/gr/gk20a: simplify external bundle loading functions

Make these functions easier to use by handling memory management from
within.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gf100: load firmware in outer function
Alexandre Courbot [Wed, 24 Feb 2016 05:42:16 +0000 (14:42 +0900)]
drm/nouveau/gr/gf100: load firmware in outer function

The firmwares required by GR may vary from chip to chip, especially with
the introduction of secure boot and NVIDIA-provided firmwares. Move the
firmware loading outside of gf100_gr_ctor so other chips may still call
it while managing their firmwares themselves.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gk20a: move firmware bundle release to gf100
Alexandre Courbot [Wed, 24 Feb 2016 05:42:15 +0000 (14:42 +0900)]
drm/nouveau/gr/gk20a: move firmware bundle release to gf100

Some members of gf100_gr were freed by the gk20a driver. That's not
where it should be done - free them in gf100 so other chips that use
NVIDIA-provided firmware free these structures properly.

This also removes the need for a GK20A-specific destructor.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/core: add gpuobj memcpy helper functions
Alexandre Courbot [Wed, 24 Feb 2016 05:42:14 +0000 (14:42 +0900)]
drm/nouveau/core: add gpuobj memcpy helper functions

Add memcpy functions to copy a buffer to a gpuobj and vice-versa. This
will be used by the secure boot code.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gm200: enable graphics device
Ben Skeggs [Wed, 24 Feb 2016 04:05:54 +0000 (14:05 +1000)]
drm/nouveau/gm200: enable graphics device

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gm200: s/gm204/gm200/
Ben Skeggs [Wed, 24 Feb 2016 04:03:40 +0000 (14:03 +1000)]
drm/nouveau/gr/gm200: s/gm204/gm200/

Most of the per-chipset differences will go away when we fully switch
to using the register lists provided by the firmware files, which will
leave all the remaining code "belonging" to GM200.

This is a preemptive rename from GM204 to GM200.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/bios/devinit: properly handle unknown generic conditions
Ben Skeggs [Wed, 17 Feb 2016 18:10:04 +0000 (04:10 +1000)]
drm/nouveau/bios/devinit: properly handle unknown generic conditions

Upon encountering an unknown condition code, the script interpreter
is supposed to skip 'size' bytes and continue at the next devinit
token.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/bios/devinit: rename INIT_DP_CONDITION to INIT_GENERIC_CONDITION
Ben Skeggs [Wed, 17 Feb 2016 18:03:39 +0000 (04:03 +1000)]
drm/nouveau/bios/devinit: rename INIT_DP_CONDITION to INIT_GENERIC_CONDITION

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/ltc/gm107: fix slice intr offset
Ben Skeggs [Thu, 11 Feb 2016 02:23:03 +0000 (12:23 +1000)]
drm/nouveau/ltc/gm107: fix slice intr offset

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/devinit/gf100-: detect if BIOS invoked devinit
Alexandre Courbot [Thu, 11 Feb 2016 02:10:04 +0000 (11:10 +0900)]
drm/nouveau/devinit/gf100-: detect if BIOS invoked devinit

It is not advisable to perform devinit if it has already been done.
VBIOS will very likely have invoked devinit if the GPU is the primary
graphics device, but there is no accurate way to detect this fact yet.

This patch adds such a method for gf100 and later chips, by means of the
NV_PTOP_SCRATCH1_DEVINIT_COMPLETED bit. This bit is set to 1 by devinit,
and reset to 0 when the GPU is powered.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/devinit/nv50: remove unneeded variable
Alexandre Courbot [Thu, 11 Feb 2016 02:09:52 +0000 (11:09 +0900)]
drm/nouveau/devinit/nv50: remove unneeded variable

We never use any nv50-specific member in this nv50_devinit_preinit().

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>