]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
drm/amdgpu: Fix two bugs in amdgpu_vm_bo_split_mapping
authorFelix Kuehling <Felix.Kuehling@amd.com>
Fri, 4 Mar 2016 00:13:20 +0000 (19:13 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 9 Mar 2016 18:04:00 +0000 (13:04 -0500)
Off-by-one: last is inclusive, so the maximum is start + max_size - 1
Wrong unit: addr is in bytes, max_size is in pages

Signed-off-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>
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

index cc967b44f1048a8b3c4279b2c7329125fd1bba89..330e307c36ed67575f62f6ff9f7c9bb8c96a56cc 100644 (file)
@@ -867,7 +867,7 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev,
        while (start != mapping->it.last + 1) {
                uint64_t last;
 
-               last = min((uint64_t)mapping->it.last, start + max_size);
+               last = min((uint64_t)mapping->it.last, start + max_size - 1);
                r = amdgpu_vm_bo_update_mapping(adev, gtt, gtt_flags, vm,
                                                start, last, flags, addr,
                                                fence);
@@ -875,7 +875,7 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev,
                        return r;
 
                start = last + 1;
-               addr += max_size;
+               addr += max_size * AMDGPU_GPU_PAGE_SIZE;
        }
 
        return 0;