Commit Graph

709258 Commits

Author SHA1 Message Date
Jon Hunter
e062a01e6d drm/nouveau/bar/gk20a: Avoid bar teardown during init
Commit bbb163e189 ("drm/nouveau/bar: implement bar1 teardown")
introduced add a teardown helper function for BAR1. During
initialisation of the Nouveau, initially all the teardown helpers are
called once, before calling their init counterparts. For gk20a, after
the BAR1 teardown function is called, the device is hanging during the
initialisation of the FB sub-device. At this point it is unclear why
this is happening and this is still under investigation. However, this
change is preventing Tegra124 devices from booting when Nouveau is
enabled. To allow Tegra124 to boot, remove the teardown helper for
gk20a.

This is based upon a previous patch by Guillaume Tucker but limits
the workaround to only gk20a GPUs.

Fixes: bbb163e189 ("drm/nouveau/bar: implement bar1 teardown")
Reported-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2018-01-19 11:35:44 +10:00
Thierry Reding
b554b12add drm/nouveau/drm/nouveau: Pass the proper arguments to nvif_object_map_handle()
This is obviously wrong in the current code. Make sure to record the
correct size of the arguments and pass the actual arguments to the
nvif_object_map_handle() function.

Suggested-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2018-01-19 11:35:44 +10:00
Rob Clark
1b5c7ef3d0 drm/nouveau/disp/gf119: add missing drive vfunc ptr
Fixes broken dp on GF119:

  Call Trace:
   ? nvkm_dp_train_drive+0x183/0x2c0 [nouveau]
   nvkm_dp_acquire+0x4f3/0xcd0 [nouveau]
   nv50_disp_super_2_2+0x5d/0x470 [nouveau]
   ? nvkm_devinit_pll_set+0xf/0x20 [nouveau]
   gf119_disp_super+0x19c/0x2f0 [nouveau]
   process_one_work+0x193/0x3c0
   worker_thread+0x35/0x3b0
   kthread+0x125/0x140
   ? process_one_work+0x3c0/0x3c0
   ? kthread_park+0x60/0x60
   ret_from_fork+0x25/0x30
  Code:  Bad RIP value.
  RIP:           (null) RSP: ffffb1e243e4bc38
  CR2: 0000000000000000

Fixes: af85389c61 drm/nouveau/disp: shuffle functions around
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103421
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2018-01-09 11:42:13 +10:00
Ben Skeggs
b26a2319be drm/nouveau: fix race when adding delayed work items
kernel.org bz#198221.

Reported-by: Petr Vandrovec <petr@vandrovec.name>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-12-23 08:56:59 +10:00
Ben Skeggs
4ef9289299 drm/nouveau: fix obvious memory leak
fdo#104340.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-12-20 08:40:36 +10:00
Ben Skeggs
74a39954a4 drm/nouveau: use alternate memory type for system-memory buffers with kind != 0
Fixes bug on Tegra where we'd strip kind information from system memory
(ie. all) buffers, resulting in misrendering.

Behaviour on dGPU should be unchanged.

Reported-by: Thierry Reding <treding@nvidia.com>
Fixes: d7722134b8 ("drm/nouveau: switch over to new memory and vmm interfaces")
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Thierry Reding <treding@nvidia.com>
2017-12-19 10:16:37 +10:00
Ben Skeggs
f29f18eb95 drm/nouveau: avoid GPU page sizes > PAGE_SIZE for buffer objects in host memory
While the Tegra (GK20A, GM20B, GP10B) MMUs support large pages in host
memory, we're currently lacking IOMMU support for merging system pages
into large enough chunks to be mapped as such by the GPU.

The core VMM code actually supports automatically determining the best
page size to map with, which is intended for these situations, but for
various complicated reasons the DRM is currently forcing the page size
selection on a per-BO basis.

This should fix breakage reported on Tegra GPUs in the meantime, until
one or both of the above issues are resolved properly.

