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

drm/amdgpu: fix usable gart size calculation

amdgpu_do_test_moves() is failing because of wrong
usable gart size calculation and throwing:

[drm:amdgpu_do_test_moves [amdgpu]] *ERROR* 0000000020bdc9f3 bind failed

Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Nirmoy Das and committed by
Alex Deucher
b3fcde18 1331e630

+4 -9
+4 -9
drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
··· 42 42 size = 1024 * 1024; 43 43 44 44 /* Number of tests = 45 - * (Total GTT - IB pool - writeback page - ring buffers) / test size 45 + * (Total GTT - gart_pin_size - (2 transfer windows for buffer moves)) / test size 46 46 */ 47 - n = adev->gmc.gart_size - AMDGPU_IB_POOL_SIZE; 48 - for (i = 0; i < AMDGPU_MAX_RINGS; ++i) 49 - if (adev->rings[i]) 50 - n -= adev->rings[i]->ring_size; 51 - if (adev->wb.wb_obj) 52 - n -= AMDGPU_GPU_PAGE_SIZE; 53 - if (adev->irq.ih.ring_obj) 54 - n -= adev->irq.ih.ring_size; 47 + n = adev->gmc.gart_size - atomic64_read(&adev->gart_pin_size); 48 + n -= AMDGPU_GTT_MAX_TRANSFER_SIZE * AMDGPU_GTT_NUM_TRANSFER_WINDOWS * 49 + AMDGPU_GPU_PAGE_SIZE; 55 50 n /= size; 56 51 57 52 gtt_obj = kcalloc(n, sizeof(*gtt_obj), GFP_KERNEL);