@@ -844,7 +844,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
struct ttm_mem_reg *mem)
{
struct amdgpu_vm *vm = bo_va->vm;
- struct amdgpu_bo_va_mapping *mapping;
+ struct amdgpu_bo_va_mapping *mapping, *next;
uint32_t flags;
uint64_t addr;
int r;
@@ -864,11 +864,14 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
list_splice_init(&bo_va->valids, &bo_va->invalids);
spin_unlock(&vm->status_lock);
- list_for_each_entry(mapping, &bo_va->invalids, list) {
+ list_for_each_entry_safe(mapping, next, &bo_va->invalids, list) {
r = amdgpu_vm_bo_update_mapping(adev, vm, mapping, addr,
flags, &bo_va->last_pt_update);
if (r)
return r;
+
+ list_del_init(&mapping->list);
+ list_add(&mapping->list, &bo_va->valids);
}
spin_lock(&vm->status_lock);
Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)