]> git.ipfire.org Git - thirdparty/linux.git/commit
drm/gpuvm: Add locking helpers
authorRob Clark <robin.clark@oss.qualcomm.com>
Sun, 29 Jun 2025 20:12:45 +0000 (13:12 -0700)
committerRob Clark <robin.clark@oss.qualcomm.com>
Fri, 4 Jul 2025 18:09:43 +0000 (11:09 -0700)
commit471920ce25d50bb39bfdaf3c3d9bc9dde30fa265
tree71d697d413515bad9030a40cc9a761bfce6282a0
parent9d712c50c30fface9b2a64251d9a7ac5fa7d3c4a
drm/gpuvm: Add locking helpers

For UNMAP/REMAP steps we could be needing to lock objects that are not
explicitly listed in the VM_BIND ioctl in order to tear-down unmapped
VAs.  These helpers handle locking/preparing the needed objects.

Note that these functions do not strictly require the VM changes to be
applied before the next drm_gpuvm_sm_map_lock()/_unmap_lock() call.  In
the case that VM changes from an earlier drm_gpuvm_sm_map()/_unmap()
call result in a differing sequence of steps when the VM changes are
actually applied, it will be the same set of GEM objects involved, so
the locking is still correct.

v2: Rename to drm_gpuvm_sm_*_exec_locked() [Danilo]
v3: Expand comments to show expected usage, and explain how the usage
    is safe in the case of overlapping driver VM_BIND ops.

Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
Tested-by: Antonino Maniscalco <antomani103@gmail.com>
Reviewed-by: Antonino Maniscalco <antomani103@gmail.com>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Patchwork: https://patchwork.freedesktop.org/patch/661458/
drivers/gpu/drm/drm_gpuvm.c
include/drm/drm_gpuvm.h