Commit Graph

39372 Commits

Author SHA1 Message Date
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
Ben Skeggs
f66c57d922 drm/nouveau/fifo: initialise vmm with new interfaces
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:30 +10:00
Ben Skeggs
85f7c3a036 drm/nouveau/secboot/gm200: initialise vmm with new interfaces
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:30 +10:00
Ben Skeggs
7eac5f4eb0 drm/nouveau/bar/gf100: initialise vmm with new interfaces
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:30 +10:00
Ben Skeggs
fc584e1a4a drm/nouveau/bar/nv50: initialise vmm with new interfaces
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:30 +10:00
Ben Skeggs
f9463a4bc8 drm/nouveau/mmu: implement new vmm frontend
These are the new priviledged interfaces to the VMM backends, and expose
some functionality that wasn't previously available.

It's now possible to allocate a chunk of address-space (even all of it),
without causing page tables to be allocated up-front, and then map into
it at arbitrary locations.  This is the basic primitive used to support
features such as sparse mapping, or to allow userspace control over its
own address-space, or HMM (where the GPU driver isn't in control of the
address-space layout).

Rather than being tied to a subtle combination of memory object and VMA
properties, arguments that control map flags (ro, kind, etc) are passed
explicitly at map time.

The compatibility hacks to implement the old frontend on top of the new
driver backends have been replaced with something similar to implement
the old frontend's interfaces on top of the new frontend.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:30 +10:00
Ben Skeggs
26880e7686 drm/nouveau/mmu: remove support for old backends
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:30 +10:00
Ben Skeggs
f9400afb1e drm/nouveau/mmu/gp100,gp10b: implement new vmm backend
Adds support for:
- 64KiB/2MiB big page sizes (128KiB not supported by HW with new PT layout).
- System-memory PTs.
- LPTE "invalid" state.
- (Tegra) Use of video memory aperture.
- Sparse PDEs/PTEs.
- Additional blocklinear kinds.
- 49-bit address-space.

GP100 supports an entirely new 5-level page table layout that provides
an expanded 49-bit address-space.  It also supports the layout present
on previous generations, which we've been making do with until now.

This commit implements support for the new layout, and enables it by
default.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:30 +10:00
Ben Skeggs
e12cf6ad43 drm/nouveau/mmu/gm200,gm20b: implement new vmm backend
Adds support for:
- 64KiB big page size.
- System-memory PTs.
- LPTE "invalid" state.
- (Tegra) Use of video memory aperture.
- Sparse PDEs/PTEs.
- Additional blocklinear kinds.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:29 +10:00
Ben Skeggs
b597764327 drm/nouveau/mmu/gk104,gk20a: implement new vmm backend
Adds support for:
- 64KiB big page size.
- System-memory PTs.
- LPTE "invalid" state.
- (Tegra) Use of video memory aperture.

Adds support for marking LPTEs invalid, resulting in the corresponding
SPTEs being ignored, which is supposed to speed up TLB invalidates.

On The Tegra side, this will switch to using the video memory aperture
for all mappings.  The HW will still target non-coherent system memory,
but this aperture needs to be selected in order to support compression.

Tegra's instmem backend somewhat cheated to get this effect previously.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:29 +10:00
Ben Skeggs
b77791da0e drm/nouveau/mmu/gf100: implement new vmm backend
Adds support for:
- 64KiB big page size.
- System-memory PTs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:29 +10:00
Ben Skeggs
fd542a3e52 drm/nouveau/mmu/nv50,g84: implement new vmm backend
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:29 +10:00
Ben Skeggs
6ce513529a drm/nouveau/mmu/nv44: implement new vmm backend
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:28 +10:00
Ben Skeggs
473f9aca6c drm/nouveau/mmu/nv41: implement new vmm backend
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:27 +10:00
Ben Skeggs
dd12d158eb drm/nouveau/mmu/nv04: implement new vmm backend
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:27 +10:00
Ben Skeggs
eb813999f2 drm/nouveau/mmu: implement new vmm backend
This is the common code to support a rework of the VMM backends.

It adds support for more than 2 levels of page table nesting, which
is required to be able to support GP100's MMU layout.

