Skip to contentSkip to conversation

drm/amdgpu: move amdgpu ttm structures to amdgpu_ttm.h

PATCH In review Junwei Zhang 3 participants 4 messages Aug 10, 2018 – Aug 13, 2018 2 messages not in the archive

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

PATCH 1/1 drm/amdgpu: move amdgpu ttm structures to amdgpu_ttm.h

code cleanup for amdgpu ttm structures

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 20 --------------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 17 +++++++++++++++++
 2 files changed, 17 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -20
index c6611cf..87f4e8d 100644
@@ -776,26 +776,6 @@ static unsigned long amdgpu_ttm_io_mem_pfn(struct ttm_buffer_object *bo,
 		(offset >> PAGE_SHIFT);
 }
 
-/*
- * TTM backend functions.
- */
-struct amdgpu_ttm_gup_task_list {
-	struct list_head	list;
-	struct task_struct	*task;
-};
-
-struct amdgpu_ttm_tt {
-	struct ttm_dma_tt	ttm;
-	u64			offset;
-	uint64_t		userptr;
-	struct task_struct	*usertask;
-	uint32_t		userflags;
-	spinlock_t              guptasklock;
-	struct list_head        guptasks;
-	atomic_t		mmu_invalidations;
-	uint32_t		last_set_pages;
-};
-
 /**
  * amdgpu_ttm_tt_get_user_pages - Pin pages of memory pointed to by a USERPTR
  * pointer to memory
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +17 -0
index 8b3cc66..b8c391a 100644
@@ -66,6 +66,23 @@ struct amdgpu_copy_mem {
 	unsigned long			offset;
 };
 
+struct amdgpu_ttm_gup_task_list {
+	struct list_head	list;
+	struct task_struct	*task;
+};
+
+struct amdgpu_ttm_tt {
+	struct ttm_dma_tt	ttm;
+	u64			offset;
+	uint64_t		userptr;
+	struct task_struct	*usertask;
+	uint32_t		userflags;
+	spinlock_t              guptasklock;
+	struct list_head        guptasks;
+	atomic_t		mmu_invalidations;
+	uint32_t		last_set_pages;
+};
+
 extern const struct ttm_mem_type_manager_func amdgpu_gtt_mgr_func;
 extern const struct ttm_mem_type_manager_func amdgpu_vram_mgr_func;
 
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1533879868-11081-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org

Acked-by
#2 lore raw
Quoted 3 lines · Junwei Zhang

code cleanup for amdgpu ttm structures

Quoted 71 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 20 --------------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 17 +++++++++++++++++
 2 files changed, 17 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -20
index c6611cf..87f4e8d 100644
@@ -776,26 +776,6 @@ static unsigned long amdgpu_ttm_io_mem_pfn(struct ttm_buffer_object *bo,
 		(offset >> PAGE_SHIFT);
 }
 
-/*
- * TTM backend functions.
- */
-struct amdgpu_ttm_gup_task_list {
-	struct list_head	list;
-	struct task_struct	*task;
-};
-
-struct amdgpu_ttm_tt {
-	struct ttm_dma_tt	ttm;
-	u64			offset;
-	uint64_t		userptr;
-	struct task_struct	*usertask;
-	uint32_t		userflags;
-	spinlock_t              guptasklock;
-	struct list_head        guptasks;
-	atomic_t		mmu_invalidations;
-	uint32_t		last_set_pages;
-};
-
 /**
  * amdgpu_ttm_tt_get_user_pages - Pin pages of memory pointed to by a USERPTR
  * pointer to memory
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +17 -0
index 8b3cc66..b8c391a 100644
@@ -66,6 +66,23 @@ struct amdgpu_copy_mem {
 	unsigned long			offset;
 };
 
+struct amdgpu_ttm_gup_task_list {
+	struct list_head	list;
+	struct task_struct	*task;
+};
+
+struct amdgpu_ttm_tt {
+	struct ttm_dma_tt	ttm;
+	u64			offset;
+	uint64_t		userptr;
+	struct task_struct	*usertask;
+	uint32_t		userflags;
+	spinlock_t              guptasklock;
+	struct list_head        guptasks;
+	atomic_t		mmu_invalidations;
+	uint32_t		last_set_pages;
+};
+
 extern const struct ttm_mem_type_manager_func amdgpu_gtt_mgr_func;
 extern const struct ttm_mem_type_manager_func amdgpu_vram_mgr_func;
 
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw
In reply to a message not in the archive

Well NAK, that is intentionally kept local to the amdgpu_ttm.c file.

This way we can make sure that we don't accidentally leak the structure somewhere else.

What you could do is to move it to the beginning of the file.

Christian.

Am 10.08.2018 um 07:44 schrieb Junwei Zhang:

Quoted 57 lines

code cleanup for amdgpu ttm structures

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 20 --------------------
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 17 +++++++++++++++++
  2 files changed, 17 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -20
index c6611cf..87f4e8d 100644
@@ -776,26 +776,6 @@ static unsigned long amdgpu_ttm_io_mem_pfn(struct ttm_buffer_object *bo,
  		(offset >> PAGE_SHIFT);
  }
 
-/*
- * TTM backend functions.
- */
-struct amdgpu_ttm_gup_task_list {
-	struct list_head	list;
-	struct task_struct	*task;
-};
-
-struct amdgpu_ttm_tt {
-	struct ttm_dma_tt	ttm;
-	u64			offset;
-	uint64_t		userptr;
-	struct task_struct	*usertask;
-	uint32_t		userflags;
-	spinlock_t              guptasklock;
-	struct list_head        guptasks;
-	atomic_t		mmu_invalidations;
-	uint32_t		last_set_pages;
-};
-
  /**
   * amdgpu_ttm_tt_get_user_pages - Pin pages of memory pointed to by a USERPTR
   * pointer to memory
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +10 -0
index 8b3cc66..b8c391a 100644
@@ -66,6 +66,23 @@ struct amdgpu_copy_mem {
  	unsigned long			offset;
  };
 
+struct amdgpu_ttm_gup_task_list {
+	struct list_head	list;
+	struct task_struct	*task;
+};
+
+struct amdgpu_ttm_tt {
+	struct ttm_dma_tt	ttm;
+	u64			offset;
+	uint64_t		userptr;
+	struct task_struct	*usertask;

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h struct amdgpu_copy_mem { · line 88

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +7 -0
+	uint32_t		userflags;
+	spinlock_t              guptasklock;
+	struct list_head        guptasks;
+	atomic_t		mmu_invalidations;
+	uint32_t		last_set_pages;
+};
+
  extern const struct ttm_mem_type_manager_func amdgpu_gtt_mgr_func;
  extern const struct ttm_mem_type_manager_func amdgpu_vram_mgr_func;
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 2eb1606a-2853-4de9-118f-fda8f864cdbb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#5 lore raw
Quoted 3 lines · Christian König

Well NAK, that is intentionally kept local to the amdgpu_ttm.c file.

This way we can make sure that we don't accidentally leak the structure somewhere else.

Thanks to explain that.
I thought those were left in the file accidentally. Then fine to keep them in the file still.

Regards,
Jerry

Quoted 62 lines

What you could do is to move it to the beginning of the file.

Christian.

Am 10.08.2018 um 07:44 schrieb Junwei Zhang:

Quoted 56 lines

code cleanup for amdgpu ttm structures

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 20 --------------------
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 17 +++++++++++++++++
  2 files changed, 17 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -20
index c6611cf..87f4e8d 100644
@@ -776,26 +776,6 @@ static unsigned long amdgpu_ttm_io_mem_pfn(struct ttm_buffer_object *bo,
          (offset >> PAGE_SHIFT);
  }
-/*
- * TTM backend functions.
- */
-struct amdgpu_ttm_gup_task_list {
-    struct list_head    list;
-    struct task_struct    *task;
-};
-
-struct amdgpu_ttm_tt {
-    struct ttm_dma_tt    ttm;
-    u64            offset;
-    uint64_t        userptr;
-    struct task_struct    *usertask;
-    uint32_t        userflags;
-    spinlock_t              guptasklock;
-    struct list_head        guptasks;
-    atomic_t        mmu_invalidations;
-    uint32_t        last_set_pages;
-};
-
  /**
   * amdgpu_ttm_tt_get_user_pages - Pin pages of memory pointed to by a USERPTR
   * pointer to memory
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +11 -0
index 8b3cc66..b8c391a 100644
@@ -66,6 +66,23 @@ struct amdgpu_copy_mem {
      unsigned long            offset;
  };
+struct amdgpu_ttm_gup_task_list {
+    struct list_head    list;
+    struct task_struct    *task;
+};
+
+struct amdgpu_ttm_tt {
+    struct ttm_dma_tt    ttm;
+    u64            offset;
+    uint64_t        userptr;
+    struct task_struct    *usertask;
+    uint32_t        userflags;
Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h struct amdgpu_copy_mem { · line 87

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +6 -0
+    spinlock_t              guptasklock;
+    struct list_head        guptasks;
+    atomic_t        mmu_invalidations;
+    uint32_t        last_set_pages;
+};
+
  extern const struct ttm_mem_type_manager_func amdgpu_gtt_mgr_func;
  extern const struct ttm_mem_type_manager_func amdgpu_vram_mgr_func;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx