From: Nicolai Hähnle <nicolai.haehnle@xxxxxxx> This fixes a crash with the following stack trace: amdgpu_gtt_mgr_alloc amdgpu_ttm_bind amdgpu_vm_update_page_directory amdgpu_gem_va_update_vm Signed-off-by: Nicolai Hähnle <nicolai.haehnle at amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index cd62f6f..fbfbe5a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c @@ -468,22 +468,30 @@ int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data, drm_gem_object_unreference_unlocked(gobj); return r; } static int amdgpu_gem_va_check(void *param, struct amdgpu_bo *bo) { unsigned domain = amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type); /* if anything is swapped out don't swap it in here, just abort and wait for the next CS */ + if (domain == AMDGPU_GEM_DOMAIN_CPU) + return -ERESTARTSYS; - return domain == AMDGPU_GEM_DOMAIN_CPU ? -ERESTARTSYS : 0; + if (bo->shadow) { + domain = amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type); + if (domain == AMDGPU_GEM_DOMAIN_CPU) + return -ERESTARTSYS; + } + + return 0; } /** * amdgpu_gem_va_update_vm -update the bo_va in its VM * * @adev: amdgpu_device pointer * @bo_va: bo_va to update * * Update the bo_va directly after setting it's address. Errors are not * vital here, so they are not reported back to userspace. -- 2.7.4