Commit e532a135 authored by Gerd Hoffmann's avatar Gerd Hoffmann
parent 2e3c9ec4
This diff is collapsed.
......@@ -517,9 +517,9 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
kref_init(&fbo->base.kref);
fbo->base.destroy = &ttm_transfered_destroy;
fbo->base.acc_size = 0;
fbo->base.resv = &fbo->base.base._resv;
reservation_object_init(fbo->base.resv);
ret = reservation_object_trylock(fbo->base.resv);
fbo->base.base.resv = &fbo->base.base._resv;
reservation_object_init(fbo->base.base.resv);
ret = reservation_object_trylock(fbo->base.base.resv);
WARN_ON(!ret);
*new_obj = &fbo->base;
......@@ -689,7 +689,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
int ret;
struct ttm_buffer_object *ghost_obj;
reservation_object_add_excl_fence(bo->resv, fence);
reservation_object_add_excl_fence(bo->base.resv, fence);
if (evict) {
ret = ttm_bo_wait(bo, false, false);
if (ret)
......@@ -716,7 +716,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
if (ret)
return ret;
reservation_object_add_excl_fence(ghost_obj->resv, fence);
reservation_object_add_excl_fence(ghost_obj->base.resv, fence);
/**
* If we're not moving to fixed memory, the TTM object
......@@ -752,7 +752,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
int ret;
reservation_object_add_excl_fence(bo->resv, fence);
reservation_object_add_excl_fence(bo->base.resv, fence);
if (!evict) {
struct ttm_buffer_object *ghost_obj;
......@@ -772,7 +772,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
if (ret)
return ret;
reservation_object_add_excl_fence(ghost_obj->resv, fence);
reservation_object_add_excl_fence(ghost_obj->base.resv, fence);
/**
* If we're not moving to fixed memory, the TTM object
......@@ -841,7 +841,7 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)
if (ret)
return ret;
ret = reservation_object_copy_fences(ghost->resv, bo->resv);
ret = reservation_object_copy_fences(ghost->base.resv, bo->base.resv);
/* Last resort, wait for the BO to be idle when we are OOM */
if (ret)
ttm_bo_wait(bo, false, false);
......
......@@ -71,7 +71,7 @@ static vm_fault_t ttm_bo_vm_fault_idle(struct ttm_buffer_object *bo,
ttm_bo_get(bo);
up_read(&vmf->vma->vm_mm->mmap_sem);
(void) dma_fence_wait(bo->moving, true);
reservation_object_unlock(bo->resv);
reservation_object_unlock(bo->base.resv);
ttm_bo_put(bo);
goto out_unlock;
}
......@@ -131,7 +131,7 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
* for reserve, and if it fails, retry the fault after waiting
* for the buffer to become unreserved.
*/
if (unlikely(!reservation_object_trylock(bo->resv))) {
if (unlikely(!reservation_object_trylock(bo->base.resv))) {
if (vmf->flags & FAULT_FLAG_ALLOW_RETRY) {
if (!(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {
ttm_bo_get(bo);
......@@ -296,7 +296,7 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
out_io_unlock:
ttm_mem_io_unlock(man);
out_unlock:
reservation_object_unlock(bo->resv);
reservation_object_unlock(bo->base.resv);
return ret;
}
......
......@@ -39,7 +39,7 @@ static void ttm_eu_backoff_reservation_reverse(struct list_head *list,
list_for_each_entry_continue_reverse(entry, list, head) {
struct ttm_buffer_object *bo = entry->bo;
reservation_object_unlock(bo->resv);
reservation_object_unlock(bo->base.resv);
}
}
......@@ -71,7 +71,7 @@ void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket,
if (list_empty(&bo->lru))
ttm_bo_add_to_lru(bo);
reservation_object_unlock(bo->resv);
reservation_object_unlock(bo->base.resv);
}
spin_unlock(&glob->lru_lock);
......@@ -114,7 +114,7 @@ int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
ret = __ttm_bo_reserve(bo, intr, (ticket == NULL), ticket);
if (!ret && unlikely(atomic_read(&bo->cpu_writers) > 0)) {
reservation_object_unlock(bo->resv);
reservation_object_unlock(bo->base.resv);
ret = -EBUSY;
......@@ -130,7 +130,7 @@ int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
if (!entry->num_shared)
continue;
ret = reservation_object_reserve_shared(bo->resv,
ret = reservation_object_reserve_shared(bo->base.resv,
entry->num_shared);
if (!ret)
continue;
......@@ -144,16 +144,16 @@ int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
if (ret == -EDEADLK) {
if (intr) {
ret = reservation_object_lock_slow_interruptible(bo->resv,
ret = reservation_object_lock_slow_interruptible(bo->base.resv,
ticket);
} else {
reservation_object_lock_slow(bo->resv, ticket);
reservation_object_lock_slow(bo->base.resv, ticket);
ret = 0;
}
}
if (!ret && entry->num_shared)
ret = reservation_object_reserve_shared(bo->resv,
ret = reservation_object_reserve_shared(bo->base.resv,
entry->num_shared);
if (unlikely(ret != 0)) {
......@@ -201,14 +201,14 @@ void ttm_eu_fence_buffer_objects(struct ww_acquire_ctx *ticket,
list_for_each_entry(entry, list, head) {
bo = entry->bo;
if (entry->num_shared)
reservation_object_add_shared_fence(bo->resv, fence);
reservation_object_add_shared_fence(bo->base.resv, fence);
else
reservation_object_add_excl_fence(bo->resv, fence);
reservation_object_add_excl_fence(bo->base.resv, fence);
if (list_empty(&bo->lru))
ttm_bo_add_to_lru(bo);
else
ttm_bo_move_to_lru_tail(bo, NULL);
reservation_object_unlock(bo->resv);
reservation_object_unlock(bo->base.resv);
}
spin_unlock(&glob->lru_lock);
if (ticket)
......
......@@ -48,7 +48,7 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc)
struct ttm_bo_device *bdev = bo->bdev;
uint32_t page_flags = 0;
reservation_object_assert_held(bo->resv);
reservation_object_assert_held(bo->base.resv);
if (bdev->need_dma32)
page_flags |= TTM_PAGE_FLAG_DMA32;
......
......@@ -654,14 +654,14 @@ static inline int __ttm_bo_reserve(struct ttm_buffer_object *bo,
if (WARN_ON(ticket))
return -EBUSY;
success = reservation_object_trylock(bo->resv);
success = reservation_object_trylock(bo->base.resv);
return success ? 0 : -EBUSY;
}
if (interruptible)
ret = reservation_object_lock_interruptible(bo->resv, ticket);
ret = reservation_object_lock_interruptible(bo->base.resv, ticket);
else
ret = reservation_object_lock(bo->resv, ticket);
ret = reservation_object_lock(bo->base.resv, ticket);
if (ret == -EINTR)
return -ERESTARTSYS;
return ret;
......@@ -745,10 +745,10 @@ static inline int ttm_bo_reserve_slowpath(struct ttm_buffer_object *bo,
WARN_ON(!kref_read(&bo->kref));
if (interruptible)
ret = reservation_object_lock_slow_interruptible(bo->resv,
ret = reservation_object_lock_slow_interruptible(bo->base.resv,
ticket);
else
reservation_object_lock_slow(bo->resv, ticket);
reservation_object_lock_slow(bo->base.resv, ticket);
if (likely(ret == 0))
ttm_bo_del_sub_from_lru(bo);
......@@ -773,7 +773,7 @@ static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo)
else
ttm_bo_move_to_lru_tail(bo, NULL);
spin_unlock(&bo->bdev->glob->lru_lock);
reservation_object_unlock(bo->resv);
reservation_object_unlock(bo->base.resv);
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment