Skip to contentSkip to conversation

drm/amdgpu: fix VM handling for GART allocations

PATCH In review Christian König 2 participants 2 messages Jun 5, 2021 – Jun 7, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: fix VM handling for GART allocations

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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -2
index c29fad97b63a..433642b3e498 100644
@@ -1705,8 +1705,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;
 
Signature · 6 lines
2.25.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Christian König

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.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index c29fad97b63a..433642b3e498 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, · line 1712

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -2
@@ -1705,8 +1705,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;
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx