Commit b3fcde18 authored by Nirmoy Das's avatar Nirmoy Das Committed by Alex Deucher

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: default avatarNirmoy Das <nirmoy.das@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 1331e630
...@@ -42,16 +42,11 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) ...@@ -42,16 +42,11 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
size = 1024 * 1024; size = 1024 * 1024;
/* Number of tests = /* Number of tests =
* (Total GTT - IB pool - writeback page - ring buffers) / test size * (Total GTT - gart_pin_size - (2 transfer windows for buffer moves)) / test size
*/ */
n = adev->gmc.gart_size - AMDGPU_IB_POOL_SIZE; n = adev->gmc.gart_size - atomic64_read(&adev->gart_pin_size);
for (i = 0; i < AMDGPU_MAX_RINGS; ++i) n -= AMDGPU_GTT_MAX_TRANSFER_SIZE * AMDGPU_GTT_NUM_TRANSFER_WINDOWS *
if (adev->rings[i]) AMDGPU_GPU_PAGE_SIZE;
n -= adev->rings[i]->ring_size;
if (adev->wb.wb_obj)
n -= AMDGPU_GPU_PAGE_SIZE;
if (adev->irq.ih.ring_obj)
n -= adev->irq.ih.ring_size;
n /= size; n /= size;
gtt_obj = kcalloc(n, sizeof(*gtt_obj), GFP_KERNEL); gtt_obj = kcalloc(n, sizeof(*gtt_obj), GFP_KERNEL);
......
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