{
        entry->priority = 0;
        entry->tv.bo = &vm->root.base.bo->tbo;
-       /* One for TTM and one for the CS job */
-       entry->tv.num_shared = 2;
+       /* Two for VM updates, one for TTM and one for the CS job */
+       entry->tv.num_shared = 4;
        entry->user_pages = NULL;
        list_add(&entry->tv.head, validated);
 }
                goto error_unlock;
        }
 
+       if (flags & AMDGPU_PTE_VALID) {
+               struct amdgpu_bo *root = vm->root.base.bo;
+
+               if (!dma_fence_is_signaled(vm->last_direct))
+                       amdgpu_bo_fence(root, vm->last_direct, true);
+
+               if (!dma_fence_is_signaled(vm->last_delayed))
+                       amdgpu_bo_fence(root, vm->last_delayed, true);
+       }
+
        r = vm->update_funcs->prepare(¶ms, resv, sync_mode);
        if (r)
                goto error_unlock;