OSDN Git Service

drm/amdgpu: fix VM handling for GART allocations
authorChristian König <christian.koenig@amd.com>
Sat, 5 Jun 2021 14:46:10 +0000 (16:46 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 7 Jun 2021 18:57:44 +0000 (14:57 -0400)
For GTT allocations with a GART address the res contains the VMID0
addresses and can't be used for VM handling.

So ignore the res when the pages array is given or we fill the page
tables with nonsense.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Nirmoy Das <nirmoy.das@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

index 66a379d..7ed02b8 100644 (file)
@@ -1712,8 +1712,8 @@ int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
        if (r)
                goto error_unlock;
 
-       amdgpu_res_first(res, offset, (last - start + 1) * AMDGPU_GPU_PAGE_SIZE,
-                        &cursor);
+       amdgpu_res_first(pages_addr ? NULL : res, offset,
+                        (last - start + 1) * AMDGPU_GPU_PAGE_SIZE, &cursor);
        while (cursor.remaining) {
                uint64_t tmp, num_entries, addr;