Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu: allocate move entities dynamically

No functional change for now, as we always allocate a single entity.

Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Acked-by: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Pierre-Eric Pelloux-Prayer and committed by
Alex Deucher
ab5dd4dc 0f1fbe74

+25 -15
+22 -13
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
··· 399 399 dst.offset = 0; 400 400 401 401 r = amdgpu_ttm_copy_mem_to_mem(adev, 402 - &adev->mman.move_entity, 402 + &adev->mman.move_entities[0], 403 403 &src, &dst, 404 404 new_mem->size, 405 405 amdgpu_bo_encrypted(abo), ··· 412 412 (abo->flags & AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE)) { 413 413 struct dma_fence *wipe_fence = NULL; 414 414 415 - r = amdgpu_fill_buffer(&adev->mman.move_entity, 415 + r = amdgpu_fill_buffer(&adev->mman.move_entities[0], 416 416 abo, 0, NULL, &wipe_fence, 417 417 AMDGPU_KERNEL_JOB_ID_MOVE_BLIT); 418 418 if (r) { ··· 2335 2335 void amdgpu_ttm_set_buffer_funcs_status(struct amdgpu_device *adev, bool enable) 2336 2336 { 2337 2337 struct ttm_resource_manager *man = ttm_manager_type(&adev->mman.bdev, TTM_PL_VRAM); 2338 - u32 num_clear_entities; 2338 + u32 num_clear_entities, num_move_entities; 2339 2339 uint64_t size; 2340 2340 int r, i, j; 2341 2341 ··· 2353 2353 } 2354 2354 2355 2355 num_clear_entities = 1; 2356 + num_move_entities = 1; 2356 2357 ring = adev->mman.buffer_funcs_ring; 2357 2358 sched = &ring->sched; 2358 2359 r = amdgpu_ttm_buffer_entity_init(&adev->mman.gtt_mgr, ··· 2390 2389 } 2391 2390 } 2392 2391 2393 - r = amdgpu_ttm_buffer_entity_init(&adev->mman.gtt_mgr, 2394 - &adev->mman.move_entity, 2395 - DRM_SCHED_PRIORITY_NORMAL, 2396 - &sched, 1, 2); 2397 - if (r < 0) { 2398 - dev_err(adev->dev, 2399 - "Failed setting up TTM BO move entity (%d)\n", r); 2400 - goto error_free_clear_entities; 2392 + adev->mman.num_move_entities = num_move_entities; 2393 + for (i = 0; i < num_move_entities; i++) { 2394 + r = amdgpu_ttm_buffer_entity_init( 2395 + &adev->mman.gtt_mgr, 2396 + &adev->mman.move_entities[i], 2397 + DRM_SCHED_PRIORITY_NORMAL, &sched, 1, 2); 2398 + 2399 + if (r < 0) { 2400 + for (j = 0; j < i; j++) 2401 + amdgpu_ttm_buffer_entity_fini( 2402 + &adev->mman.gtt_mgr, &adev->mman.move_entities[j]); 2403 + adev->mman.num_move_entities = 0; 2404 + goto error_free_clear_entities; 2405 + } 2401 2406 } 2402 2407 } else { 2403 2408 amdgpu_ttm_buffer_entity_fini(&adev->mman.gtt_mgr, ··· 2411 2404 for (i = 0; i < adev->mman.num_clear_entities; i++) 2412 2405 amdgpu_ttm_buffer_entity_fini(&adev->mman.gtt_mgr, 2413 2406 &adev->mman.clear_entities[i]); 2414 - amdgpu_ttm_buffer_entity_fini(&adev->mman.gtt_mgr, 2415 - &adev->mman.move_entity); 2407 + for (i = 0; i < adev->mman.num_move_entities; i++) 2408 + amdgpu_ttm_buffer_entity_fini(&adev->mman.gtt_mgr, 2409 + &adev->mman.move_entities[i]); 2416 2410 /* Drop all the old fences since re-creating the scheduler entities 2417 2411 * will allocate new contexts. 2418 2412 */ ··· 2421 2413 kfree(adev->mman.clear_entities); 2422 2414 adev->mman.clear_entities = NULL; 2423 2415 adev->mman.num_clear_entities = 0; 2416 + adev->mman.num_move_entities = 0; 2424 2417 } 2425 2418 2426 2419 /* this just adjusts TTM size idea, which sets lpfn to the correct value */
+2 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
··· 72 72 73 73 /* @default_entity: for workarounds, has no gart windows */ 74 74 struct amdgpu_ttm_buffer_entity default_entity; 75 - struct amdgpu_ttm_buffer_entity move_entity; 76 75 struct amdgpu_ttm_buffer_entity *clear_entities; 77 76 u32 num_clear_entities; 77 + struct amdgpu_ttm_buffer_entity move_entities[TTM_NUM_MOVE_FENCES]; 78 + u32 num_move_entities; 78 79 79 80 struct amdgpu_vram_mgr vram_mgr; 80 81 struct amdgpu_gtt_mgr gtt_mgr;
+1 -1
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
··· 136 136 u64 size; 137 137 int r; 138 138 139 - entity = &adev->mman.move_entity; 139 + entity = &adev->mman.move_entities[0]; 140 140 141 141 mutex_lock(&entity->lock); 142 142