aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index f4b78b66444d..c171b16cf0f1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -116,27 +116,29 @@ void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm,
116} 116}
117 117
118/** 118/**
119 * amdgpu_vm_get_bos - add the vm BOs to a duplicates list 119 * amdgpu_vm_validate_pt_bos - validate the page table BOs
120 * 120 *
121 * @adev: amdgpu device pointer 121 * @adev: amdgpu device pointer
122 * @vm: vm providing the BOs 122 * @vm: vm providing the BOs
123 * @duplicates: head of duplicates list 123 * @validate: callback to do the validation
124 * @param: parameter for the validation callback
124 * 125 *
125 * Add the page directory to the BO duplicates list 126 * Validate the page table BOs on command submission if neccessary.
126 * for command submission.
127 */ 127 */
128void amdgpu_vm_get_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, 128int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm,
129 struct list_head *duplicates) 129 int (*validate)(void *p, struct amdgpu_bo *bo),
130 void *param)
130{ 131{
131 uint64_t num_evictions; 132 uint64_t num_evictions;
132 unsigned i; 133 unsigned i;
134 int r;
133 135
134 /* We only need to validate the page tables 136 /* We only need to validate the page tables
135 * if they aren't already valid. 137 * if they aren't already valid.
136 */ 138 */
137 num_evictions = atomic64_read(&adev->num_evictions); 139 num_evictions = atomic64_read(&adev->num_evictions);
138 if (num_evictions == vm->last_eviction_counter) 140 if (num_evictions == vm->last_eviction_counter)
139 return; 141 return 0;
140 142
141 /* add the vm page table to the list */ 143 /* add the vm page table to the list */
142 for (i = 0; i <= vm->max_pde_used; ++i) { 144 for (i = 0; i <= vm->max_pde_used; ++i) {
@@ -145,9 +147,12 @@ void amdgpu_vm_get_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm,
145 if (!entry->robj) 147 if (!entry->robj)
146 continue; 148 continue;
147 149
148 list_add(&entry->tv.head, duplicates); 150 r = validate(param, entry->robj);
151 if (r)
152 return r;
149 } 153 }
150 154
155 return 0;
151} 156}
152 157
153/** 158/**