diff options
author | Christian König <christian.koenig@amd.com> | 2020-09-25 14:17:09 +0200 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2020-09-28 12:37:19 +0200 |
commit | 8e0310f0ff04ea311190f83cc0d18a656fe65d26 (patch) | |
tree | 41c1323d43847b39954748634d2d6abbeffaa3ec /drivers/gpu/drm/radeon/radeon_ttm.c | |
parent | 0b5aebec2bbfb112140122732e7d10788127f682 (diff) | |
download | linux-stable-8e0310f0ff04ea311190f83cc0d18a656fe65d26.tar.gz linux-stable-8e0310f0ff04ea311190f83cc0d18a656fe65d26.tar.bz2 linux-stable-8e0310f0ff04ea311190f83cc0d18a656fe65d26.zip |
drm/radeon: stop using TTMs fault callback
We already implemented the fault handler ourself,
just open code what is necessary here.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/392322/
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_ttm.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_ttm.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index df5cedb2b632..63e38b05a5bc 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c @@ -803,7 +803,6 @@ static struct ttm_bo_driver radeon_bo_driver = { .move = &radeon_bo_move, .verify_access = &radeon_verify_access, .move_notify = &radeon_bo_move_notify, - .fault_reserve_notify = &radeon_bo_fault_reserve_notify, .io_mem_reserve = &radeon_ttm_io_mem_reserve, }; @@ -904,17 +903,29 @@ void radeon_ttm_set_active_vram_size(struct radeon_device *rdev, u64 size) static vm_fault_t radeon_ttm_fault(struct vm_fault *vmf) { - struct ttm_buffer_object *bo; - struct radeon_device *rdev; + struct ttm_buffer_object *bo = vmf->vma->vm_private_data; + struct radeon_device *rdev = radeon_get_rdev(bo->bdev); vm_fault_t ret; - bo = (struct ttm_buffer_object *)vmf->vma->vm_private_data; - if (bo == NULL) - return VM_FAULT_NOPAGE; - - rdev = radeon_get_rdev(bo->bdev); down_read(&rdev->pm.mclk_lock); - ret = ttm_bo_vm_fault(vmf); + + ret = ttm_bo_vm_reserve(bo, vmf); + if (ret) + goto unlock_mclk; + + ret = radeon_bo_fault_reserve_notify(bo); + if (ret) + goto unlock_resv; + + ret = ttm_bo_vm_fault_reserved(vmf, vmf->vma->vm_page_prot, + TTM_BO_VM_NUM_PREFAULT, 1); + if (ret == VM_FAULT_RETRY && !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) + goto unlock_mclk; + +unlock_resv: + dma_resv_unlock(bo->base.resv); + +unlock_mclk: up_read(&rdev->pm.mclk_lock); return ret; } |