drm/gpuvm: track/lock/validate external/evicted objects
authorDanilo Krummrich <dakr@redhat.com>
Wed, 8 Nov 2023 00:12:41 +0000 (01:12 +0100)
committerDanilo Krummrich <dakr@redhat.com>
Mon, 13 Nov 2023 17:19:33 +0000 (18:19 +0100)
commit50c1a36f594bb3dd33f3f9386c5d960cd12327d8
tree0799ee918cedb70852827f989ba2990e4bf660b2
parent94bc2249f08e141fb4aa120bfdc392c7a5e78211
drm/gpuvm: track/lock/validate external/evicted objects

Currently the DRM GPUVM 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 GPUVM represent
a basis for GPU-VM implementations. In this context, this patch 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.

Big thanks to Boris Brezillon for his help to figure out locking for
drivers updating the GPU VA space within the fence signalling path.

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Suggested-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231108001259.15123-12-dakr@redhat.com
drivers/gpu/drm/drm_gpuvm.c
include/drm/drm_gpuvm.h