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

Christian König ckoenig.leichtzumerken at gmail.com
Fri Aug 10 14:21:54 UTC 2018


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 <Jerry.Zhang at amd.com>
> ---
>   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_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
> 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_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;
>   



More information about the amd-gfx mailing list