Skip to content

Commit

Permalink
drm: manager to keep track of GPUs VA mappings
Browse files Browse the repository at this point in the history
Add infrastructure to keep track of GPU virtual address (VA) mappings
with a decicated VA space manager implementation.

New UAPIs, motivated by Vulkan sparse memory bindings graphics drivers
start implementing, allow userspace applications to request multiple and
arbitrary GPU VA mappings of buffer objects. The DRM GPU VA manager is
intended to serve the following purposes in this context.

1) Provide infrastructure to track GPU VA allocations and mappings,
   making use of the maple_tree.

2) Generically connect GPU VA mappings to their backing buffers, in
   particular DRM GEM objects.

3) Provide a common implementation to perform more complex mapping
   operations on the GPU VA space. In particular splitting and merging
   of GPU VA mappings, e.g. for intersecting mapping requests or partial
   unmap requests.

Suggested-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
  • Loading branch information
dakr authored and intel-lab-lkp committed Feb 17, 2023
1 parent 9afbd6c commit 00132cc
Show file tree
Hide file tree
Showing 7 changed files with 2,534 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Documentation/gpu/drm-mm.rst
Expand Up @@ -466,6 +466,37 @@ DRM MM Range Allocator Function References
.. kernel-doc:: drivers/gpu/drm/drm_mm.c
:export:

DRM GPU VA Manager
==================

Overview
--------

.. kernel-doc:: drivers/gpu/drm/drm_gpuva_mgr.c
:doc: Overview

Split and Merge
---------------

.. kernel-doc:: drivers/gpu/drm/drm_gpuva_mgr.c
:doc: Split and Merge

Locking
-------

.. kernel-doc:: drivers/gpu/drm/drm_gpuva_mgr.c
:doc: Locking


DRM GPU VA Manager Function References
--------------------------------------

.. kernel-doc:: include/drm/drm_gpuva_mgr.h
:internal:

.. kernel-doc:: drivers/gpu/drm/drm_gpuva_mgr.c
:export:

DRM Buddy Allocator
===================

Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/Makefile
Expand Up @@ -45,6 +45,7 @@ drm-y := \
drm_vblank.o \
drm_vblank_work.o \
drm_vma_manager.o \
drm_gpuva_mgr.o \
drm_writeback.o
drm-$(CONFIG_DRM_LEGACY) += \
drm_agpsupport.o \
Expand Down
3 changes: 3 additions & 0 deletions drivers/gpu/drm/drm_gem.c
Expand Up @@ -164,6 +164,9 @@ void drm_gem_private_object_init(struct drm_device *dev,
if (!obj->resv)
obj->resv = &obj->_resv;

if (drm_core_check_feature(dev, DRIVER_GEM_GPUVA))
drm_gem_gpuva_init(obj);

drm_vma_node_reset(&obj->vma_node);
INIT_LIST_HEAD(&obj->lru_node);
}
Expand Down

0 comments on commit 00132cc

Please sign in to comment.