]> asedeno.scripts.mit.edu Git - linux.git/log
linux.git
7 years agodrm/nouveau: request notifications for channels that have been killed
Ben Skeggs [Sat, 5 Nov 2016 03:31:25 +0000 (13:31 +1000)]
drm/nouveau: request notifications for channels that have been killed

These will be used to improve error recovery behaviour.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fifo/gf100-: provide notification to user if channel is killed
Ben Skeggs [Sat, 5 Nov 2016 03:05:14 +0000 (13:05 +1000)]
drm/nouveau/fifo/gf100-: provide notification to user if channel is killed

There are instances (such as non-recoverable GPU page faults) where
NVKM decides that a channel's context is no longer viable, and will
be removed from the runlist.

This commit notifies the owner of the channel when this happens, so
it has the opportunity to take some kind of recovery action instead
of hanging.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fifo/g84-: rename non-stall interrupt event
Ben Skeggs [Tue, 24 Jan 2017 06:08:14 +0000 (16:08 +1000)]
drm/nouveau/fifo/g84-: rename non-stall interrupt event

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fifo: tidy up channel creation event code
Ben Skeggs [Sat, 5 Nov 2016 03:12:57 +0000 (13:12 +1000)]
drm/nouveau/fifo: tidy up channel creation event code

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core: increase maximum number of notifies that a client can request
Ben Skeggs [Sat, 5 Nov 2016 04:14:20 +0000 (14:14 +1000)]
drm/nouveau/core: increase maximum number of notifies that a client can request

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/drm/nouveau/led: prevent a possible use-after-free
Martin Peres [Wed, 18 Jan 2017 21:49:21 +0000 (23:49 +0200)]
drm/nouveau/drm/nouveau/led: prevent a possible use-after-free

If the led class registration fails, we free drm->led but do not reset
it to NULL, which means that the suspend/resume/fini function will act
as if everything went well in init() and will likely crash the kernel.

This patch adds the missing drm->led = NULL.

Reported-by: Emmanuel Pescosta <emmanuelpescosta099@gmail.com>
Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pci/g92: Enable changing pcie link speeds
Karol Herbst [Sat, 19 Nov 2016 23:43:15 +0000 (00:43 +0100)]
drm/nouveau/pci/g92: Enable changing pcie link speeds

Tested on a G92, seems to work. Confirmed by 8 mmiotraces.

Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pci: Rename g94 to g92
Karol Herbst [Sat, 19 Nov 2016 23:43:14 +0000 (00:43 +0100)]
drm/nouveau/pci: Rename g94 to g92

Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/devinit/nv50: return error code if pll calculation fails
Ben Skeggs [Mon, 16 Jan 2017 03:44:11 +0000 (13:44 +1000)]
drm/nouveau/devinit/nv50: return error code if pll calculation fails

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: fix bug id typo in comment
Ilia Mirkin [Thu, 5 Jan 2017 06:13:15 +0000 (01:13 -0500)]
drm/nouveau: fix bug id typo in comment

The issue was recorded in fd.o bug 27501, not 25701.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: size is u64 everywhere
Ben Skeggs [Mon, 23 May 2016 02:34:49 +0000 (12:34 +1000)]
drm/nouveau: size is u64 everywhere

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agogpu: ipu-v3: Stop overwriting pdev->dev.of_node of child devices
Philipp Zabel [Thu, 16 Feb 2017 13:46:31 +0000 (14:46 +0100)]
gpu: ipu-v3: Stop overwriting pdev->dev.of_node of child devices

Setting dev->of_node changes the modalias and breaks module autoloading.
Since there is an of_node field in the platform data passed to child
devices, we don't even need this anymore.

Suggested-by: Russell King <linux@armlinux.org.uk>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
7 years agogpu: ipu-v3: export ipu_csi_set_downsize
Philipp Zabel [Thu, 16 Feb 2017 11:36:21 +0000 (12:36 +0100)]
gpu: ipu-v3: export ipu_csi_set_downsize

This function will be used by the media drivers and needs to be exported
to allow them to be built as modules.

Reported-by: Russell King <linux@armlinux.org.uk>
Fixes: 867341b95891 ("gpu: ipu-v3: add ipu_csi_set_downsize")
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
7 years agodrm/imx: lift 64x64 pixel minimum framebuffer size requirement
Philipp Zabel [Fri, 27 Jan 2017 10:57:19 +0000 (11:57 +0100)]
drm/imx: lift 64x64 pixel minimum framebuffer size requirement

There is no reason to limit framebuffer size to 64x64 pixels at a
minimum on creation. The actual scanout limitations (width >= 13 for the
base plane and height >= 2) are checked in atomic_check.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
7 years agodrm/imx: imx-tve: Do not set the regulator voltage
Fabio Estevam [Wed, 8 Feb 2017 12:47:49 +0000 (10:47 -0200)]
drm/imx: imx-tve: Do not set the regulator voltage

