Commit 2e603d04 authored by Huang Rui's avatar Huang Rui Committed by Alex Deucher

drm/amdgpu: clean up the superfluous space and align the comment text for amdgpu_ttm

This patch cleans up spaces and align the text to refine the comment for
amdgpu_ttm.
Signed-off-by: default avatarHuang Rui <ray.huang@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 204029e1
...@@ -92,11 +92,9 @@ static void amdgpu_ttm_mem_global_release(struct drm_global_reference *ref) ...@@ -92,11 +92,9 @@ static void amdgpu_ttm_mem_global_release(struct drm_global_reference *ref)
} }
/** /**
* amdgpu_ttm_global_init - Initialize global TTM memory reference * amdgpu_ttm_global_init - Initialize global TTM memory reference structures.
* structures.
* *
* @adev: AMDGPU device for which the global structures need to be * @adev: AMDGPU device for which the global structures need to be registered.
* registered.
* *
* This is called as part of the AMDGPU ttm init from amdgpu_ttm_init() * This is called as part of the AMDGPU ttm init from amdgpu_ttm_init()
* during bring up. * during bring up.
...@@ -162,13 +160,12 @@ static int amdgpu_invalidate_caches(struct ttm_bo_device *bdev, uint32_t flags) ...@@ -162,13 +160,12 @@ static int amdgpu_invalidate_caches(struct ttm_bo_device *bdev, uint32_t flags)
} }
/** /**
* amdgpu_init_mem_type - Initialize a memory manager for a specific * amdgpu_init_mem_type - Initialize a memory manager for a specific type of
* type of memory request. * memory request.
* *
* @bdev: The TTM BO device object (contains a reference to * @bdev: The TTM BO device object (contains a reference to amdgpu_device)
* amdgpu_device) * @type: The type of memory requested
* @type: The type of memory requested * @man: The memory type manager for each domain
* @man:
* *
* This is called by ttm_bo_init_mm() when a buffer object is being * This is called by ttm_bo_init_mm() when a buffer object is being
* initialized. * initialized.
...@@ -292,8 +289,8 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo, ...@@ -292,8 +289,8 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
/** /**
* amdgpu_verify_access - Verify access for a mmap call * amdgpu_verify_access - Verify access for a mmap call
* *
* @bo: The buffer object to map * @bo: The buffer object to map
* @filp: The file pointer from the process performing the mmap * @filp: The file pointer from the process performing the mmap
* *
* This is called by ttm_bo_mmap() to verify whether a process * This is called by ttm_bo_mmap() to verify whether a process
* has the right to mmap a BO to their process space. * has the right to mmap a BO to their process space.
...@@ -318,11 +315,10 @@ static int amdgpu_verify_access(struct ttm_buffer_object *bo, struct file *filp) ...@@ -318,11 +315,10 @@ static int amdgpu_verify_access(struct ttm_buffer_object *bo, struct file *filp)
/** /**
* amdgpu_move_null - Register memory for a buffer object * amdgpu_move_null - Register memory for a buffer object
* *
* @bo: The bo to assign the memory to * @bo: The bo to assign the memory to
* @new_mem: The memory to be assigned. * @new_mem: The memory to be assigned.
* *
* Assign the memory from new_mem to the memory of the buffer object * Assign the memory from new_mem to the memory of the buffer object bo.
* bo.
*/ */
static void amdgpu_move_null(struct ttm_buffer_object *bo, static void amdgpu_move_null(struct ttm_buffer_object *bo,
struct ttm_mem_reg *new_mem) struct ttm_mem_reg *new_mem)
...@@ -335,8 +331,12 @@ static void amdgpu_move_null(struct ttm_buffer_object *bo, ...@@ -335,8 +331,12 @@ static void amdgpu_move_null(struct ttm_buffer_object *bo,
} }
/** /**
* amdgpu_mm_node_addr - Compute the GPU relative offset of a GTT * amdgpu_mm_node_addr - Compute the GPU relative offset of a GTT buffer.
* buffer. *
* @bo: The bo to assign the memory to.
* @mm_node: Memory manager node for drm allocator.
* @mem: The region where the bo resides.
*
*/ */
static uint64_t amdgpu_mm_node_addr(struct ttm_buffer_object *bo, static uint64_t amdgpu_mm_node_addr(struct ttm_buffer_object *bo,
struct drm_mm_node *mm_node, struct drm_mm_node *mm_node,
...@@ -352,10 +352,12 @@ static uint64_t amdgpu_mm_node_addr(struct ttm_buffer_object *bo, ...@@ -352,10 +352,12 @@ static uint64_t amdgpu_mm_node_addr(struct ttm_buffer_object *bo,
} }
/** /**
* amdgpu_find_mm_node - Helper function finds the drm_mm_node * amdgpu_find_mm_node - Helper function finds the drm_mm_node corresponding to
* corresponding to @offset. It also modifies * @offset. It also modifies the offset to be within the drm_mm_node returned
* the offset to be within the drm_mm_node *
* returned * @mem: The region where the bo resides.
* @offset: The offset that drm_mm_node is used for finding.
*
*/ */
static struct drm_mm_node *amdgpu_find_mm_node(struct ttm_mem_reg *mem, static struct drm_mm_node *amdgpu_find_mm_node(struct ttm_mem_reg *mem,
unsigned long *offset) unsigned long *offset)
...@@ -497,8 +499,8 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev, ...@@ -497,8 +499,8 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev,
/** /**
* amdgpu_move_blit - Copy an entire buffer to another buffer * amdgpu_move_blit - Copy an entire buffer to another buffer
* *
* This is a helper called by amdgpu_bo_move() and * This is a helper called by amdgpu_bo_move() and amdgpu_move_vram_ram() to
* amdgpu_move_vram_ram() to help move buffers to and from VRAM. * help move buffers to and from VRAM.
*/ */
static int amdgpu_move_blit(struct ttm_buffer_object *bo, static int amdgpu_move_blit(struct ttm_buffer_object *bo,
bool evict, bool no_wait_gpu, bool evict, bool no_wait_gpu,
...@@ -794,8 +796,8 @@ struct amdgpu_ttm_tt { ...@@ -794,8 +796,8 @@ struct amdgpu_ttm_tt {
}; };
/** /**
* amdgpu_ttm_tt_get_user_pages - Pin pages of memory pointed to * amdgpu_ttm_tt_get_user_pages - Pin pages of memory pointed to by a USERPTR
* by a USERPTR pointer to memory * pointer to memory
* *
* Called by amdgpu_gem_userptr_ioctl() and amdgpu_cs_parser_bos(). * Called by amdgpu_gem_userptr_ioctl() and amdgpu_cs_parser_bos().
* This provides a wrapper around the get_user_pages() call to provide * This provides a wrapper around the get_user_pages() call to provide
...@@ -818,8 +820,10 @@ int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page **pages) ...@@ -818,8 +820,10 @@ int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page **pages)
down_read(&mm->mmap_sem); down_read(&mm->mmap_sem);
if (gtt->userflags & AMDGPU_GEM_USERPTR_ANONONLY) { if (gtt->userflags & AMDGPU_GEM_USERPTR_ANONONLY) {
/* check that we only use anonymous memory /*
to prevent problems with writeback */ * check that we only use anonymous memory to prevent problems
* with writeback
*/
unsigned long end = gtt->userptr + ttm->num_pages * PAGE_SIZE; unsigned long end = gtt->userptr + ttm->num_pages * PAGE_SIZE;
struct vm_area_struct *vma; struct vm_area_struct *vma;
...@@ -870,10 +874,9 @@ int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page **pages) ...@@ -870,10 +874,9 @@ int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page **pages)
} }
/** /**
* amdgpu_ttm_tt_set_user_pages - Copy pages in, putting old pages * amdgpu_ttm_tt_set_user_pages - Copy pages in, putting old pages as necessary.
* as necessary.
* *
* Called by amdgpu_cs_list_validate(). This creates the page list * Called by amdgpu_cs_list_validate(). This creates the page list
* that backs user memory and will ultimately be mapped into the device * that backs user memory and will ultimately be mapped into the device
* address space. * address space.
*/ */
...@@ -915,8 +918,7 @@ void amdgpu_ttm_tt_mark_user_pages(struct ttm_tt *ttm) ...@@ -915,8 +918,7 @@ void amdgpu_ttm_tt_mark_user_pages(struct ttm_tt *ttm)
} }
/** /**
* amdgpu_ttm_tt_pin_userptr - prepare the sg table with the * amdgpu_ttm_tt_pin_userptr - prepare the sg table with the user pages
* user pages
* *
* Called by amdgpu_ttm_backend_bind() * Called by amdgpu_ttm_backend_bind()
**/ **/
...@@ -1295,8 +1297,8 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm) ...@@ -1295,8 +1297,8 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm)
} }
/** /**
* amdgpu_ttm_tt_set_userptr - Initialize userptr GTT ttm_tt * amdgpu_ttm_tt_set_userptr - Initialize userptr GTT ttm_tt for the current
* for the current task * task
* *
* @ttm: The ttm_tt object to bind this userptr object to * @ttm: The ttm_tt object to bind this userptr object to
* @addr: The address in the current tasks VM space to use * @addr: The address in the current tasks VM space to use
...@@ -1346,9 +1348,8 @@ struct mm_struct *amdgpu_ttm_tt_get_usermm(struct ttm_tt *ttm) ...@@ -1346,9 +1348,8 @@ struct mm_struct *amdgpu_ttm_tt_get_usermm(struct ttm_tt *ttm)
} }
/** /**
* amdgpu_ttm_tt_affect_userptr - Determine if a ttm_tt object lays * amdgpu_ttm_tt_affect_userptr - Determine if a ttm_tt object lays inside an
* inside an address range for the * address range for the current task.
* current task.
* *
*/ */
bool amdgpu_ttm_tt_affect_userptr(struct ttm_tt *ttm, unsigned long start, bool amdgpu_ttm_tt_affect_userptr(struct ttm_tt *ttm, unsigned long start,
...@@ -1386,8 +1387,7 @@ bool amdgpu_ttm_tt_affect_userptr(struct ttm_tt *ttm, unsigned long start, ...@@ -1386,8 +1387,7 @@ bool amdgpu_ttm_tt_affect_userptr(struct ttm_tt *ttm, unsigned long start,
} }
/** /**
* amdgpu_ttm_tt_userptr_invalidated - Has the ttm_tt object been * amdgpu_ttm_tt_userptr_invalidated - Has the ttm_tt object been invalidated?
* invalidated?
*/ */
bool amdgpu_ttm_tt_userptr_invalidated(struct ttm_tt *ttm, bool amdgpu_ttm_tt_userptr_invalidated(struct ttm_tt *ttm,
int *last_invalidated) int *last_invalidated)
...@@ -1400,10 +1400,8 @@ bool amdgpu_ttm_tt_userptr_invalidated(struct ttm_tt *ttm, ...@@ -1400,10 +1400,8 @@ bool amdgpu_ttm_tt_userptr_invalidated(struct ttm_tt *ttm,
} }
/** /**
* amdgpu_ttm_tt_userptr_needs_pages - Have the pages backing this * amdgpu_ttm_tt_userptr_needs_pages - Have the pages backing this ttm_tt object
* ttm_tt object been invalidated * been invalidated since the last time they've been set?
* since the last time they've
* been set?
*/ */
bool amdgpu_ttm_tt_userptr_needs_pages(struct ttm_tt *ttm) bool amdgpu_ttm_tt_userptr_needs_pages(struct ttm_tt *ttm)
{ {
...@@ -1459,13 +1457,12 @@ uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm, ...@@ -1459,13 +1457,12 @@ uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
} }
/** /**
* amdgpu_ttm_bo_eviction_valuable - Check to see if we can evict * amdgpu_ttm_bo_eviction_valuable - Check to see if we can evict a buffer
* a buffer object. * object.
* *
* Return true if eviction is sensible. Called by * Return true if eviction is sensible. Called by ttm_mem_evict_first() on
* ttm_mem_evict_first() on behalf of ttm_bo_mem_force_space() * behalf of ttm_bo_mem_force_space() which tries to evict buffer objects until
* which tries to evict buffer objects until it can find space * it can find space for a new object and by ttm_bo_force_list_clean() which is
* for a new object and by ttm_bo_force_list_clean() which is
* used to clean out a memory space. * used to clean out a memory space.
*/ */
static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,
...@@ -1515,8 +1512,7 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, ...@@ -1515,8 +1512,7 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,
} }
/** /**
* amdgpu_ttm_access_memory - Read or Write memory that backs a * amdgpu_ttm_access_memory - Read or Write memory that backs a buffer object.
* buffer object.
* *
* @bo: The buffer object to read/write * @bo: The buffer object to read/write
* @offset: Offset into buffer object * @offset: Offset into buffer object
...@@ -1704,8 +1700,8 @@ static int amdgpu_ttm_fw_reserve_vram_init(struct amdgpu_device *adev) ...@@ -1704,8 +1700,8 @@ static int amdgpu_ttm_fw_reserve_vram_init(struct amdgpu_device *adev)
return r; return r;
} }
/** /**
* amdgpu_ttm_init - Init the memory management (ttm) as well as * amdgpu_ttm_init - Init the memory management (ttm) as well as various
* various gtt/vram related fields. * gtt/vram related fields.
* *
* This initializes all of the memory space pools that the TTM layer * This initializes all of the memory space pools that the TTM layer
* will need such as the GTT space (system memory mapped to the device), * will need such as the GTT space (system memory mapped to the device),
...@@ -1856,8 +1852,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) ...@@ -1856,8 +1852,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
} }
/** /**
* amdgpu_ttm_late_init - Handle any late initialization for * amdgpu_ttm_late_init - Handle any late initialization for amdgpu_ttm
* amdgpu_ttm
*/ */
void amdgpu_ttm_late_init(struct amdgpu_device *adev) void amdgpu_ttm_late_init(struct amdgpu_device *adev)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment