{
int db_bo_offset;
- db_bo_offset = amdgpu_bo_gpu_offset_no_check(db_bo);
+ db_bo_offset = amdgpu_bo_gpu_offset(db_bo);
/* doorbell index is 32 bit but doorbell's size can be 32 bit
* or 64 bit, so *db_size(in byte)/4 for alignment.
amdgpu_bo_unreserve(queue->db_obj.obj);
}
amdgpu_bo_unref(&queue->db_obj.obj);
+
+ r = amdgpu_bo_reserve(queue->wptr_obj.obj, true);
+ if (!r) {
+ amdgpu_bo_unpin(queue->wptr_obj.obj);
+ amdgpu_bo_unreserve(queue->wptr_obj.obj);
+ }
+ amdgpu_bo_unref(&queue->wptr_obj.obj);
+
atomic_dec(&uq_mgr->userq_count[queue->queue_type]);
#if defined(CONFIG_DEBUG_FS)
debugfs_remove_recursive(queue->debugfs_queue);
return ret;
}
- queue->wptr_obj.gpu_addr = amdgpu_bo_gpu_offset_no_check(wptr_obj->obj);
+ ret = amdgpu_bo_reserve(wptr_obj->obj, true);
+ if (ret) {
+ DRM_ERROR("Failed to reserve wptr bo\n");
+ return ret;
+ }
+
+ /* TODO use eviction fence instead of pinning. */
+ ret = amdgpu_bo_pin(wptr_obj->obj, AMDGPU_GEM_DOMAIN_GTT);
+ if (ret) {
+ drm_file_err(uq_mgr->file, "[Usermode queues] Failed to pin wptr bo\n");
+ goto unresv_bo;
+ }
+
+ queue->wptr_obj.gpu_addr = amdgpu_bo_gpu_offset(wptr_obj->obj);
+ amdgpu_bo_unreserve(wptr_obj->obj);
+
return 0;
+
+unresv_bo:
+ amdgpu_bo_unreserve(wptr_obj->obj);
+ return ret;
+
}
static int convert_to_mes_priority(int priority)