Commit deb65870b5d9d ("drm/imx: imx-tve: check the value returned by
regulator_set_voltage()") exposes the following probe issue:

63ff0000.tve supply dac not found, using dummy regulator
imx-drm display-subsystem: failed to bind 63ff0000.tve (ops imx_tve_ops): -22

When the 'dac-supply' is not passed in the device tree a dummy regulator is
used and setting its voltage is not allowed.

To fix this issue, do not set the dac-supply voltage inside the driver
and let its voltage be specified in the device tree.

Print a warning if the the 'dac-supply' voltage has a value different
from 2.75V.

Fixes: deb65870b5d9d ("drm/imx: imx-tve: check the value returned by regulator_set_voltage()")
Cc: <stable@vger.kernel.org> # 4.8+
Suggested-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
7 years agodrm/nouveau: s/mem/reg/ for struct ttm_mem_reg variables
Ben Skeggs [Tue, 17 May 2016 01:13:37 +0000 (11:13 +1000)]
drm/nouveau: s/mem/reg/ for struct ttm_mem_reg variables

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: allocate device object for every client
Ben Skeggs [Wed, 18 May 2016 03:57:42 +0000 (13:57 +1000)]
drm/nouveau: allocate device object for every client

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: create userspace clients as subclients
Ben Skeggs [Mon, 23 May 2016 01:25:17 +0000 (11:25 +1000)]
drm/nouveau: create userspace clients as subclients

This will allow the DRM to share memory objects between clients later
down the track.

For the moment, the only immediate benefit is less logic required to
handle suspend/resume.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: tidy up the client init/fini interfaces
Ben Skeggs [Wed, 18 May 2016 03:36:34 +0000 (13:36 +1000)]
drm/nouveau: tidy up the client init/fini interfaces

These were a little insane.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: pass nvif_client to nouveau_gem_new() instead of drm_device
Ben Skeggs [Tue, 24 May 2016 07:29:55 +0000 (17:29 +1000)]
drm/nouveau: pass nvif_client to nouveau_gem_new() instead of drm_device

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: pass nvif_client to nouveau_bo_new() instead of drm_device
Ben Skeggs [Tue, 24 May 2016 07:26:48 +0000 (17:26 +1000)]
drm/nouveau: pass nvif_client to nouveau_bo_new() instead of drm_device

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/memory: distinguish between coherent/non-coherent targets
Ben Skeggs [Tue, 10 May 2016 02:42:26 +0000 (12:42 +1000)]
drm/nouveau/core/memory: distinguish between coherent/non-coherent targets

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/mm: replace region list with next pointer
Ben Skeggs [Sat, 3 Oct 2015 07:34:25 +0000 (17:34 +1000)]
drm/nouveau/core/mm: replace region list with next pointer

We never have any need for a double-linked list here, and as there's
generally a large number of these objects, replace it with a single-
linked list in order to save some memory.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/client: allow creation of subclients
Ben Skeggs [Sun, 22 May 2016 10:35:16 +0000 (20:35 +1000)]
drm/nouveau/core/client: allow creation of subclients

We want a supervisor client of NVKM (such as the DRM) to be able to
allow sharing of resources (such as memory objects) between clients.

To allow this, the supervisor creates all its clients as children of
itself, and will use an upcoming ioctl to permit sharing.

Currently it's not possible for indirect clients to use subclients.
Supporting this will require an additional field in the main ioctl.
This isn't important currently, but will need to be fixed for virt.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/client: pass notification callback to nvkm_client_new
Ben Skeggs [Wed, 25 May 2016 07:08:21 +0000 (17:08 +1000)]
drm/nouveau/core/client: pass notification callback to nvkm_client_new

Preparation for supporting subclients.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/client: destroy client objects over nvif
Ben Skeggs [Wed, 25 May 2016 07:02:11 +0000 (17:02 +1000)]
drm/nouveau/core/client: destroy client objects over nvif

Preparation for supporting subclients, and also good for consistency.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/client: use standard object dtor/init/fini paths
Ben Skeggs [Sun, 22 May 2016 22:42:54 +0000 (08:42 +1000)]
drm/nouveau/core/client: use standard object dtor/init/fini paths

Preparation for supporting subclients, and also good for consistency.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/client: modify prefix on nvif structures, for consistency
Ben Skeggs [Wed, 25 May 2016 22:43:00 +0000 (08:43 +1000)]
drm/nouveau/core/client: modify prefix on nvif structures, for consistency

Preparation for supporting subclients.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/object: pass more args in oclass
Ben Skeggs [Wed, 25 May 2016 07:47:18 +0000 (17:47 +1000)]
drm/nouveau/core/object: pass more args in oclass

The fields were already in struct nvkm_oclass for some reason (probably
as an accidental left-over).

Preparation for supporting subclients.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/object: pass client directly to ioctl handlers
Ben Skeggs [Wed, 25 May 2016 07:33:36 +0000 (17:33 +1000)]
drm/nouveau/core/object: pass client directly to ioctl handlers

nvkm_object::client refers to the client that created the object, which,
is currently always the same as the ioctl caller.

Upcoming patches introduce the concept of subclients, where a parent is
able to access the object trees of its children, making the above no
longer true.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/dma: lookup objects with nvkm_object_search()
Ben Skeggs [Tue, 17 May 2016 09:40:29 +0000 (19:40 +1000)]
drm/nouveau/dma: lookup objects with nvkm_object_search()

Custom code is no longer needed here.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/client: lookup client objects with nvkm_object_search()
Ben Skeggs [Thu, 22 Dec 2016 05:23:04 +0000 (15:23 +1000)]
drm/nouveau/core/client: lookup client objects with nvkm_object_search()

Custom code is no longer needed here.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/object: support lookup of specific object types
Ben Skeggs [Thu, 22 Dec 2016 05:22:25 +0000 (15:22 +1000)]
drm/nouveau/core/object: support lookup of specific object types

It turns out we have a nice and convenient way of looking up a specific
object type already, by using the func pointer as a key.

This will be used to remove the separate object trees for each type we
need to be able to search for.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/dma: use rb_entry()
Geliang Tang [Tue, 20 Dec 2016 14:02:11 +0000 (22:02 +0800)]
drm/nouveau/dma: use rb_entry()

To make the code clearer, use rb_entry() instead of container_of() to
deal with rbtree.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agoreplace BUG_ON(1) with BUG()
Ben Skeggs [Thu, 3 Mar 2016 02:56:33 +0000 (12:56 +1000)]
replace BUG_ON(1) with BUG()

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/gr/nv50-mcp89: add defines for gr classes
Ben Skeggs [Wed, 21 Dec 2016 02:46:50 +0000 (12:46 +1000)]
drm/nouveau/gr/nv50-mcp89: add defines for gr classes

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/gr/gf100-: fix ccache error logging
Ben Skeggs [Thu, 22 Dec 2016 00:07:49 +0000 (10:07 +1000)]
drm/nouveau/gr/gf100-: fix ccache error logging

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/disp/g94: remove unused sor implementation
Ben Skeggs [Thu, 22 Dec 2016 00:07:27 +0000 (10:07 +1000)]
drm/nouveau/disp/g94: remove unused sor implementation

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fb/ram/gk104: remove unused best_clk variable
Ben Skeggs [Thu, 22 Dec 2016 00:06:54 +0000 (10:06 +1000)]
drm/nouveau/fb/ram/gk104: remove unused best_clk variable

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: clear halt interrupt after ACR is run
Alexandre Courbot [Wed, 14 Dec 2016 08:02:52 +0000 (17:02 +0900)]
drm/nouveau/secboot: clear halt interrupt after ACR is run

The halt interrupt must be cleared after ACR is run, otherwise the LS
PMU firmware will not be able to run.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: add lazy-bootstrap flag
Alexandre Courbot [Wed, 14 Dec 2016 08:02:50 +0000 (17:02 +0900)]
drm/nouveau/secboot: add lazy-bootstrap flag

When the PMU firmware is present, the falcons it manages need to have
the lazy-bootstrap flag of their WPR header set so the ACR does not boot
them. Add support for this.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: fix WPR descriptor generation
Alexandre Courbot [Wed, 14 Dec 2016 08:02:49 +0000 (17:02 +0900)]
drm/nouveau/secboot: fix WPR descriptor generation

Generate the WPR descriptor closer to what RM does. In particular, set
the expected masks, and only set the ucode members on Tegra.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: set default error value in error register
Alexandre Courbot [Wed, 14 Dec 2016 08:02:48 +0000 (17:02 +0900)]
drm/nouveau/secboot: set default error value in error register

Set a default error value in the mailbox 0 register so we can catch
cases where the secure boot binary fails early without being able to
report anything.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: add missing fields to BL structure
Alexandre Courbot [Wed, 14 Dec 2016 08:02:47 +0000 (17:02 +0900)]
drm/nouveau/secboot: add missing fields to BL structure

Since DMEM was initialized to zero, these fields went unnoticed. Add
them for safety.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: safer zeroing of BL descriptors
Alexandre Courbot [Wed, 14 Dec 2016 08:02:46 +0000 (17:02 +0900)]
drm/nouveau/secboot: safer zeroing of BL descriptors

Perform the zeroing of BL descriptors in the caller function instead of
trusting each generator will do it. This could avoid a few pulled hairs.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: abstract LS firmware loading functions
Alexandre Courbot [Wed, 14 Dec 2016 08:02:45 +0000 (17:02 +0900)]
drm/nouveau/secboot: abstract LS firmware loading functions

The WPR and LSB headers, used to generate the LS blob, may have a
different layout and sizes depending on the driver version they come
from. Abstract them and confine their use to driver-specific code.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: remove ls_ucode_mgr
Alexandre Courbot [Wed, 14 Dec 2016 08:02:44 +0000 (17:02 +0900)]
drm/nouveau/secboot: remove ls_ucode_mgr

This was used only locally to one function and can be replaced by ad-hoc
variables.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: remove unneeded ls_ucode_img member
Alexandre Courbot [Wed, 14 Dec 2016 08:02:43 +0000 (17:02 +0900)]
drm/nouveau/secboot: remove unneeded ls_ucode_img member

ucode_header is not used anywhere, so just get rid of it.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: disable falcon interrupts when running blob
Alexandre Courbot [Wed, 14 Dec 2016 08:02:42 +0000 (17:02 +0900)]
drm/nouveau/secboot: disable falcon interrupts when running blob

Make sure we are not disturbed by spurious interrupts, as we poll the
halt bit anyway.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: split reset function
Alexandre Courbot [Wed, 14 Dec 2016 08:02:41 +0000 (17:02 +0900)]
drm/nouveau/secboot: split reset function

Split the reset function into more meaningful and reusable ones.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: add LS flags to LS func structure
Alexandre Courbot [Wed, 14 Dec 2016 08:02:40 +0000 (17:02 +0900)]
drm/nouveau/secboot: add LS flags to LS func structure

Add a flag that can be set when declaring how a LS firmware should be
loaded. This allows us to remove falcon-specific code in the loader.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: reorganize into more files
Alexandre Courbot [Wed, 14 Dec 2016 08:02:39 +0000 (17:02 +0900)]
drm/nouveau/secboot: reorganize into more files

Split the act of building the ACR blob from firmware files from the rest
of the (chip-dependent) secure boot logic. ACR logic is moved into
acr_rxxx.c files, where rxxx corresponds to the compatible release of
the NVIDIA driver. At the moment r352 and r361 are supported since
firmwares have been released for these versions. Some abstractions are
added on top of r352 so r361 can easily be implemented on top of it by
just overriding a few hooks.

This split makes it possible and easy to reuse the same ACR version on
different chips. It also hopefully makes the code much more readable as
the different secure boot logics are separated. As more chips and
firmware versions will be supported, this is a necessity to not get lost
in code that is already quite complex.

This is a big commit, but it essentially moves things around (and split
the nvkm_secboot structure into two, nvkm_secboot and nvkm_acr). Code
semantics should not be affected.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: generate HS BL descriptor in hook
Alexandre Courbot [Wed, 14 Dec 2016 08:02:38 +0000 (17:02 +0900)]
drm/nouveau/secboot: generate HS BL descriptor in hook

Use the HS hook to completely generate the HS BL descriptor, similarly
to what is done in the LS hook, instead of (arbitrarily) using the
acr_v1 format as an intermediate.

This allows us to make the bootloader descriptor structures private to
each implementation, resulting in a cleaner an more consistent design.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: add low-secure firmware hooks
Alexandre Courbot [Wed, 14 Dec 2016 08:02:37 +0000 (17:02 +0900)]
drm/nouveau/secboot: add low-secure firmware hooks

Secure firmwares provided by NVIDIA will follow the same overall
principle, but may slightly differ in format, or not use the same
bootloader descriptor even on the same chip. In order to handle
this as gracefully as possible, turn the LS firmware functions into
hooks that can be overloaded as needed.

The current hooks cover the external firmware loading as well as the
bootloader descriptor generation.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: remove fixup_hs_desc hook
Alexandre Courbot [Wed, 14 Dec 2016 08:02:36 +0000 (17:02 +0900)]
drm/nouveau/secboot: remove fixup_hs_desc hook

This hook can be removed if the function writing the HS
descriptor is aware of WPR settings. Let's do that as it allows us to
make the ACR descriptor structure private and save some code.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: rename init() hook to oneinit()
Alexandre Courbot [Wed, 14 Dec 2016 08:02:35 +0000 (17:02 +0900)]
drm/nouveau/secboot: rename init() hook to oneinit()

The init() hook is called by the subdev's oneinit(). Rename it
accordingly to avoid confusion about the lifetime of objects allocated
in it.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: remove nvkm_secboot_start()
Alexandre Courbot [Tue, 13 Dec 2016 08:11:31 +0000 (17:11 +0900)]
drm/nouveau/secboot: remove nvkm_secboot_start()

Since GR has moved to using the falcon library to start the falcons,
this function is not needed anymore.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/gr/gf100: instantiate and reserve GR falcons
Alexandre Courbot [Tue, 13 Dec 2016 08:11:30 +0000 (17:11 +0900)]
drm/nouveau/gr/gf100: instantiate and reserve GR falcons

Create instances for the FECS and GPCCS falcons and use the init() and
fini() hooks to reserve them for as long as GR controls them.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/gr/gf100: split gf100_gr_init_ctxctl()
Alexandre Courbot [Tue, 13 Dec 2016 08:11:29 +0000 (17:11 +0900)]
drm/nouveau/gr/gf100: split gf100_gr_init_ctxctl()

gf100_gr_init_ctxctl() is basically two different functions (one for
use of internal firmware, the other for use of external firmware), but
its current layout makes it look more complex than it is. Split it to
better reflect that fact.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/gr: add fini() hook
Alexandre Courbot [Tue, 13 Dec 2016 08:11:28 +0000 (17:11 +0900)]
drm/nouveau/gr: add fini() hook

Add a fini() hook to the GR engine. This will be used by gf100+ to
properly release the FECS and GPCCS falcons.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: use falcon library
Alexandre Courbot [Tue, 13 Dec 2016 08:11:27 +0000 (17:11 +0900)]
drm/nouveau/secboot: use falcon library

Use the falcon library functions in secure boot. This removes a lot of
code and makes the secure boot flow easier to understand as no register
is directly accessed.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: fix functions definitions
Alexandre Courbot [Tue, 13 Dec 2016 08:11:26 +0000 (17:11 +0900)]
drm/nouveau/secboot: fix functions definitions

These functions should use the nvkm_secboot_falcon enum. Fix this.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/gm20b: add dummy PMU device
Alexandre Courbot [Tue, 13 Dec 2016 08:11:25 +0000 (17:11 +0900)]
drm/nouveau/gm20b: add dummy PMU device

Add a dummy PMU device so the PMU falcon is instanciated and can be used
by secure boot.

We could reuse gk20a's implementation here, but it would fight with
secboot over PMU falcon's ownership and secboot will reset the PMU,
preventing it from operating afterwards. Proper handout between secboot
and pmu is coming along with the actual gm20b PMU implementation, so
use this as a temporary solution.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pmu/gk20a: use falcon library functions
Alexandre Courbot [Tue, 13 Dec 2016 08:11:24 +0000 (17:11 +0900)]
drm/nouveau/pmu/gk20a: use falcon library functions

Use the falcon library functions where relevant.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pmu/gk20a: simplify code a bit
Alexandre Courbot [Tue, 13 Dec 2016 08:11:23 +0000 (17:11 +0900)]
drm/nouveau/pmu/gk20a: simplify code a bit

Some functions always succeed - change their return type to void and
remove the error-handling code in their caller.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pmu/gk20a: use nvkm_pmu_ctor()
Alexandre Courbot [Tue, 13 Dec 2016 08:11:22 +0000 (17:11 +0900)]
drm/nouveau/pmu/gk20a: use nvkm_pmu_ctor()

Use the PMU constructor so that all base members (in particular the
falcon instance) are initialized properly.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pmu: instanciate the falcon in PMU device
Alexandre Courbot [Tue, 13 Dec 2016 08:11:20 +0000 (17:11 +0900)]
drm/nouveau/pmu: instanciate the falcon in PMU device

Have an instance of nvkm_falcon in the PMU structure, ready to be used
by other subdevs (i.e. secboot).

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pmu: add nvkm_pmu_ctor() function
Alexandre Courbot [Tue, 13 Dec 2016 08:11:21 +0000 (17:11 +0900)]
drm/nouveau/pmu: add nvkm_pmu_ctor() function

Add a PMU constructor so implementations that extend the nvkm_pmu
structure can have all base members properly initialized.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core: add falcon library functions
Alexandre Courbot [Tue, 13 Dec 2016 08:11:19 +0000 (17:11 +0900)]
drm/nouveau/core: add falcon library functions

Falcon processors are used in various places of GPU chips. Although there
exist different versions of the falcon, and some variants exist, the
base set of actions performed on them is the same, which results in lots
of duplicated code.

This patch consolidates the current nvkm_falcon structure and extends it
with the following features:

* Ability for an engine to obtain and later release a given falcon,
* Abstractions for basic operations (IMEM/DMEM access, start, etc)
* Abstractions for secure operations if a falcon is secure

Abstractions make it easy to e.g. start a falcon, without having to care
about its details. For instance, falcons in secure mode need to be
started by writing to a different register.

Right now the abstractions variants only cover secure vs. non-secure
falcon, but more will come as e.g. SEC2 support is added.

This is still a WIP as other functions previously done by
engine/falcon.c need to be reimplemented. However this first step allows
to keep things simple and to discuss basic design.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/mc: add nvkm_mc_enabled() function
Alexandre Courbot [Tue, 13 Dec 2016 08:11:18 +0000 (17:11 +0900)]
drm/nouveau/mc: add nvkm_mc_enabled() function

Add a function that allows us to query whether a given subdev is
currently enabled or not.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core: constify nv*_printk macros
Alexandre Courbot [Tue, 13 Dec 2016 08:11:17 +0000 (17:11 +0900)]
drm/nouveau/core: constify nv*_printk macros

Constify the local variables declared in these macros so we can pass
const pointers to them.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agoRevert "drm: Resurrect atomic rmfb code, v3"
Dave Airlie [Fri, 17 Feb 2017 02:38:46 +0000 (12:38 +1000)]
Revert "drm: Resurrect atomic rmfb code, v3"

This reverts commit 1592364de3912dad264262f4bcc61552984c9523.

This apparantly causes some regressions so pull it out for now.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoMerge tag 'omapdrm-4.11-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba...
Dave Airlie [Fri, 17 Feb 2017 02:04:09 +0000 (12:04 +1000)]
Merge tag 'omapdrm-4.11-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux into drm-next

omapdrm fixes for v4.11

Fix regressions:
- Planes might have been left enabled
- Scaling checks did not use the new config

Also limit downscaling decimation to prevent HW underflows.

* tag 'omapdrm-4.11-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux:
  drm/omapdrm: dispc: Refuse x-decimation above 4 for all but 8-bit formats
  drm/omapdrm: Move commit_modeset_enables() before commit_planes()
  Revert "drm: omapdrm: Let the DRM core skip plane commit on inactive CRTCs"

7 years agoMerge branch 'drm-next-4.11' of git://people.freedesktop.org/~agd5f/linux into drm-next
Dave Airlie [Fri, 17 Feb 2017 01:55:12 +0000 (11:55 +1000)]
Merge branch 'drm-next-4.11' of git://people.freedesktop.org/~agd5f/linux into drm-next

Fixes for 4.11. Highlights:
- fix >2 displays on asics with 3 or 5 crtcs
- fix SI headless asics
- powerplay fixes for new polaris variants
- misc fixes

* 'drm-next-4.11' of git://people.freedesktop.org/~agd5f/linux:
  drm/amdgpu: fix warning on older gcc releases
  drm/ttm: make TTM_MAX_BO_PRIORITY unsigned
  drm/amd/amdgpu: Fix flow control in uvd_v4_2_stop()
  drm/amd/powerplay: add didt config table for polaris kicker
  drm/amd/powerplay: modify VddcPhase value for polaris kicker
  drm/amd/powerplay: add kicker flag into smumgr
  drm/amdgpu: Initialize pipe priority order on graphic initialization
  drm/amdgpu: read hw register to check pg status.
  drm/amdgpu: Add to initialization of mmVCE_VCPU_CNTL register
  drm/amdgpu/pm: check for headless before calling compute_clocks
  drm/amdgpu: use amdgpu_gem_va_check() in amdgpu_gem_va_update_vm()
  drm/amdgpu: add more cases to DCE11 possible crtc mask setup

7 years agodrm/amdgpu: fix warning on older gcc releases
Arnd Bergmann [Fri, 3 Feb 2017 16:47:26 +0000 (17:47 +0100)]
drm/amdgpu: fix warning on older gcc releases

gcc-4.8 warns about '{0}' being used an an initializer for nested structures:

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c: In function ‘gfx_v8_0_ring_emit_ce_meta_init’:
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c:7263:2: warning: missing braces around initializer [-Wmissing-braces]
  } ce_payload = {0};
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c: In function ‘gfx_v8_0_ring_emit_de_meta_init’:
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c:7290:2: warning: missing braces around initializer [-Wmissing-braces]
  } de_payload = {0};