Sparse mappings (that don't cause MMU faults when accessed) are now
supported, where the backend provides it.

Dual-PT handling had to become more sophisticated to support sparse,
but this also allows us to support an optimisation the MMU provides
on GK104 and newer.

Certain operations can now be combined into a single page tree walk
to avoid some overhead, but also enables optimsations like skipping
PTE unmap writes when the PT will be destroyed anyway.

The old backend has been hacked up to forward requests onto the new
backend, if present, so that it's possible to bisect between issues
in the backend changes vs the upcoming frontend changes.

Until the new frontend has been merged, new backends will leak BAR2
page tables on module unload.  This is expected, and it's not worth
the effort of hacking around this as it doesn't effect runtime.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:27 +10:00
Ben Skeggs
bda9e379f6 drm/nouveau/fb/gm200: enable NV_PFB_MMU_CTRL_USE_FULL_COMP_TAG_LINE where appropriate
To avoid wasting compression tags when using 64KiB pages, we need to
enable this so we can select between upper/lower comptagline in PTEs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:27 +10:00
Ben Skeggs
f8a1203920 drm/nouveau/ltc/gm200: limit NV_MMU_PTE_COMPTAGLINE bits to 16 where required
If NV_PFB_MMU_CTRL_USE_FULL_COMP_TAG_LINE is TRUE, then the last bit of
NV_MMU_PTE_COMPTAGLINE is re-purposed to select the upper/lower half of
a compression tag when using 64KiB big pages.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:27 +10:00
Ben Skeggs
ac47c15b76 drm/nouveau/fifo/nv04-nv40: fix missing nvkm_kmap() calls around ramfc access
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:27 +10:00
Ben Skeggs
d30af7ce2c drm/nouveau/mmu: handle instance block setup
We previously required each VMM user to allocate their own page directory
and fill in the instance block themselves.

It makes more sense to handle this in a common location.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:27 +10:00
Ben Skeggs
af3b8d5386 drm/nouveau/mmu: remove old vm creation hooks
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:26 +10:00
Ben Skeggs
8e39abff45 drm/nouveau/mmu/gp100,gp10b: implement vmm on top of new base
Adds support for:
- Selection of old/new-style page table layout (GP100MmuLayout=0/1).
- System-memory PDs.

New layout disabled by default for the moment, as we don't have a
backend that can handle it yet.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:26 +10:00
Ben Skeggs
5f300fed64 drm/nouveau/mmu/gm200,gm20b: implement vmm on top of new base
Adds support for:
- Per-VMM selection of big page size.
- System-memory PDs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:26 +10:00
Ben Skeggs
7de078aa79 drm/nouveau/mmu/gk104,gk20a: implement vmm on top of new base
Adds support for:
- Selection of a 64KiB big page size (NvFbBigPage=16).
- System-memory PDs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:26 +10:00
Ben Skeggs
540a1dde57 drm/nouveau/mmu/gf100: implement vmm on top of new base
Adds support for:
- Selection of a 64KiB big page size (NvFbBigPage=16).
- System-memory PDs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:25 +10:00
Ben Skeggs
9f6219fde7 drm/nouveau/mmu/nv50,g84: implement vmm on top of new base
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:25 +10:00
Ben Skeggs
03b0ba7b54 drm/nouveau/mmu/nv44: implement vmm on top of new base
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:25 +10:00
Ben Skeggs
77783435c3 drm/nouveau/mmu/nv41: implement vmm on top of new base
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:25 +10:00
Ben Skeggs
5b17f3624e drm/nouveau/mmu/nv04: implement vmm on top of new base
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:25 +10:00
Ben Skeggs
806a733565 drm/nouveau/mmu: implement base for new vm management
This is the first chunk of the new VMM code that provides the structures
needed to describe a GPU virtual address-space layout, as well as common
interfaces to handle VMM creation, and connecting instances to a VMM.

The constructor now allocates the PD itself, rather than having the user
handle that manually.  This won't/can't be used until after all backends
have been ported to these interfaces, so a little bit of memory will be
wasted on Fermi and newer for a couple of commits in the series.

Compatibility has been hacked into the old code to allow each GPU backend
to be ported individually.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:25 +10:00
Ben Skeggs
f128039410 drm/nouveau/mmu: implement page table sub-allocation
GP100 "big" (which is a funny name, when it supports "even bigger") page
tables are small enough that we want to be able to suballocate them from
a larger block of memory.

This builds on the previous page table cache interfaces so that the VMM
code doesn't need to know the difference.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:24 +10:00
Ben Skeggs
9a45ddaaa6 drm/nouveau/mmu: implement page table cache
Builds up and maintains a small cache of each page table size in order
to reduce the frequency of expensive allocations, particularly in the
pathological case where an address range ping-pongs between allocated
and free.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:24 +10:00
Ben Skeggs
5e075fdeb1 drm/nouveau/mmu: automatically handle "un-bootstrapping" of vmm
Removes the need to expose internals outside of MMU, and GP100 is both
different, and a lot harder to deal with.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:24 +10:00
Ben Skeggs
6359c98224 drm/nouveau/mmu/gp10b: fork from gf100
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:24 +10:00
Ben Skeggs
b86a45877e drm/nouveau/mmu/gp100: fork from gf100
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:24 +10:00
Ben Skeggs
cedc4d57df drm/nouveau/mmu/gm20b: fork from gf100
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:24 +10:00
Ben Skeggs
e1e33c791a drm/nouveau/mmu/gm200: fork from gf100
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-11-02 13:32:24 +10:00