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

drm/amdgpu/gmc10: use common invalidation engine helper

Rather than open coding it. This also changes the free masks
to better reflect the usage by other components.

Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

+5 -16
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
··· 335 335 } 336 336 337 337 /* 338 - * The latest engine allocation on gfx9 is: 338 + * The latest engine allocation on gfx9/10 is: 339 339 * Engine 2, 3: firmware 340 340 * Engine 0, 1, 4~16: amdgpu ring, 341 341 * subject to change when ring number changes
+4 -15
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
··· 564 564 static int gmc_v10_0_late_init(void *handle) 565 565 { 566 566 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 567 - unsigned vm_inv_eng[AMDGPU_MAX_VMHUBS] = { 4, 4 }; 568 - unsigned i; 567 + int r; 569 568 570 - for(i = 0; i < adev->num_rings; ++i) { 571 - struct amdgpu_ring *ring = adev->rings[i]; 572 - unsigned vmhub = ring->funcs->vmhub; 573 - 574 - ring->vm_inv_eng = vm_inv_eng[vmhub]++; 575 - dev_info(adev->dev, "ring %u(%s) uses VM inv eng %u on hub %u\n", 576 - ring->idx, ring->name, ring->vm_inv_eng, 577 - ring->funcs->vmhub); 578 - } 579 - 580 - /* Engine 17 is used for GART flushes */ 581 - for(i = 0; i < AMDGPU_MAX_VMHUBS; ++i) 582 - BUG_ON(vm_inv_eng[i] > 17); 569 + r = amdgpu_gmc_allocate_vm_inv_eng(adev); 570 + if (r) 571 + return r; 583 572 584 573 return amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0); 585 574 }