Commit Graph

650182 Commits

Author SHA1 Message Date
Karol Herbst e5f8eabc00 drm/nouveau/bios/power_budget: Add basic power budget parsing
v2: Set entry to 0xff if not found
    Add cap entry for ver 0x30 tables
    Rework to fix memory leak
v3: More error checks
    Simplify check for invalid entries
v4: disable for ver 0x10 for now
    move assignments after the second last return

Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:16 +10:00
Ben Skeggs 75d115f2aa drm/nouveau/fifo/gk104-: preempt recovery
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:16 +10:00
Ben Skeggs 3ebef76a1d drm/nouveau/fifo/gk104-: trigger mmu fault before attempting engine recovery
Greatly improves the chances of recovering the GPU from a CTXSW_TIMEOUT.

Tested with piglit's arb_shader_image_load_store-atomicity, which causes
GR to hang in such a way that recovery failed (CTXSW_TIMEOUT continually
re-triggers).

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:15 +10:00
Ben Skeggs 03f16f5f27 drm/nouveau/fifo/gk104-: ACK SCHED_ERROR before attempting CTXSW_TIMEOUT recovery
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:15 +10:00
Ben Skeggs 91b9d659ab drm/nouveau/fifo/gk104-: directly use new recovery code for ctxsw timeout
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:14 +10:00
Ben Skeggs 3534821df5 drm/nouveau/fifo/gk104-: directly use new recovery code for mmu faults
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:14 +10:00
Ben Skeggs eaa5ed65ee drm/nouveau/fifo/gk104-: reset all engines a killed channel is still active on
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:13 +10:00
Ben Skeggs 0faaa47d44 drm/nouveau/fifo/gk104-: refactor recovery code
This will serve as a basis for implementing some improvements to how
we recover the GPU from channel errors.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:13 +10:00
Ben Skeggs ec5c6bda19 drm/nouveau/fifo/gk104-: better detection of chid when parsing engine status
The previous commit simply changes the interface, but should result in
the same behaviour as previously.  This commit has been split out from
it as it can result in a different channel being selected.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:12 +10:00
Ben Skeggs b88917fe0f drm/nouveau/fifo/gk104-: separate out engine status parsing
We'll be wanting to reuse this logic in more places.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:12 +10:00
Ben Skeggs 21e6de29bb drm/nouveau/fifo: add an api for initiating channel recovery
This will be used by callers outside of fifo interrupt handlers.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:12 +10:00
Ben Skeggs 13416077e5 drm/nouveau/top: add function to translate subdev index to mmu fault id
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:11 +10:00
Ben Skeggs 6845c313f7 drm/nouveau/gr/gf100-: implement chsw_load() method
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:11 +10:00
Ben Skeggs 71ce33a28a drm/nouveau/gr: implement chsw_load() method
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:10 +10:00
Ben Skeggs 17041c7eef drm/nouveau/core: add engine method to assist in determining chsw direction
FIFO gives us load/save/switch status, and we need to be able to determine
which direction a "switch" is failing during channel recovery.

In order to do this, we apparently need to query the engine itself.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:10 +10:00
Ben Skeggs 84cd0a5565 drm/nouveau: check for dead channel before trying to idle
This prevents *very* long waits while attempting to destroy channels
after a fault has occurred.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:09 +10:00
Ben Skeggs d8cc37d878 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>
2017-02-17 17:38:09 +10:00
Ben Skeggs ff9f29abf0 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>
2017-02-17 17:38:08 +10:00
Ben Skeggs 40cea73984 drm/nouveau/fifo/g84-: rename non-stall interrupt event
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:08 +10:00
Ben Skeggs e774055a07 drm/nouveau/fifo: tidy up channel creation event code
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:08 +10:00
Ben Skeggs 86d7442baa drm/nouveau/core: increase maximum number of notifies that a client can request
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:07 +10:00
Martin Peres ca33fafdc9 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>
2017-02-17 17:38:07 +10:00
Karol Herbst 443828fd9e 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>
2017-02-17 17:38:06 +10:00
Karol Herbst 725af74826 drm/nouveau/pci: Rename g94 to g92
Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:06 +10:00
Ben Skeggs 9f1c4dbd3d 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>
2017-02-17 17:38:05 +10:00
Ilia Mirkin 0879683280 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>
2017-02-17 17:38:05 +10:00
Ben Skeggs 4d8b3d34c3 drm/nouveau: size is u64 everywhere
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 17:38:04 +10:00
Ben Skeggs 605f9ccd7d drm/nouveau: s/mem/reg/ for struct ttm_mem_reg variables
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 15:15:04 +10:00
Ben Skeggs 1167c6bc51 drm/nouveau: allocate device object for every client
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 15:15:04 +10:00
Ben Skeggs 80e60973b2 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>
2017-02-17 15:15:03 +10:00
Ben Skeggs 20d8a88e55 drm/nouveau: tidy up the client init/fini interfaces
These were a little insane.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 15:15:03 +10:00
Ben Skeggs fc1b0a02ad drm/nouveau: pass nvif_client to nouveau_gem_new() instead of drm_device
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 15:15:02 +10:00
Ben Skeggs bab7cc18d3 drm/nouveau: pass nvif_client to nouveau_bo_new() instead of drm_device
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 15:15:02 +10:00
Ben Skeggs d2ee360564 drm/nouveau/core/memory: distinguish between coherent/non-coherent targets
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 15:15:01 +10:00
Ben Skeggs 134fdc1a70 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>
2017-02-17 15:15:01 +10:00
Ben Skeggs 04b8867758 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>
2017-02-17 15:15:00 +10:00
Ben Skeggs 7c413feb7f drm/nouveau/core/client: pass notification callback to nvkm_client_new
Preparation for supporting subclients.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 15:15:00 +10:00
Ben Skeggs 05da248bbe 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>
2017-02-17 15:14:59 +10:00
Ben Skeggs 2c3af924fb 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>
2017-02-17 15:14:59 +10:00
Ben Skeggs 03295eabdb drm/nouveau/core/client: modify prefix on nvif structures, for consistency
Preparation for supporting subclients.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 15:14:58 +10:00
Ben Skeggs 843faa030c 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>
2017-02-17 15:14:58 +10:00
Ben Skeggs a664869ac4 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>
2017-02-17 15:14:57 +10:00
Ben Skeggs 83e85d91b2 drm/nouveau/dma: lookup objects with nvkm_object_search()
Custom code is no longer needed here.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 15:14:57 +10:00
Ben Skeggs daad3dfb05 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>
2017-02-17 15:14:56 +10:00
Ben Skeggs 110cccff95 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>
2017-02-17 15:14:56 +10:00
Geliang Tang 05073caeed 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>
2017-02-17 15:14:55 +10:00
Ben Skeggs af7db03e1b replace BUG_ON(1) with BUG()
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 15:14:55 +10:00
Ben Skeggs 0233a9f403 drm/nouveau/gr/nv50-mcp89: add defines for gr classes
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 15:14:32 +10:00
Ben Skeggs 1894054dc1 drm/nouveau/gr/gf100-: fix ccache error logging
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 15:14:32 +10:00
Ben Skeggs fc13425365 drm/nouveau/disp/g94: remove unused sor implementation
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-02-17 15:14:32 +10:00