Skip to contentSkip to conversation

drm/amdgpu: make sure to only process the remaining VM range

PATCH New Christian König 1 participant 1 message Mar 15, 2021

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

PATCH 1/1 drm/amdgpu: make sure to only process the remaining VM range

We should only map the remaining size here and not the whole segment.

Fixes 3af0a018a728 ("drm/amdgpu: new resource cursor")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -1
index 318eeea577b5..ad1698bd6b24 100644
@@ -1646,7 +1646,8 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
 	while (cursor.remaining) {
 		uint64_t tmp, num_entries, addr;
 
-		num_entries = cursor.size >> AMDGPU_GPU_PAGE_SHIFT;
+		num_entries = min(cursor.size, cursor.remaining)
+			>> AMDGPU_GPU_PAGE_SHIFT;
 		if (pages_addr) {
 			bool contiguous = true;
 
Signature · 6 lines
2.25.1

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