Reported-by: Mikko Perttunen <cyndis@kapsi.fi>
Fixes: 7dc6a446da ("drm/nouveau: improve selection of GPU page size")
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Thierry Reding <treding@nvidia.com>
2017-12-19 10:16:37 +10:00
Ben Skeggs
6cb0f2a39d drm/nouveau/mmu/gp10b: use correct implementation
Reported-by: Mikko Perttunen <cyndis@kapsi.fi>
Fixes: 6359c98224 ("drm/nouveau/mmu/gp10b: fork from gf100")
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Thierry Reding <treding@nvidia.com>
2017-12-19 10:16:37 +10:00
Karol Herbst
a121027d27 drm/nouveau/pci: do a msi rearm on init
On my GP107 when I load nouveau after unloading it, for some reason the
GPU stopped sending or the CPU stopped receiving interrupts if MSI was
enabled.

Doing a rearm once before getting any interrupts fixes this.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-12-19 10:16:37 +10:00
Ben Skeggs
81a24b9ae8 drm/nouveau/imem/nv50: fix refcount_t warning
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-12-19 10:16:37 +10:00
Ben Skeggs
f60707a69a drm/nouveau/bios/dp: support DP Info Table 2.0
Reported-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-12-19 10:16:37 +10:00
Karol Herbst
34112bf493 drm/nouveau/fbcon: fix NULL pointer access in nouveau_fbcon_destroy
When the fbcon object is initialized, but nouveau_fbcon_create is not
called, we run into a NULL pointer access within nouveau_fbcon_create when
unloading nouveau.

The call to drm_fb_helper_funcs.fb_probe is deferred until there is a
display for real since 4.14, that's why fbcon->helper.fb is still not set.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-12-19 10:16:37 +10:00
Gustavo A. R. Silva
d34ded7ece drm/nouveau/bios/timing: mark expected switch fall-throughs
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1260018
Addresses-Coverity-ID: 1260019
Addresses-Coverity-ID: 1260022
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-03 09:12:10 +10:00
Gustavo A. R. Silva
21dce3f464 drm/nouveau/devinit/nv04: mark expected switch fall-throughs
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 143119
Addresses-Coverity-ID: 143120
Addresses-Coverity-ID: 143121
Addresses-Coverity-ID: 143122
Addresses-Coverity-ID: 143123
Addresses-Coverity-ID: 143124
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-03 09:12:10 +10:00
Colin Ian King
1a5c8164b3 drm/nouveau/bios: make const arrays hwsq_signature and edid_sig static
Don't populate arrays hwsq_signature and edid_sig on the stack but
instead make them static. Makes the object code smaller by over 190
bytes:

Before:
   text    data     bss     dec     hex filename
  35676    3312      64   39052    988c nouveau_bios.o

After:
   text    data     bss     dec     hex filename
  35319    3472      64   38855    97c7 nouveau_bios.o

