diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2016-12-12 06:09:12 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-01-27 11:13:17 -0500 |
commit | d1144b84fc15755afcfefe5ced1748acf6c5a7c2 (patch) | |
tree | 46af2fa3436943290bdd6a2cc9f7d60bed6f0d79 /drivers/gpu/drm/amd/amdgpu | |
parent | b99f31030a50f6bb0d1e5e67a966ec1b0f5942a8 (diff) |
drm/amd/amdgpu: add check that shadow page directory is GPU-accessible
Skip amdgpu_gem_va_update_vm when shadow the page directory is swapped out.
Clean up the check for non-shadow BOs as well using the new helper function.
This fixes a crash with the stack trace:
amdgpu_gem_va_update_vm
-> amdgpu_vm_update_page_directory
-> amdgpu_ttm_bind
-> amdgpu_gtt_mgr_alloc
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index cd62f6ffde2a..4e1eb05689ec 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | |||
@@ -496,7 +496,6 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev, | |||
496 | struct amdgpu_bo_list_entry vm_pd; | 496 | struct amdgpu_bo_list_entry vm_pd; |
497 | struct ww_acquire_ctx ticket; | 497 | struct ww_acquire_ctx ticket; |
498 | struct list_head list, duplicates; | 498 | struct list_head list, duplicates; |
499 | unsigned domain; | ||
500 | int r; | 499 | int r; |
501 | 500 | ||
502 | INIT_LIST_HEAD(&list); | 501 | INIT_LIST_HEAD(&list); |
@@ -514,12 +513,18 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev, | |||
514 | goto error_print; | 513 | goto error_print; |
515 | 514 | ||
516 | list_for_each_entry(entry, &list, head) { | 515 | list_for_each_entry(entry, &list, head) { |
517 | domain = amdgpu_mem_type_to_domain(entry->bo->mem.mem_type); | 516 | struct amdgpu_bo *bo = |
517 | container_of(entry->bo, struct amdgpu_bo, tbo); | ||
518 | |||
518 | /* if anything is swapped out don't swap it in here, | 519 | /* if anything is swapped out don't swap it in here, |
519 | just abort and wait for the next CS */ | 520 | just abort and wait for the next CS */ |
520 | if (domain == AMDGPU_GEM_DOMAIN_CPU) | 521 | if (!amdgpu_bo_gpu_accessible(bo)) |
522 | goto error_unreserve; | ||
523 | |||
524 | if (bo->shadow && !amdgpu_bo_gpu_accessible(bo->shadow)) | ||
521 | goto error_unreserve; | 525 | goto error_unreserve; |
522 | } | 526 | } |
527 | |||
523 | r = amdgpu_vm_validate_pt_bos(adev, bo_va->vm, amdgpu_gem_va_check, | 528 | r = amdgpu_vm_validate_pt_bos(adev, bo_va->vm, amdgpu_gem_va_check, |
524 | NULL); | 529 | NULL); |
525 | if (r) | 530 | if (r) |