]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/xe/svm: Make to_xe_range a public function
authorHimal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Tue, 13 May 2025 04:02:17 +0000 (09:32 +0530)
committerHimal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Wed, 14 May 2025 13:55:53 +0000 (19:25 +0530)
The to_xe_range function will be used in other files. Therefore, make it
public and add kernel-doc documentation

Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Acked-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://lore.kernel.org/r/20250513040228.470682-5-himal.prasad.ghimiray@intel.com
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
drivers/gpu/drm/xe/xe_svm.c
drivers/gpu/drm/xe/xe_svm.h

index 875376bddc8866459e559820366cab411aa65569..77740730e8215b0c10ae1e3937c754db05820836 100644 (file)
@@ -103,11 +103,6 @@ static void xe_svm_range_free(struct drm_gpusvm_range *range)
        kfree(range);
 }
 
-static struct xe_svm_range *to_xe_range(struct drm_gpusvm_range *r)
-{
-       return container_of(r, struct xe_svm_range, base);
-}
-
 static void
 xe_svm_garbage_collector_add_range(struct xe_vm *vm, struct xe_svm_range *range,
                                   const struct mmu_notifier_range *mmu_range)
index 36e245ec64225f1393989db5085ec4ffd55985c6..e9257f0b3ffcc57537168ca44a43dce2d665d981 100644 (file)
@@ -85,6 +85,20 @@ static inline bool xe_svm_range_has_dma_mapping(struct xe_svm_range *range)
        return range->base.flags.has_dma_mapping;
 }
 
+/**
+ * to_xe_range - Convert a drm_gpusvm_range pointer to a xe_svm_range
+ * @r: Pointer to the drm_gpusvm_range structure
+ *
+ * This function takes a pointer to a drm_gpusvm_range structure and
+ * converts it to a pointer to the containing xe_svm_range structure.
+ *
+ * Return: Pointer to the xe_svm_range structure
+ */
+static inline struct xe_svm_range *to_xe_range(struct drm_gpusvm_range *r)
+{
+       return container_of(r, struct xe_svm_range, base);
+}
+
 #define xe_svm_assert_in_notifier(vm__) \
        lockdep_assert_held_write(&(vm__)->svm.gpusvm.notifier_lock)
 
@@ -101,6 +115,7 @@ void xe_svm_flush(struct xe_vm *vm);
 
 struct drm_pagemap_device_addr;
 struct drm_gpusvm_ctx;
+struct drm_gpusvm_range;
 struct xe_bo;
 struct xe_gt;
 struct xe_vm;
@@ -179,6 +194,11 @@ int xe_svm_alloc_vram(struct xe_vm *vm, struct xe_tile *tile,
        return -EOPNOTSUPP;
 }
 
+static inline struct xe_svm_range *to_xe_range(struct drm_gpusvm_range *r)
+{
+       return NULL;
+}
+
 #define xe_svm_assert_in_notifier(...) do {} while (0)
 #define xe_svm_range_has_dma_mapping(...) false