[PATCH 1/2] drm/amdgpu: insert partial mappings before and after directly
Junwei Zhang
Jerry.Zhang at amd.com
Thu Mar 16 03:44:47 UTC 2017
Currently it may miss one page before or after the target mapping
Signed-off-by: Junwei Zhang <Jerry.Zhang at amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 26 ++++++++------------------
1 file changed, 8 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index f7c02a9..511c6c9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1767,7 +1767,11 @@ int amdgpu_vm_bo_clear_mappings(struct amdgpu_device *adev,
before->it.last = saddr - 1;
before->offset = tmp->offset;
before->flags = tmp->flags;
+
list_add(&before->list, &tmp->list);
+ interval_tree_insert(&before->it, &vm->va);
+ if (before->flags & AMDGPU_PTE_PRT)
+ amdgpu_vm_prt_get(adev);
}
/* Remember mapping split at the end */
@@ -1777,7 +1781,11 @@ int amdgpu_vm_bo_clear_mappings(struct amdgpu_device *adev,
after->offset = tmp->offset;
after->offset += after->it.start - tmp->it.start;
after->flags = tmp->flags;
+
list_add(&after->list, &tmp->list);
+ interval_tree_insert(&after->it, &vm->va);
+ if (after->flags & AMDGPU_PTE_PRT)
+ amdgpu_vm_prt_get(adev);
}
list_del(&tmp->list);
@@ -1799,24 +1807,6 @@ int amdgpu_vm_bo_clear_mappings(struct amdgpu_device *adev,
trace_amdgpu_vm_bo_unmap(NULL, tmp);
}
- /* Insert partial mapping before the range*/
- if (before->it.start != before->it.last) {
- interval_tree_insert(&before->it, &vm->va);
- if (before->flags & AMDGPU_PTE_PRT)
- amdgpu_vm_prt_get(adev);
- } else {
- kfree(before);
- }
-
- /* Insert partial mapping after the range */
- if (after->it.start != after->it.last) {
- interval_tree_insert(&after->it, &vm->va);
- if (after->flags & AMDGPU_PTE_PRT)
- amdgpu_vm_prt_get(adev);
- } else {
- kfree(after);
- }
-
return 0;
}
--
1.9.1
More information about the amd-gfx
mailing list