aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c33
1 files changed, 2 insertions, 31 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 7171968f261e..9b1b6bdd4841 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -127,35 +127,6 @@ int amdgpu_gem_object_open(struct drm_gem_object *obj,
127 return 0; 127 return 0;
128} 128}
129 129
130static int amdgpu_gem_vm_check(void *param, struct amdgpu_bo *bo)
131{
132 /* if anything is swapped out don't swap it in here,
133 just abort and wait for the next CS */
134 if (!amdgpu_bo_gpu_accessible(bo))
135 return -ERESTARTSYS;
136
137 if (bo->shadow && !amdgpu_bo_gpu_accessible(bo->shadow))
138 return -ERESTARTSYS;
139
140 return 0;
141}
142
143static bool amdgpu_gem_vm_ready(struct amdgpu_device *adev,
144 struct amdgpu_vm *vm,
145 struct list_head *list)
146{
147 struct ttm_validate_buffer *entry;
148
149 list_for_each_entry(entry, list, head) {
150 struct amdgpu_bo *bo =
151 container_of(entry->bo, struct amdgpu_bo, tbo);
152 if (amdgpu_gem_vm_check(NULL, bo))
153 return false;
154 }
155
156 return !amdgpu_vm_validate_pt_bos(adev, vm, amdgpu_gem_vm_check, NULL);
157}
158
159void amdgpu_gem_object_close(struct drm_gem_object *obj, 130void amdgpu_gem_object_close(struct drm_gem_object *obj,
160 struct drm_file *file_priv) 131 struct drm_file *file_priv)
161{ 132{
@@ -189,7 +160,7 @@ void amdgpu_gem_object_close(struct drm_gem_object *obj,
189 if (bo_va && --bo_va->ref_count == 0) { 160 if (bo_va && --bo_va->ref_count == 0) {
190 amdgpu_vm_bo_rmv(adev, bo_va); 161 amdgpu_vm_bo_rmv(adev, bo_va);
191 162
192 if (amdgpu_gem_vm_ready(adev, vm, &list)) { 163 if (amdgpu_vm_ready(adev, vm)) {
193 struct dma_fence *fence = NULL; 164 struct dma_fence *fence = NULL;
194 165
195 r = amdgpu_vm_clear_freed(adev, vm, &fence); 166 r = amdgpu_vm_clear_freed(adev, vm, &fence);
@@ -513,7 +484,7 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
513{ 484{
514 int r = -ERESTARTSYS; 485 int r = -ERESTARTSYS;
515 486
516 if (!amdgpu_gem_vm_ready(adev, vm, list)) 487 if (!amdgpu_vm_ready(adev, vm))
517 goto error; 488 goto error;
518 489
519 r = amdgpu_vm_update_directories(adev, vm); 490 r = amdgpu_vm_update_directories(adev, vm);