xe_reg_sr_apply_mmio(&hwe->reg_sr, gt);
xe_reg_sr_apply_whitelist(&hwe->reg_whitelist, hwe->mmio_base, gt);
- hwe->hwsp = xe_bo_create_locked(xe, gt, NULL, SZ_4K, ttm_bo_type_kernel,
- XE_BO_CREATE_VRAM_IF_DGFX(gt) |
- XE_BO_CREATE_GGTT_BIT);
+ hwe->hwsp = xe_bo_create_pin_map(xe, gt, NULL, SZ_4K, ttm_bo_type_kernel,
+ XE_BO_CREATE_VRAM_IF_DGFX(gt) |
+ XE_BO_CREATE_GGTT_BIT);
if (IS_ERR(hwe->hwsp)) {
err = PTR_ERR(hwe->hwsp);
goto err_name;
}
- err = xe_bo_pin(hwe->hwsp);
- if (err)
- goto err_unlock_put_hwsp;
-
- err = xe_bo_vmap(hwe->hwsp);
- if (err)
- goto err_unpin_hwsp;
-
- xe_bo_unlock_no_vm(hwe->hwsp);
-
err = xe_lrc_init(&hwe->kernel_lrc, hwe, NULL, NULL, SZ_16K);
if (err)
goto err_hwsp;
return 0;
-err_unpin_hwsp:
- xe_bo_unpin(hwe->hwsp);
-err_unlock_put_hwsp:
- xe_bo_unlock_no_vm(hwe->hwsp);
- xe_bo_put(hwe->hwsp);
err_kernel_lrc:
xe_lrc_finish(&hwe->kernel_lrc);
err_hwsp:
- xe_bo_put(hwe->hwsp);
+ xe_bo_unpin_map_no_vm(hwe->hwsp);
err_name:
hwe->name = NULL;
lrc->flags = 0;
- lrc->bo = xe_bo_create_locked(xe, hwe->gt, vm,
+ /*
+ * FIXME: Perma-pinning LRC as we don't yet support moving GGTT address
+ * via VM bind calls.
+ */
+ lrc->bo = xe_bo_create_pin_map(xe, hwe->gt, vm,
ring_size + xe_lrc_size(xe, hwe->class),
ttm_bo_type_kernel,
XE_BO_CREATE_VRAM_IF_DGFX(hwe->gt) |
else
lrc->full_gt = hwe->gt;
- /*
- * FIXME: Perma-pinning LRC as we don't yet support moving GGTT address
- * via VM bind calls.
- */
- err = xe_bo_pin(lrc->bo);
- if (err)
- goto err_unlock_put_bo;
- lrc->flags |= XE_LRC_PINNED;
-
- err = xe_bo_vmap(lrc->bo);
- if (err)
- goto err_unpin_bo;
-
- xe_bo_unlock_vm_held(lrc->bo);
-
lrc->ring.size = ring_size;
lrc->ring.tail = 0;
if (!gt->default_lrc[hwe->class]) {
init_data = empty_lrc_data(hwe);
if (!init_data) {
- xe_lrc_finish(lrc);
- return -ENOMEM;
+ err = -ENOMEM;
+ goto err_lrc_finish;
}
}
return 0;
-err_unpin_bo:
- if (lrc->flags & XE_LRC_PINNED)
- xe_bo_unpin(lrc->bo);
-err_unlock_put_bo:
- xe_bo_unlock_vm_held(lrc->bo);
- xe_bo_put(lrc->bo);
+err_lrc_finish:
+ xe_lrc_finish(lrc);
return err;
}
struct ww_acquire_ctx ww;
xe_hw_fence_ctx_finish(&lrc->fence_ctx);
- if (lrc->flags & XE_LRC_PINNED) {
- if (lrc->bo->vm)
- xe_vm_lock(lrc->bo->vm, &ww, 0, false);
- else
- xe_bo_lock_no_vm(lrc->bo, NULL);
- xe_bo_unpin(lrc->bo);
- if (lrc->bo->vm)
- xe_vm_unlock(lrc->bo->vm, &ww);
- else
- xe_bo_unlock_no_vm(lrc->bo);
- }
+ if (lrc->bo->vm)
+ xe_vm_lock(lrc->bo->vm, &ww, 0, false);
+ else
+ xe_bo_lock_no_vm(lrc->bo, NULL);
+ xe_bo_unpin(lrc->bo);
+ if (lrc->bo->vm)
+ xe_vm_unlock(lrc->bo->vm, &ww);
+ else
+ xe_bo_unlock_no_vm(lrc->bo);
xe_bo_put(lrc->bo);
}