[Nouveau] [PATCH drm-misc-next v2 0/7] [RFC] DRM GPUVA Manager GPU-VM features
Danilo Krummrich
dakr at redhat.com
Wed Sep 6 21:47:08 UTC 2023
So far the DRM GPUVA manager offers common infrastructure to track GPU VA
allocations and mappings, generically connect GPU VA mappings to their
backing buffers and perform more complex mapping operations on the GPU VA
space.
However, there are more design patterns commonly used by drivers, which
can potentially be generalized in order to make the DRM GPUVA manager
represent a basic GPU-VM implementation. In this context, this patch series
aims at generalizing the following elements.
1) Provide a common dma-resv for GEM objects not being used outside of
this GPU-VM.
2) Provide tracking of external GEM objects (GEM objects which are
shared with other GPU-VMs).
3) Provide functions to efficiently lock all GEM objects dma-resv the
GPU-VM contains mappings of.
4) Provide tracking of evicted GEM objects the GPU-VM contains mappings
of, such that validation of evicted GEM objects is accelerated.
5) Provide some convinience functions for common patterns.
The implementation introduces struct drm_gpuvm_bo, which serves as abstraction
combining a struct drm_gpuvm and struct drm_gem_object, similar to what
amdgpu does with struct amdgpu_bo_vm. While this adds a bit of complexity it
improves the efficiency of tracking external and evicted GEM objects.
This patch series also renames struct drm_gpuva_manager to struct drm_gpuvm
including corresponding functions. This way the GPUVA manager's structures align
better with the documentation of VM_BIND [1] and VM_BIND locking [2]. It also
provides a better foundation for the naming of data structures and functions
introduced for implementing the features of this patch series.
Rather than being designed as a "framework", the target is to make all
features appear as a collection of optional helper functions, such that
drivers are free to make use of the DRM GPUVA managers basic
functionality and opt-in for other features without setting any feature
flags, just by making use of the corresponding functions.
This patch series is also available at [3].
[1] Documentation/gpu/drm-vm-bind-async.rst
[2] Documentation/gpu/drm-vm-bind-locking.rst
[3] https://gitlab.freedesktop.org/nouvelles/kernel/-/commits/gpuvm-next
Changes in V2:
==============
- rename 'drm_gpuva_manager' -> 'drm_gpuvm' which generally leads to more
consistent naming
- properly separate commits (introduce common dma-resv, drm_gpuvm_bo
abstraction, etc.)
- remove maple tree for tracking external objects, use a list drm_gpuvm_bos
per drm_gpuvm instead
- rework dma-resv locking helpers (Thomas)
- add a locking helper for a given range of the VA space (Christian)
- make the GPUVA manager buildable as module, rather than drm_exec
builtin (Christian)
Danilo Krummrich (7):
drm: gpuva_mgr: allow building as module
drm/gpuvm: rename struct drm_gpuva_manager to struct drm_gpuvm
drm/nouveau: uvmm: rename 'umgr' to 'base'
drm/gpuvm: common dma-resv per struct drm_gpuvm
drm/gpuvm: add an abstraction for a VM / BO combination
drm/gpuvm: generalize dma_resv/extobj handling and GEM validation
drm/nouveau: GPUVM dma-resv/extobj handling, GEM validation
drivers/gpu/drm/Kconfig | 7 +
drivers/gpu/drm/Makefile | 2 +-
drivers/gpu/drm/drm_debugfs.c | 14 +-
drivers/gpu/drm/drm_gpuva_mgr.c | 900 +++++++++++++++++-----
drivers/gpu/drm/nouveau/Kconfig | 1 +
drivers/gpu/drm/nouveau/nouveau_bo.c | 4 +-
drivers/gpu/drm/nouveau/nouveau_debugfs.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_exec.c | 52 +-
drivers/gpu/drm/nouveau/nouveau_exec.h | 4 -
drivers/gpu/drm/nouveau/nouveau_gem.c | 4 +-
drivers/gpu/drm/nouveau/nouveau_sched.h | 4 +-
drivers/gpu/drm/nouveau/nouveau_uvmm.c | 216 ++++--
drivers/gpu/drm/nouveau/nouveau_uvmm.h | 6 +-
include/drm/drm_debugfs.h | 4 +-
include/drm/drm_gem.h | 48 +-
include/drm/drm_gpuva_mgr.h | 512 ++++++++++--
16 files changed, 1375 insertions(+), 405 deletions(-)
base-commit: 6bd3d8da51ca1ec97c724016466606aec7739b9f
--
2.41.0
More information about the Nouveau
mailing list