Skip to contentSkip to conversation

drm/gpuvm: Delete some dead code and fix a comment

PATCH Applied Adrián Larumbe 2 participants 4 messages Jun 8 – Jul 3

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover drm/gpuvm: Delete some dead code and fix a comment

Just some small fixes I made when reading drm_gpuvm.c.

---
Changes in v2:
- Deleted even more dead code.
- Link to v1: https://patch.msgid.link/[email protected]

To: Danilo Krummrich <[email protected]>
To: Matthew Brost <[email protected]>
To: Thomas Hellström <[email protected]>
To: Alice Ryhl <[email protected]>
To: Maarten Lankhorst <[email protected]>
To: Maxime Ripard <[email protected]>
To: Thomas Zimmermann <[email protected]>
To: David Airlie <[email protected]>
To: Simona Vetter <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
Adrián Larumbe (2):
drm/gpuvm: Remove dead code
drm/gpuvm: Fix comment to reflect remap operation operand status

 drivers/gpu/drm/drm_gpuvm.c | 44 --------------------------------------------
 include/drm/drm_gpuvm.h     |  4 ++--
 2 files changed, 2 insertions(+), 46 deletions(-)

---
base-commit: 6e7eb171ac96fefa32197afa658e7d9da238be89
change-id: 20260608-gpuvm-minor-fixes-6e508ada923a

Best regards,

Signature · 1 line
Adrián Larumbe <[email protected]>
#1 lore raw

PATCH v2 1/2 drm/gpuvm: Remove dead code

drm_gpuva_find_{prev|next}() have no consumers.

---
 drivers/gpu/drm/drm_gpuvm.c | 44 --------------------------------------------
 include/drm/drm_gpuvm.h     |  2 --
 2 files changed, 46 deletions(-)
drivers/gpu/drm/drm_gpuvm.c +0 -44
index 078cbc0235a4..bb2847897527 100644
@@ -2225,50 +2225,6 @@ drm_gpuva_find(struct drm_gpuvm *gpuvm,
 }
 EXPORT_SYMBOL_GPL(drm_gpuva_find);
 
-/**
- * drm_gpuva_find_prev() - find the &drm_gpuva before the given address
- * @gpuvm: the &drm_gpuvm to search in
- * @start: the given GPU VA's start address
- *
- * Find the adjacent &drm_gpuva before the GPU VA with given &start address.
- *
- * Note that if there is any free space between the GPU VA mappings no mapping
- * is returned.
- *
- * Returns: a pointer to the found &drm_gpuva or NULL if none was found
- */
-struct drm_gpuva *
-drm_gpuva_find_prev(struct drm_gpuvm *gpuvm, u64 start)
-{
-	if (!drm_gpuvm_range_valid(gpuvm, start - 1, 1))
-		return NULL;
-
-	return drm_gpuva_it_iter_first(&gpuvm->rb.tree, start - 1, start);
-}
-EXPORT_SYMBOL_GPL(drm_gpuva_find_prev);
-
-/**
- * drm_gpuva_find_next() - find the &drm_gpuva after the given address
- * @gpuvm: the &drm_gpuvm to search in
- * @end: the given GPU VA's end address
- *
- * Find the adjacent &drm_gpuva after the GPU VA with given &end address.
- *
- * Note that if there is any free space between the GPU VA mappings no mapping
- * is returned.
- *
- * Returns: a pointer to the found &drm_gpuva or NULL if none was found
- */
-struct drm_gpuva *
-drm_gpuva_find_next(struct drm_gpuvm *gpuvm, u64 end)
-{
-	if (!drm_gpuvm_range_valid(gpuvm, end, 1))
-		return NULL;
-
-	return drm_gpuva_it_iter_first(&gpuvm->rb.tree, end, end + 1);
-}
-EXPORT_SYMBOL_GPL(drm_gpuva_find_next);
-
 /**
  * drm_gpuvm_interval_empty() - indicate whether a given interval of the VA space
  * is empty
include/drm/drm_gpuvm.h +0 -2
index 655bd9104ffb..f8fc0296c4b7 100644
@@ -159,8 +159,6 @@ struct drm_gpuva *drm_gpuva_find(struct drm_gpuvm *gpuvm,
 				 u64 addr, u64 range);
 struct drm_gpuva *drm_gpuva_find_first(struct drm_gpuvm *gpuvm,
 				       u64 addr, u64 range);
-struct drm_gpuva *drm_gpuva_find_prev(struct drm_gpuvm *gpuvm, u64 start);
-struct drm_gpuva *drm_gpuva_find_next(struct drm_gpuvm *gpuvm, u64 end);
 
 /**
  * drm_gpuva_invalidate() - sets whether the backing GEM of this &drm_gpuva is
Signature · 1 line
2.53.0
#2 lore raw

PATCH v2 2/2 drm/gpuvm: Fix comment to reflect remap operation operand status

In reply to Adrián Larumbe

When a new mapping intersects with an existing GPU VA, but either end lies before or beyond the existing VA's edges, then the prev and next mapping operations part of a remap will reflect this condition by being set to NULL.

---
 include/drm/drm_gpuvm.h | 2 ++
 1 file changed, 2 insertions(+)
include/drm/drm_gpuvm.h +2 -0
index f8fc0296c4b7..38221d83285b 100644
@@ -928,6 +928,8 @@ struct drm_gpuva_op_unmap {
  * If either a new mapping's start address is aligned with the start address
  * of the old mapping or the new mapping's end address is aligned with the
  * end address of the old mapping, either @prev or @next is NULL.
+ * This will also be the case when the requested mapping begins before the
+ * old mapping's start address or stretches beyond its end address.
  *
  * Note, the reason for a dedicated remap operation, rather than arbitrary
  * unmap and map operations, is to give drivers the chance of extracting driver
Signature · 1 line
2.53.0
maintainer Applied
#3 lore raw
In reply to Adrián Larumbe
Quoted 1 line · Adrián Larumbe

[PATCH v2 0/2] drm/gpuvm: Delete some dead code and fix a comment

Applied, thanks!

Branch: drm-misc-next
Tree: https://gitlab.freedesktop.org/drm/misc/kernel.git

[1/2] drm/gpuvm: Remove dead code

      commit: c4c4434e41e5
[2/2] drm/gpuvm: Fix comment to reflect remap operation operand status
      commit: 49d0307c55c4

The patches will appear in the next linux-next integration (typically within 24 hours on weekdays).

The patches are queued up for the upcoming merge window for the next major kernel release.