Re: [PATCH] drm/amdgpu: move amdgpu ttm structures to amdgpu_ttm.h

2018-08-12 Thread Zhang, Jerry (Junwei)

On 08/10/2018 10:21 PM, Christian König wrote:

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



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:

code cleanup for amdgpu ttm structures

Signed-off-by: Junwei Zhang 
---
  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(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index c6611cf..87f4e8d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -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_headlist;
-struct task_struct*task;
-};
-
-struct amdgpu_ttm_tt {
-struct ttm_dma_ttttm;
-u64offset;
-uint64_tuserptr;
-struct task_struct*usertask;
-uint32_tuserflags;
-spinlock_t  guptasklock;
-struct list_headguptasks;
-atomic_tmmu_invalidations;
-uint32_tlast_set_pages;
-};
-
  /**
   * amdgpu_ttm_tt_get_user_pages - Pin pages of memory pointed to by a USERPTR
   * pointer to memory
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
index 8b3cc66..b8c391a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
@@ -66,6 +66,23 @@ struct amdgpu_copy_mem {
  unsigned longoffset;
  };
+struct amdgpu_ttm_gup_task_list {
+struct list_headlist;
+struct task_struct*task;
+};
+
+struct amdgpu_ttm_tt {
+struct ttm_dma_ttttm;
+u64offset;
+uint64_tuserptr;
+struct task_struct*usertask;
+uint32_tuserflags;
+spinlock_t  guptasklock;
+struct list_headguptasks;
+atomic_tmmu_invalidations;
+uint32_tlast_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
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/amdgpu: move amdgpu ttm structures to amdgpu_ttm.h

2018-08-10 Thread 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.


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:

code cleanup for amdgpu ttm structures

Signed-off-by: Junwei Zhang 
---
  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(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index c6611cf..87f4e8d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -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_headlist;
-   struct task_struct  *task;
-};
-
-struct amdgpu_ttm_tt {
-   struct ttm_dma_tt   ttm;
-   u64 offset;
-   uint64_tuserptr;
-   struct task_struct  *usertask;
-   uint32_tuserflags;
-   spinlock_t  guptasklock;
-   struct list_headguptasks;
-   atomic_tmmu_invalidations;
-   uint32_tlast_set_pages;
-};
-
  /**
   * amdgpu_ttm_tt_get_user_pages - Pin pages of memory pointed to by a USERPTR
   * pointer to memory
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
index 8b3cc66..b8c391a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
@@ -66,6 +66,23 @@ struct amdgpu_copy_mem {
unsigned long   offset;
  };
  
+struct amdgpu_ttm_gup_task_list {

+   struct list_headlist;
+   struct task_struct  *task;
+};
+
+struct amdgpu_ttm_tt {
+   struct ttm_dma_tt   ttm;
+   u64 offset;
+   uint64_tuserptr;
+   struct task_struct  *usertask;
+   uint32_tuserflags;
+   spinlock_t  guptasklock;
+   struct list_headguptasks;
+   atomic_tmmu_invalidations;
+   uint32_tlast_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
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH] drm/amdgpu: move amdgpu ttm structures to amdgpu_ttm.h

2018-08-10 Thread Huang Rui
On Fri, Aug 10, 2018 at 01:44:28PM +0800, Junwei Zhang wrote:
> code cleanup for amdgpu ttm structures
> 
> Signed-off-by: Junwei Zhang 

Acked-by: Huang Rui 

> ---
>  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(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index c6611cf..87f4e8d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -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_headlist;
> - struct task_struct  *task;
> -};
> -
> -struct amdgpu_ttm_tt {
> - struct ttm_dma_tt   ttm;
> - u64 offset;
> - uint64_tuserptr;
> - struct task_struct  *usertask;
> - uint32_tuserflags;
> - spinlock_t  guptasklock;
> - struct list_headguptasks;
> - atomic_tmmu_invalidations;
> - uint32_tlast_set_pages;
> -};
> -
>  /**
>   * amdgpu_ttm_tt_get_user_pages - Pin pages of memory pointed to by a USERPTR
>   * pointer to memory
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
> index 8b3cc66..b8c391a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
> @@ -66,6 +66,23 @@ struct amdgpu_copy_mem {
>   unsigned long   offset;
>  };
>  
> +struct amdgpu_ttm_gup_task_list {
> + struct list_headlist;
> + struct task_struct  *task;
> +};
> +
> +struct amdgpu_ttm_tt {
> + struct ttm_dma_tt   ttm;
> + u64 offset;
> + uint64_tuserptr;
> + struct task_struct  *usertask;
> + uint32_tuserflags;
> + spinlock_t  guptasklock;
> + struct list_headguptasks;
> + atomic_tmmu_invalidations;
> + uint32_tlast_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;
>  
> -- 
> 1.9.1
> 
> ___
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx