aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_object.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_object.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 6a609a25b3fa..759da5910b76 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -395,19 +395,10 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
395 amdgpu_fill_placement_to_bo(bo, placement); 395 amdgpu_fill_placement_to_bo(bo, placement);
396 /* Kernel allocation are uninterruptible */ 396 /* Kernel allocation are uninterruptible */
397 397
398 if (!resv) {
399 bool locked;
400
401 reservation_object_init(&bo->tbo.ttm_resv);
402 locked = ww_mutex_trylock(&bo->tbo.ttm_resv.lock);
403 WARN_ON(!locked);
404 }
405
406 initial_bytes_moved = atomic64_read(&adev->num_bytes_moved); 398 initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
407 r = ttm_bo_init(&adev->mman.bdev, &bo->tbo, size, type, 399 r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, size, type,
408 &bo->placement, page_align, !kernel, NULL, 400 &bo->placement, page_align, !kernel, NULL,
409 acc_size, sg, resv ? resv : &bo->tbo.ttm_resv, 401 acc_size, sg, resv, &amdgpu_ttm_bo_destroy);
410 &amdgpu_ttm_bo_destroy);
411 amdgpu_cs_report_moved_bytes(adev, 402 amdgpu_cs_report_moved_bytes(adev,
412 atomic64_read(&adev->num_bytes_moved) - initial_bytes_moved); 403 atomic64_read(&adev->num_bytes_moved) - initial_bytes_moved);
413 404
@@ -433,7 +424,7 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
433 dma_fence_put(fence); 424 dma_fence_put(fence);
434 } 425 }
435 if (!resv) 426 if (!resv)
436 ww_mutex_unlock(&bo->tbo.resv->lock); 427 amdgpu_bo_unreserve(bo);
437 *bo_ptr = bo; 428 *bo_ptr = bo;
438 429
439 trace_amdgpu_bo_create(bo); 430 trace_amdgpu_bo_create(bo);