aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index c15d9b7fc93c..d48ea0f0d825 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -201,28 +201,46 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm,
201} 201}
202 202
203/** 203/**
204 * amdgpu_vm_move_pt_bos_in_lru - move the PT BOs to the LRU tail 204 * amdgpu_vm_move_level_in_lru - move one level of PT BOs to the LRU tail
205 * 205 *
206 * @adev: amdgpu device instance 206 * @adev: amdgpu device instance
207 * @vm: vm providing the BOs 207 * @vm: vm providing the BOs
208 * 208 *
209 * Move the PT BOs to the tail of the LRU. 209 * Move the PT BOs to the tail of the LRU.
210 */ 210 */
211void amdgpu_vm_move_pt_bos_in_lru(struct amdgpu_device *adev, 211static void amdgpu_vm_move_level_in_lru(struct amdgpu_vm_pt *parent)
212 struct amdgpu_vm *vm)
213{ 212{
214 struct ttm_bo_global *glob = adev->mman.bdev.glob;
215 unsigned i; 213 unsigned i;
216 214
217 spin_lock(&glob->lru_lock); 215 if (!parent->entries)
218 for (i = 0; i <= vm->root.last_entry_used; ++i) { 216 return;
219 struct amdgpu_bo *bo = vm->root.entries[i].bo;
220 217
221 if (!bo) 218 for (i = 0; i <= parent->last_entry_used; ++i) {
219 struct amdgpu_vm_pt *entry = &parent->entries[i];
220
221 if (!entry->bo)
222 continue; 222 continue;
223 223
224 ttm_bo_move_to_lru_tail(&bo->tbo); 224 ttm_bo_move_to_lru_tail(&entry->bo->tbo);
225 amdgpu_vm_move_level_in_lru(entry);
225 } 226 }
227}
228
229/**
230 * amdgpu_vm_move_pt_bos_in_lru - move the PT BOs to the LRU tail
231 *
232 * @adev: amdgpu device instance
233 * @vm: vm providing the BOs
234 *
235 * Move the PT BOs to the tail of the LRU.
236 */
237void amdgpu_vm_move_pt_bos_in_lru(struct amdgpu_device *adev,
238 struct amdgpu_vm *vm)
239{
240 struct ttm_bo_global *glob = adev->mman.bdev.glob;
241
242 spin_lock(&glob->lru_lock);
243 amdgpu_vm_move_level_in_lru(&vm->root);
226 spin_unlock(&glob->lru_lock); 244 spin_unlock(&glob->lru_lock);
227} 245}
228 246