diff options
author | Huang Rui <ray.huang@amd.com> | 2018-07-26 02:08:03 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-07-27 16:00:38 -0400 |
commit | 2e603d0429a4e7cba93a4bc4fcdbdf830adaa472 (patch) | |
tree | 5491d01a36606f308fa84d6ba2dcbeb27fc9cebe /drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |
parent | 204029e1979959ea6150c2a5c3e961800f52d0d4 (diff) |
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: Huang Rui <ray.huang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 107 |
1 files changed, 51 insertions, 56 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index c1ae528c7b0e..fcf421263fd9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |||
@@ -92,11 +92,9 @@ static void amdgpu_ttm_mem_global_release(struct drm_global_reference *ref) | |||
92 | } | 92 | } |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * amdgpu_ttm_global_init - Initialize global TTM memory reference | 95 | * amdgpu_ttm_global_init - Initialize global TTM memory reference structures. |
96 | * structures. | ||
97 | * | 96 | * |
98 | * @adev: AMDGPU device for which the global structures need to be | 97 | * @adev: AMDGPU device for which the global structures need to be registered. |
99 | * registered. | ||
100 | * | 98 | * |
101 | * This is called as part of the AMDGPU ttm init from amdgpu_ttm_init() | 99 | * This is called as part of the AMDGPU ttm init from amdgpu_ttm_init() |
102 | * during bring up. | 100 | * during bring up. |
@@ -162,13 +160,12 @@ static int amdgpu_invalidate_caches(struct ttm_bo_device *bdev, uint32_t flags) | |||
162 | } | 160 | } |
163 | 161 | ||
164 | /** | 162 | /** |
165 | * amdgpu_init_mem_type - Initialize a memory manager for a specific | 163 | * amdgpu_init_mem_type - Initialize a memory manager for a specific type of |
166 | * type of memory request. | 164 | * memory request. |
167 | * | 165 | * |
168 | * @bdev: The TTM BO device object (contains a reference to | 166 | * @bdev: The TTM BO device object (contains a reference to amdgpu_device) |
169 | * amdgpu_device) | 167 | * @type: The type of memory requested |
170 | * @type: The type of memory requested | 168 | * @man: The memory type manager for each domain |
171 | * @man: | ||
172 | * | 169 | * |
173 | * This is called by ttm_bo_init_mm() when a buffer object is being | 170 | * This is called by ttm_bo_init_mm() when a buffer object is being |
174 | * initialized. | 171 | * initialized. |
@@ -292,8 +289,8 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo, | |||
292 | /** | 289 | /** |
293 | * amdgpu_verify_access - Verify access for a mmap call | 290 | * amdgpu_verify_access - Verify access for a mmap call |
294 | * | 291 | * |
295 | * @bo: The buffer object to map | 292 | * @bo: The buffer object to map |
296 | * @filp: The file pointer from the process performing the mmap | 293 | * @filp: The file pointer from the process performing the mmap |
297 | * | 294 | * |
298 | * This is called by ttm_bo_mmap() to verify whether a process | 295 | * This is called by ttm_bo_mmap() to verify whether a process |
299 | * has the right to mmap a BO to their process space. | 296 | * 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 | /** | 315 | /** |
319 | * amdgpu_move_null - Register memory for a buffer object | 316 | * amdgpu_move_null - Register memory for a buffer object |
320 | * | 317 | * |
321 | * @bo: The bo to assign the memory to | 318 | * @bo: The bo to assign the memory to |
322 | * @new_mem: The memory to be assigned. | 319 | * @new_mem: The memory to be assigned. |
323 | * | 320 | * |
324 | * Assign the memory from new_mem to the memory of the buffer object | 321 | * Assign the memory from new_mem to the memory of the buffer object bo. |
325 | * bo. | ||
326 | */ | 322 | */ |
327 | static void amdgpu_move_null(struct ttm_buffer_object *bo, | 323 | static void amdgpu_move_null(struct ttm_buffer_object *bo, |
328 | struct ttm_mem_reg *new_mem) | 324 | struct ttm_mem_reg *new_mem) |
@@ -335,8 +331,12 @@ static void amdgpu_move_null(struct ttm_buffer_object *bo, | |||
335 | } | 331 | } |
336 | 332 | ||
337 | /** | 333 | /** |
338 | * amdgpu_mm_node_addr - Compute the GPU relative offset of a GTT | 334 | * amdgpu_mm_node_addr - Compute the GPU relative offset of a GTT buffer. |
339 | * buffer. | 335 | * |
336 | * @bo: The bo to assign the memory to. | ||
337 | * @mm_node: Memory manager node for drm allocator. | ||
338 | * @mem: The region where the bo resides. | ||
339 | * | ||
340 | */ | 340 | */ |
341 | static uint64_t amdgpu_mm_node_addr(struct ttm_buffer_object *bo, | 341 | static uint64_t amdgpu_mm_node_addr(struct ttm_buffer_object *bo, |
342 | struct drm_mm_node *mm_node, | 342 | struct drm_mm_node *mm_node, |
@@ -352,10 +352,12 @@ static uint64_t amdgpu_mm_node_addr(struct ttm_buffer_object *bo, | |||
352 | } | 352 | } |
353 | 353 | ||
354 | /** | 354 | /** |
355 | * amdgpu_find_mm_node - Helper function finds the drm_mm_node | 355 | * amdgpu_find_mm_node - Helper function finds the drm_mm_node corresponding to |
356 | * corresponding to @offset. It also modifies | 356 | * @offset. It also modifies the offset to be within the drm_mm_node returned |
357 | * the offset to be within the drm_mm_node | 357 | * |
358 | * returned | 358 | * @mem: The region where the bo resides. |
359 | * @offset: The offset that drm_mm_node is used for finding. | ||
360 | * | ||
359 | */ | 361 | */ |
360 | static struct drm_mm_node *amdgpu_find_mm_node(struct ttm_mem_reg *mem, | 362 | static struct drm_mm_node *amdgpu_find_mm_node(struct ttm_mem_reg *mem, |
361 | unsigned long *offset) | 363 | unsigned long *offset) |
@@ -497,8 +499,8 @@ error: | |||
497 | /** | 499 | /** |
498 | * amdgpu_move_blit - Copy an entire buffer to another buffer | 500 | * amdgpu_move_blit - Copy an entire buffer to another buffer |
499 | * | 501 | * |
500 | * This is a helper called by amdgpu_bo_move() and | 502 | * This is a helper called by amdgpu_bo_move() and amdgpu_move_vram_ram() to |
501 | * amdgpu_move_vram_ram() to help move buffers to and from VRAM. | 503 | * help move buffers to and from VRAM. |
502 | */ | 504 | */ |
503 | static int amdgpu_move_blit(struct ttm_buffer_object *bo, | 505 | static int amdgpu_move_blit(struct ttm_buffer_object *bo, |
504 | bool evict, bool no_wait_gpu, | 506 | bool evict, bool no_wait_gpu, |
@@ -794,8 +796,8 @@ struct amdgpu_ttm_tt { | |||
794 | }; | 796 | }; |
795 | 797 | ||
796 | /** | 798 | /** |
797 | * amdgpu_ttm_tt_get_user_pages - Pin pages of memory pointed to | 799 | * amdgpu_ttm_tt_get_user_pages - Pin pages of memory pointed to by a USERPTR |
798 | * by a USERPTR pointer to memory | 800 | * pointer to memory |
799 | * | 801 | * |
800 | * Called by amdgpu_gem_userptr_ioctl() and amdgpu_cs_parser_bos(). | 802 | * Called by amdgpu_gem_userptr_ioctl() and amdgpu_cs_parser_bos(). |
801 | * This provides a wrapper around the get_user_pages() call to provide | 803 | * 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 | down_read(&mm->mmap_sem); | 820 | down_read(&mm->mmap_sem); |
819 | 821 | ||
820 | if (gtt->userflags & AMDGPU_GEM_USERPTR_ANONONLY) { | 822 | if (gtt->userflags & AMDGPU_GEM_USERPTR_ANONONLY) { |
821 | /* check that we only use anonymous memory | 823 | /* |
822 | to prevent problems with writeback */ | 824 | * check that we only use anonymous memory to prevent problems |
825 | * with writeback | ||
826 | */ | ||
823 | unsigned long end = gtt->userptr + ttm->num_pages * PAGE_SIZE; | 827 | unsigned long end = gtt->userptr + ttm->num_pages * PAGE_SIZE; |
824 | struct vm_area_struct *vma; | 828 | struct vm_area_struct *vma; |
825 | 829 | ||
@@ -870,10 +874,9 @@ release_pages: | |||
870 | } | 874 | } |
871 | 875 | ||
872 | /** | 876 | /** |
873 | * amdgpu_ttm_tt_set_user_pages - Copy pages in, putting old pages | 877 | * amdgpu_ttm_tt_set_user_pages - Copy pages in, putting old pages as necessary. |
874 | * as necessary. | ||
875 | * | 878 | * |
876 | * Called by amdgpu_cs_list_validate(). This creates the page list | 879 | * Called by amdgpu_cs_list_validate(). This creates the page list |
877 | * that backs user memory and will ultimately be mapped into the device | 880 | * that backs user memory and will ultimately be mapped into the device |
878 | * address space. | 881 | * address space. |
879 | */ | 882 | */ |
@@ -915,8 +918,7 @@ void amdgpu_ttm_tt_mark_user_pages(struct ttm_tt *ttm) | |||
915 | } | 918 | } |
916 | 919 | ||
917 | /** | 920 | /** |
918 | * amdgpu_ttm_tt_pin_userptr - prepare the sg table with the | 921 | * amdgpu_ttm_tt_pin_userptr - prepare the sg table with the user pages |
919 | * user pages | ||
920 | * | 922 | * |
921 | * Called by amdgpu_ttm_backend_bind() | 923 | * Called by amdgpu_ttm_backend_bind() |
922 | **/ | 924 | **/ |
@@ -1295,8 +1297,8 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm) | |||
1295 | } | 1297 | } |
1296 | 1298 | ||
1297 | /** | 1299 | /** |
1298 | * amdgpu_ttm_tt_set_userptr - Initialize userptr GTT ttm_tt | 1300 | * amdgpu_ttm_tt_set_userptr - Initialize userptr GTT ttm_tt for the current |
1299 | * for the current task | 1301 | * task |
1300 | * | 1302 | * |
1301 | * @ttm: The ttm_tt object to bind this userptr object to | 1303 | * @ttm: The ttm_tt object to bind this userptr object to |
1302 | * @addr: The address in the current tasks VM space to use | 1304 | * @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 | } | 1348 | } |
1347 | 1349 | ||
1348 | /** | 1350 | /** |
1349 | * amdgpu_ttm_tt_affect_userptr - Determine if a ttm_tt object lays | 1351 | * amdgpu_ttm_tt_affect_userptr - Determine if a ttm_tt object lays inside an |
1350 | * inside an address range for the | 1352 | * address range for the current task. |
1351 | * current task. | ||
1352 | * | 1353 | * |
1353 | */ | 1354 | */ |
1354 | bool amdgpu_ttm_tt_affect_userptr(struct ttm_tt *ttm, unsigned long start, | 1355 | 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 | } | 1387 | } |
1387 | 1388 | ||
1388 | /** | 1389 | /** |
1389 | * amdgpu_ttm_tt_userptr_invalidated - Has the ttm_tt object been | 1390 | * amdgpu_ttm_tt_userptr_invalidated - Has the ttm_tt object been invalidated? |
1390 | * invalidated? | ||
1391 | */ | 1391 | */ |
1392 | bool amdgpu_ttm_tt_userptr_invalidated(struct ttm_tt *ttm, | 1392 | bool amdgpu_ttm_tt_userptr_invalidated(struct ttm_tt *ttm, |
1393 | int *last_invalidated) | 1393 | int *last_invalidated) |
@@ -1400,10 +1400,8 @@ bool amdgpu_ttm_tt_userptr_invalidated(struct ttm_tt *ttm, | |||
1400 | } | 1400 | } |
1401 | 1401 | ||
1402 | /** | 1402 | /** |
1403 | * amdgpu_ttm_tt_userptr_needs_pages - Have the pages backing this | 1403 | * amdgpu_ttm_tt_userptr_needs_pages - Have the pages backing this ttm_tt object |
1404 | * ttm_tt object been invalidated | 1404 | * been invalidated since the last time they've been set? |
1405 | * since the last time they've | ||
1406 | * been set? | ||
1407 | */ | 1405 | */ |
1408 | bool amdgpu_ttm_tt_userptr_needs_pages(struct ttm_tt *ttm) | 1406 | bool amdgpu_ttm_tt_userptr_needs_pages(struct ttm_tt *ttm) |
1409 | { | 1407 | { |
@@ -1459,13 +1457,12 @@ uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm, | |||
1459 | } | 1457 | } |
1460 | 1458 | ||
1461 | /** | 1459 | /** |
1462 | * amdgpu_ttm_bo_eviction_valuable - Check to see if we can evict | 1460 | * amdgpu_ttm_bo_eviction_valuable - Check to see if we can evict a buffer |
1463 | * a buffer object. | 1461 | * object. |
1464 | * | 1462 | * |
1465 | * Return true if eviction is sensible. Called by | 1463 | * Return true if eviction is sensible. Called by ttm_mem_evict_first() on |
1466 | * ttm_mem_evict_first() on behalf of ttm_bo_mem_force_space() | 1464 | * behalf of ttm_bo_mem_force_space() which tries to evict buffer objects until |
1467 | * which tries to evict buffer objects until it can find space | 1465 | * it can find space for a new object and by ttm_bo_force_list_clean() which is |
1468 | * for a new object and by ttm_bo_force_list_clean() which is | ||
1469 | * used to clean out a memory space. | 1466 | * used to clean out a memory space. |
1470 | */ | 1467 | */ |
1471 | static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, | 1468 | 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 | } | 1512 | } |
1516 | 1513 | ||
1517 | /** | 1514 | /** |
1518 | * amdgpu_ttm_access_memory - Read or Write memory that backs a | 1515 | * amdgpu_ttm_access_memory - Read or Write memory that backs a buffer object. |
1519 | * buffer object. | ||
1520 | * | 1516 | * |
1521 | * @bo: The buffer object to read/write | 1517 | * @bo: The buffer object to read/write |
1522 | * @offset: Offset into buffer object | 1518 | * @offset: Offset into buffer object |
@@ -1704,8 +1700,8 @@ error_create: | |||
1704 | return r; | 1700 | return r; |
1705 | } | 1701 | } |
1706 | /** | 1702 | /** |
1707 | * amdgpu_ttm_init - Init the memory management (ttm) as well as | 1703 | * amdgpu_ttm_init - Init the memory management (ttm) as well as various |
1708 | * various gtt/vram related fields. | 1704 | * gtt/vram related fields. |
1709 | * | 1705 | * |
1710 | * This initializes all of the memory space pools that the TTM layer | 1706 | * This initializes all of the memory space pools that the TTM layer |
1711 | * will need such as the GTT space (system memory mapped to the device), | 1707 | * 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 | } | 1852 | } |
1857 | 1853 | ||
1858 | /** | 1854 | /** |
1859 | * amdgpu_ttm_late_init - Handle any late initialization for | 1855 | * amdgpu_ttm_late_init - Handle any late initialization for amdgpu_ttm |
1860 | * amdgpu_ttm | ||
1861 | */ | 1856 | */ |
1862 | void amdgpu_ttm_late_init(struct amdgpu_device *adev) | 1857 | void amdgpu_ttm_late_init(struct amdgpu_device *adev) |
1863 | { | 1858 | { |