(gcc version 7.2.0 x86_64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-03 09:12:10 +10:00
Ben Skeggs
690f43ab1b drm/nouveau/core/memory: fix missing mutex unlock
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-03 09:12:10 +10:00
Ben Skeggs
6497c2baf2 drm/nouveau/mmu: swap out round for ALIGN
Rounding value is guaranteed to be power-of-two, so this is better
anyway.

Fixes build on 32-bit.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-03 09:12:09 +10:00
Ben Skeggs
46bda4f4af drm/nouveau/gr/gf100-: don't prevent module load if firmware missing
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:34 +10:00
Ben Skeggs
632b740c54 drm/nouveau/mmu: remove old vmm frontend
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:33 +10:00
Ben Skeggs
7dc6a446da drm/nouveau: improve selection of GPU page size
Enables the use of Pascal's 2MiB pages for larger buffers.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:33 +10:00
Ben Skeggs
d7722134b8 drm/nouveau: switch over to new memory and vmm interfaces
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:33 +10:00
Ben Skeggs
10842ba074 drm/nouveau: remove unused nouveau_fence_work()
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:33 +10:00
Ben Skeggs
00d041d087 drm/nouveau: queue delayed unmapping of VMAs on client workqueue
VMAs are about to not take references on the VMM they belong to, which
means more care is required when handling delayed unmapping.

Queuing it on the client workqueue ensures all pending VMA unmaps will
have completed before the VMM is destroyed.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:33 +10:00
Ben Skeggs
814a23243b drm/nouveau: implement per-client delayed workqueue with fence support
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:33 +10:00
Ben Skeggs
7f50762423 drm/nouveau: determine memory class for each client
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:33 +10:00
Ben Skeggs
832ca2ac3c drm/nouveau: pass handle of vmm object to channel allocation ioctls
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:33 +10:00
Ben Skeggs
3c5026395b drm/nouveau: switch to vmm limit
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:33 +10:00
Ben Skeggs
96da0bcd51 drm/nouveau: allocate vmm object for every client
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:32 +10:00
Ben Skeggs
acb16cfa95 drm/nouveau: replace use of cpu_coherent with memory types
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:32 +10:00
Ben Skeggs
b34720200b drm/nouveau: use nvif_mmu_type to determine BAR1 caching
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:32 +10:00
Ben Skeggs
658c71f4e7 drm/nouveau: fetch memory type indices that we care about for ttm
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:32 +10:00
Ben Skeggs
325a72827c drm/nouveau: consolidate handling of dma mask
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:32 +10:00
Ben Skeggs
a220dd7321 drm/nouveau: check kind validity against mmu object
This is already handled in the top-level gem_new() ioctl in another manner,
but this will be removed in a future commit.

Ideally we'd not need to check up-front at all, and let the VMM code handle
error checking, but there are paths in the current BO management code where
this isn't possible due to map() not always being called during BO creation,
and map() calls not being allowed to fail during buffer migration.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:32 +10:00
Ben Skeggs
01670a79d5 drm/nouveau: allocate mmu object for every client
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:32 +10:00
Ben Skeggs
359088d5b8 drm/nouveau: remove trivial cases of nvxx_device() usage
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:32 +10:00
Ben Skeggs
920d2b5ef2 drm/nouveau/mmu: define user interfaces to mmu vmm opertaions
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:31 +10:00
Ben Skeggs
c83c4097eb drm/nouveau/mmu: define user interfaces to mmu memory allocation
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:31 +10:00
Ben Skeggs
eea5cf0f01 drm/nouveau/mmu: define user interfaces to mmu
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:31 +10:00
Ben Skeggs
68af607d26 drm/nouveau/mmu/gf100-: type-based vram allocation and bar mapping
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:31 +10:00
Ben Skeggs
0766116157 drm/nouveau/mmu/nv50,g84: type-based vram allocation and bar mapping
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:31 +10:00
Ben Skeggs
957e18a70d drm/nouveau/mmu/nv04-nv4x: type-based vram allocation and bar mapping
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:31 +10:00
Ben Skeggs
eaf1a69110 drm/nouveau/mmu: add base for type-based memory allocation
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:31 +10:00
Ben Skeggs
51645eb714 drm/nouveau/mmu: build up information on available memory types
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:31 +10:00
Ben Skeggs
3a314f747b drm/nouveau: remove explicit unmaps
If the VMA is being deleted, we don't need to explicity unmap first
anymore.  The MMU code will automatically merge the operations into
a single page tree walk.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:31 +10:00
Ben Skeggs
2cabefcbd0 drm/nouveau/gr/gf100-: replace hardcoded instance/vmm setup in grctx generation
Could be useful for if/when a future GPU removes support for the GF100
PT layout.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:31 +10:00
Ben Skeggs
019e4d76c6 drm/nouveau/gr/gf100-: use new interfaces for vmm operations
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:31 +10:00
Ben Skeggs
01f349fcad drm/nouveau/fifo/gf100-: use new interfaces for vmm operations
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:31 +10:00
Ben Skeggs
8c967c5548 drm/nouveau/secboot/gm200: use new interfaces for vmm operations
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:30 +10:00
Ben Skeggs
9202d732e6 drm/nouveau/imem/nv50-: use new interfaces for vmm operations
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:30 +10:00
Ben Skeggs
6f4dc18c16 drm/nouveau/fb/ram: use new interfaces for vmm operations
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:30 +10:00