[PATCH 1/2] drm/gpuvm: export drm_gpuvm_bo_destroy_not_in_lists()

Daniel Pesic <[email protected]> Mon, 27 Jul 2026 07:11:20 -0700
Newsgroups org.kernel.vger.rust-for-linux,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
drm_gpuvm_bo_obtain_prealloc() currently calls this function directly to
destroy a losing preallocated drm_gpuvm_bo. Export it and promote its
comment to kernel-doc so the upcoming Rust GpuVmBoAlloc binding can call
it the same way.

Signed-off-by: Daniel Pesic <[email protected]>
---
 drivers/gpu/drm/drm_gpuvm.c | 5 +++--
 include/drm/drm_gpuvm.h     | 2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_gpuvm.c b/drivers/gpu/drm/drm_gpuvm.c
index d1c80ad3dead..30c134455547 100644
--- a/drivers/gpu/drm/drm_gpuvm.c
+++ b/drivers/gpu/drm/drm_gpuvm.c
@@ -1608,7 +1608,7 @@ drm_gpuvm_bo_create(struct drm_gpuvm *gpuvm,
 }
 EXPORT_SYMBOL_GPL(drm_gpuvm_bo_create);
 
-/*
+/**
  * drm_gpuvm_bo_destroy_not_in_lists() - final part of drm_gpuvm_bo cleanup
  * @vm_bo: the &drm_gpuvm_bo to destroy
  *
@@ -1619,7 +1619,7 @@ EXPORT_SYMBOL_GPL(drm_gpuvm_bo_create);
  * object if the refcount reaches zero. It's illegal for this to happen if the
  * caller holds the GEMs gpuva mutex because it would free the mutex.
  */
-static void
+void
 drm_gpuvm_bo_destroy_not_in_lists(struct drm_gpuvm_bo *vm_bo)
 {
 	struct drm_gpuvm *gpuvm = vm_bo->vm;
@@ -1634,6 +1634,7 @@ drm_gpuvm_bo_destroy_not_in_lists(struct drm_gpuvm_bo *vm_bo)
 	drm_gpuvm_put(gpuvm);
 	drm_gem_object_put(obj);
 }
+EXPORT_SYMBOL_GPL(drm_gpuvm_bo_destroy_not_in_lists);
 
 static void
 drm_gpuvm_bo_destroy_not_in_lists_kref(struct kref *kref)
diff --git a/include/drm/drm_gpuvm.h b/include/drm/drm_gpuvm.h
index 38221d83285b..d014a389405c 100644
--- a/include/drm/drm_gpuvm.h
+++ b/include/drm/drm_gpuvm.h
@@ -760,6 +760,8 @@ bool drm_gpuvm_bo_put(struct drm_gpuvm_bo *vm_bo);
 bool drm_gpuvm_bo_put_deferred(struct drm_gpuvm_bo *vm_bo);
 void drm_gpuvm_bo_deferred_cleanup(struct drm_gpuvm *gpuvm);
 
+void drm_gpuvm_bo_destroy_not_in_lists(struct drm_gpuvm_bo *vm_bo);
+
 struct drm_gpuvm_bo *
 drm_gpuvm_bo_find(struct drm_gpuvm *gpuvm,
 		  struct drm_gem_object *obj);
-- 
2.55.0