Using an empty {} initializer however has the same effect and works on all versions.

Fixes: acad2b2a7b70 ("drm/amdgpu:implement CE/DE meta-init routines")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/ttm: make TTM_MAX_BO_PRIORITY unsigned
Nicolai Hähnle [Tue, 14 Feb 2017 10:06:52 +0000 (11:06 +0100)]
drm/ttm: make TTM_MAX_BO_PRIORITY unsigned

Fix a warning about different types in min() macro in amdgpu:

In file included from ./include/linux/list.h:8:0,
                 from drivers/gpu/drm/amd/amdgpu/amdgpu_object.c:32:
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c: In function ‘amdgpu_bo_create_restricted’:
./include/linux/kernel.h:739:16: warning: comparison of distinct pointer types lacks a cast
  (void) (&min1 == &min2);   \
                ^
./include/linux/kernel.h:742:2: note: in expansion of macro ‘__min’
  __min(typeof(x), typeof(y),   \
  ^~~~~
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c:434:21: note: in expansion of macro ‘min’
  bo->tbo.priority = min(bo->tbo.priority, TTM_MAX_BO_PRIORITY - 1);
                     ^~~

Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Fix flow control in uvd_v4_2_stop()
Tom St Denis [Mon, 13 Feb 2017 19:11:40 +0000 (14:11 -0500)]
drm/amd/amdgpu: Fix flow control in uvd_v4_2_stop()

Break out of outer loop properly.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: add didt config table for polaris kicker
Huang Rui [Mon, 13 Feb 2017 02:38:08 +0000 (10:38 +0800)]
drm/amd/powerplay: add didt config table for polaris kicker

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: modify VddcPhase value for polaris kicker
Huang Rui [Fri, 10 Feb 2017 08:55:18 +0000 (16:55 +0800)]
drm/amd/powerplay: modify VddcPhase value for polaris kicker

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: add kicker flag into smumgr
Huang Rui [Fri, 10 Feb 2017 08:42:19 +0000 (16:42 +0800)]
drm/amd/powerplay: add kicker flag into smumgr

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/virtio: call drm_plane_cleanup() at destroy phase
Gustavo Padovan [Wed, 15 Feb 2017 18:00:08 +0000 (16:00 -0200)]
drm/virtio: call drm_plane_cleanup() at destroy phase

virtio was missing this call to clean up core plane usage.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170215180009.7091-1-gustavo@padovan.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm/omapdrm: dispc: Refuse x-decimation above 4 for all but 8-bit formats
Jyri Sarha [Wed, 8 Feb 2017 14:08:06 +0000 (16:08 +0200)]
drm/omapdrm: dispc: Refuse x-decimation above 4 for all but 8-bit formats

Let's disable all scaling that requires horizontal decimation with
higher factor than 4, until we have better estimates of what we can
and can not do. However, NV12 color format appears to work Ok with
all decimation factors.

When decimating horizontally by more that 4 the dss is not able to
fetch the data in burst mode. When this happens it is hard to tell if
there enough bandwidth. Despite what theory says this appears to be
true also for 16-bit color formats.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
7 years agodrm/omapdrm: Move commit_modeset_enables() before commit_planes()
Jyri Sarha [Fri, 27 Jan 2017 10:04:55 +0000 (12:04 +0200)]
drm/omapdrm: Move commit_modeset_enables() before commit_planes()

Move drm_atomic_helper_commit_modeset_enables() call to before
drm_atomic_helper_commit_planes() call and have a
omap_atomic_wait_for_completion() call after both.

With the current dss dispc implementation we have to enable the new
modeset before we can commit planes. The dispc ovl configuration
relies on the video mode configuration been written into the HW when
the ovl configuration is calculated.

This approach is not ideal because after a mode change the plane
update is executed only after the first vblank interrupt. The dispc
implementation should be fixed so that it is able use uncommitted drm
state information.  information.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
7 years agoRevert "drm: omapdrm: Let the DRM core skip plane commit on inactive CRTCs"
Jyri Sarha [Fri, 27 Jan 2017 10:04:54 +0000 (12:04 +0200)]
Revert "drm: omapdrm: Let the DRM core skip plane commit on inactive CRTCs"

This reverts commit dadf4659d0608e034b6633f30300c2eff2dafb4c.

If planes are not disabled when the they are not on any crtc anymore
they will remain active and may show as "ghosts" when the crtc they
were last on is active again.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
7 years agodrm/i915: Fix not finding the VBT when it overlaps with OPREGION_ASLE_EXT
Hans de Goede [Tue, 14 Feb 2017 16:12:38 +0000 (18:12 +0200)]
drm/i915: Fix not finding the VBT when it overlaps with OPREGION_ASLE_EXT

If there is no OPREGION_ASLE_EXT then a VBT stored in mailbox #4 may
use the ASLE_EXT parts of the opregion. Adjust the vbt_size calculation
for a vbt in mailbox #4 for this.

This fixes the driver not finding the VBT on a jumper ezpad mini3
cherrytrail tablet and on a ACER SW5_017 machine.

Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1487088758-30050-1-git-send-email-jani.nikula@intel.com
(cherry picked from commit dfb65e71ea2c1d97ac373cc0587dc60b3307581a)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915: Pass timeout==0 on to i915_gem_object_wait_fence()
Chris Wilson [Sun, 12 Feb 2017 21:53:43 +0000 (21:53 +0000)]
drm/i915: Pass timeout==0 on to i915_gem_object_wait_fence()

The i915_gem_object_wait_fence() uses an incoming timeout=0 to query
whether the current fence is busy or idle, without waiting. This can be
used by the wait-ioctl to implement a busy query.

Fixes: e95433c73a11 ("drm/i915: Rearrange i915_wait_request() accounting with callers")
Testcase: igt/gem_wait/basic-busy-write-all
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.william.auld@gmail.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.10-rc1+
Cc: stable@vger.kernel.org
Link: http://patchwork.freedesktop.org/patch/msgid/20170212215344.16600-1-chris@chris-wilson.co.uk
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
(cherry picked from commit d892e9398ecf6defc7972a62227b77dad6be20bd)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915/gvt: Disable access to stolen memory as a guest
Chris Wilson [Wed, 9 Nov 2016 10:39:05 +0000 (10:39 +0000)]
drm/i915/gvt: Disable access to stolen memory as a guest

Explicitly disable stolen memory when running as a guest in a virtual
machine, since the memory is not mediated between clients and reserved
entirely for the host. The actual size should be reported as zero, but
like every other quirk we want to tell the user what is happening.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99028
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161109103905.17860-1-chris@chris-wilson.co.uk
Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: stable@vger.kernel.org
(cherry picked from commit 04a68a35ce6d7b54749989f943993020f48fed62)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915: Avoid spurious WARNs about the wrong pipe in the PPS code
Ville Syrjälä [Wed, 8 Feb 2017 17:52:54 +0000 (19:52 +0200)]
drm/i915: Avoid spurious WARNs about the wrong pipe in the PPS code

Until recently vlv_steal_power_sequencer() wasn't being called for
normal DP ports, and hence it could assert that it should only be
called for pipe A and B (since pipe C doesn't support eDP). However
that changed when we started to consider normal DP ports as well when
choosing a PPS. So we will now get spurious warnings when
vlv_steal_power_sequencer() does get called for pipe C. Avoid this by
moving the WARN down into vlv_detach_power_sequencer() where this
assertion should still hold.

Cc: Imre Deak <imre.deak@intel.com>
Cc: stable@vger.kernel.org
Fixes: 9f2bdb006a7e ("drm/i915: Prevent PPS stealing from a normal DP port on VLV/CHV")
References: https://bugs.freedesktop.org/show_bug.cgi?id=95287
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170208175254.10958-1-ville.syrjala@linux.intel.com
Reviewed-by: Imre Deak <imre.deak@intel.com>
(cherry picked from commit d158694f452252d0fef335a775aeb3eb74fe7af0)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915: Check for timeout completion when waiting for the rq to submitted
Chris Wilson [Wed, 8 Feb 2017 18:12:38 +0000 (18:12 +0000)]
drm/i915: Check for timeout completion when waiting for the rq to submitted

We first wait for a request to be submitted to hw and assigned a seqno,
before we can wait for the hw to signal completion (otherwise we don't
know the hw id we need to wait upon). Whilst waiting for the request to
be submitted, we may exceed the user's timeout and need to propagate the
error back.

v2: Make ETIME into an error from wait_for_execute for consistent exit
handling.

Reported-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Fixes: 4680816be336 ("drm/i915: Wait first for submission, before waiting for request completion")
Testcase: igt/gem_wait/basic-await
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.10-rc1+
Cc: stable@vger.kernel.org
Link: http://patchwork.freedesktop.org/patch/msgid/20170208181238.7232-1-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
(cherry picked from commit 969bb72cbfd906d347cf76dc9b8c8dbaf83ba27a)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915: A hotfix for making aliasing PPGTT work for GVT-g
Zhi Wang [Wed, 8 Feb 2017 13:03:33 +0000 (21:03 +0800)]
drm/i915: A hotfix for making aliasing PPGTT work for GVT-g

This patch makes PPGTT page table non-shrinkable when using aliasing PPGTT
mode. It's just a temporary solution for making GVT-g work.

Fixes: 2ce5179fe826 ("drm/i915/gtt: Free unused lower-level page tables")
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Michal Winiarski <michal.winiarski@intel.com>
Cc: Michel Thierry <michel.thierry@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: Zhiyuan Lv <zhiyuan.lv@intel.com>
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1486559013-25251-2-git-send-email-zhi.a.wang@intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: <stable@vger.kernel.org> # v4.10
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
(cherry picked from commit e81ecb5e31db6c2a259d694738cf620d9fa70861)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915: Restore context and pd for ringbuffer submission after reset
Chris Wilson [Tue, 7 Feb 2017 15:24:37 +0000 (15:24 +0000)]
drm/i915: Restore context and pd for ringbuffer submission after reset

Following a reset, the context and page directory registers are lost.
However, the queue of requests that we resubmit after the reset may
depend upon them - the registers are restored from a context image, but
that restore may be inhibited and may simply be absent from the request
if it was in the middle of a sequence using the same context. If we
prime the CCID/PD registers with the first request in the queue (even
for the hung request), we prevent invalid memory access for the
following requests (and continually hung engines).

v2: Magic BIT(8), reserved for future use but still appears unused.
v3: Some commentary on handling innocent vs guilty requests
v4: Add a wait for PD_BASE fetch. The reload appears to be instant on my
Ivybridge, but this bit probably exists for a reason.

Fixes: 821ed7df6e2a ("drm/i915: Update reset path to fix incomplete requests")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170207152437.4252-1-chris@chris-wilson.co.uk
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
(cherry picked from commit c0dcb203fb009678e5be9e7782329dcfbbf16439)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915: Let execlist_update_context() cover !FULL_PPGTT mode.
Zhi Wang [Mon, 6 Feb 2017 10:37:16 +0000 (18:37 +0800)]
drm/i915: Let execlist_update_context() cover !FULL_PPGTT mode.

execlist_update_context() will try to update PDPs in a context before a
ELSP submission only for full PPGTT mode, while PDPs was populated during
context initialization. Now the latter code path is removed. Let
execlist_update_context() also cover !FULL_PPGTT mode.

Fixes: 34869776c76b ("drm/i915: check ppgtt validity when init reg state")
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Michal Winiarski <michal.winiarski@intel.com>
Cc: Michel Thierry <michel.thierry@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: Zhiyuan Lv <zhiyuan.lv@intel.com>
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1486377436-15380-1-git-send-email-zhi.a.wang@intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
(cherry picked from commit 04da811b3d821567e7a9a8a0baf48a6c1718b582)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915/lspcon: Fix resume time initialization due to unasserted HPD
Imre Deak [Fri, 27 Jan 2017 09:39:19 +0000 (11:39 +0200)]
drm/i915/lspcon: Fix resume time initialization due to unasserted HPD

During system resume time initialization the HPD level on LSPCON ports
can stay low for an extended amount of time, leading to failed AUX
transfers and LSPCON initialization. Fix this by waiting for HPD to get
asserted.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99178
Cc: Shashank Sharma <shashank.sharma@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: <stable@vger.kernel.org> # v4.9+
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1485509961-9010-3-git-send-email-imre.deak@intel.com
(cherry picked from commit 390b4e00241ce14ca3967c4698c8f6a158c5a674)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915/gen9+: Enable hotplug detection early
Imre Deak [Fri, 27 Jan 2017 09:39:18 +0000 (11:39 +0200)]
drm/i915/gen9+: Enable hotplug detection early

For LSPCON resume time initialization we need to sample the
corresponding pin's HPD level, but this is only available when HPD
detection is enabled. Currently we enable detection only when enabling
HPD interrupts which is too late, so bring the enabling of detection
earlier.

This is needed by the next patch.

Cc: Shashank Sharma <shashank.sharma@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: <stable@vger.kernel.org> # v4.9+
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1485509961-9010-2-git-send-email-imre.deak@intel.com
(cherry picked from commit 7fff8126d9cc902b2636d05d5d34894a75174993)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915: Reject set-tiling-ioctl with stride==0 and a tiling mode
Chris Wilson [Fri, 3 Feb 2017 10:56:52 +0000 (10:56 +0000)]
drm/i915: Reject set-tiling-ioctl with stride==0 and a tiling mode

In commit 957870f93412 ("drm/i915: Split out i915_gem_object_set_tiling()"),
I swapped an alignment check for IS_ALIGNED and in the process removed
the less-than check. That check turns out to be important as it was the
only rejection for stride == 0. Tvrtko did spot it, but I was
overconfident in the IS_ALIGNED() conversion.

Fixes: 957870f93412 ("drm/i915: Split out i915_gem_object_set_tiling()")
Testcase: igt/gem_tiling_max_stride
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170203105652.27819-1-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
(cherry picked from commit 52da22e7aba155be238faff4f6e97b2eb9de64f3)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915: Recreate internal objects with single page segments if dmar fails
Chris Wilson [Thu, 2 Feb 2017 13:27:21 +0000 (13:27 +0000)]
drm/i915: Recreate internal objects with single page segments if dmar fails

If we fail to dma-map the object, the most common cause is lack of space
inside the SW-IOTLB due to fragmentation. If we recreate the_sg_table
using segments of PAGE_SIZE (and single page allocations), we may succeed
in remapping the scatterlist.

First became a significant problem for the mock selftests after commit
5584f1b1d73e ("drm/i915: fix i915 running as dom0 under Xen") increased
the max_order.

Fixes: 920cf4194954 ("drm/i915: Introduce an internal allocator for disposable private objects")
Fixes: 5584f1b1d73e ("drm/i915: fix i915 running as dom0 under Xen")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170202132721.12711-1-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: <stable@vger.kernel.org> # v4.10
(cherry picked from commit bb96dcf5830e5d81a1da2e2a14e6c0f7dfc64348)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agoMerge tag 'gvt-next-2017-02-15' of https://github.com/01org/gvt-linux into drm-intel...
Jani Nikula [Thu, 16 Feb 2017 09:58:16 +0000 (11:58 +0200)]
Merge tag 'gvt-next-2017-02-15' of https://github.com/01org/gvt-linux into drm-intel-next-fixes

gvt-next-2017-02-15

- Chuanxiao's IOMMU workaround fix
- debug message cleanup from Changbin
- oops fix in fail path of workload submission when GPU reset from Changbin
- other misc fixes

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agoMerge tag 'gvt-next-2017-02-07' of https://github.com/01org/gvt-linux into drm-intel...
Jani Nikula [Thu, 16 Feb 2017 09:56:51 +0000 (11:56 +0200)]
Merge tag 'gvt-next-2017-02-07' of https://github.com/01org/gvt-linux into drm-intel-next-fixes

From Zhenyu, "These are GVT-g changes for 4.11 merge window, mostly for
gvt init order fix that impacted resource handling for device model, the
one i915 change has been reviewed and acked."

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodma-buf/dma-fence: improve doc for dma_fence_add_callback()
Gustavo Padovan [Wed, 15 Feb 2017 17:57:25 +0000 (15:57 -0200)]
dma-buf/dma-fence: improve doc for dma_fence_add_callback()

Document return values for this function.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170215175725.6692-1-gustavo@padovan.org
7 years agoMerge branch 'drm-rockchip-next-2017-02-16' of https://github.com/markyzq/kernel...
Dave Airlie [Thu, 16 Feb 2017 03:57:37 +0000 (13:57 +1000)]
Merge branch 'drm-rockchip-next-2017-02-16' of https://github.com/markyzq/kernel-drm-rockchip into drm-next

Use iommu for rockchip arm64 platform.

* 'drm-rockchip-next-2017-02-16' of https://github.com/markyzq/kernel-drm-rockchip:
  drm/rockchip: Use common IOMMU API to attach devices
  drm/rockchip: Do not use DMA mapping API if attached to IOMMU domain