aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index c11903257b94..6af2d3c56f38 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1104,6 +1104,32 @@ error_free:
1104} 1104}
1105 1105
1106/* 1106/*
1107 * amdgpu_vm_invalidate_level - mark all PD levels as invalid
1108 *
1109 * @parent: parent PD
1110 *
1111 * Mark all PD level as invalid after an error.
1112 */
1113static void amdgpu_vm_invalidate_level(struct amdgpu_vm_pt *parent)
1114{
1115 unsigned pt_idx;
1116
1117 /*
1118 * Recurse into the subdirectories. This recursion is harmless because
1119 * we only have a maximum of 5 layers.
1120 */
1121 for (pt_idx = 0; pt_idx <= parent->last_entry_used; ++pt_idx) {
1122 struct amdgpu_vm_pt *entry = &parent->entries[pt_idx];
1123
1124 if (!entry->bo)
1125 continue;
1126
1127 entry->addr = ~0ULL;
1128 amdgpu_vm_invalidate_level(entry);
1129 }
1130}
1131
1132/*
1107 * amdgpu_vm_update_directories - make sure that all directories are valid 1133 * amdgpu_vm_update_directories - make sure that all directories are valid
1108 * 1134 *
1109 * @adev: amdgpu_device pointer 1135 * @adev: amdgpu_device pointer
@@ -1115,7 +1141,13 @@ error_free:
1115int amdgpu_vm_update_directories(struct amdgpu_device *adev, 1141int amdgpu_vm_update_directories(struct amdgpu_device *adev,
1116 struct amdgpu_vm *vm) 1142 struct amdgpu_vm *vm)
1117{ 1143{
1118 return amdgpu_vm_update_level(adev, vm, &vm->root, 0); 1144 int r;
1145
1146 r = amdgpu_vm_update_level(adev, vm, &vm->root, 0);
1147 if (r)
1148 amdgpu_vm_invalidate_level(&vm->root);
1149
1150 return r;
1119} 1151}
1120 1152
1121/** 1153/**