Skip to content

Commit fbeaad0

Browse files
nvishwa1mbrost05
authored andcommitted
drm/xe: Create LRC BO without VM
Specifying VM during lrc->bo creation requires VM's reference to be held for the lifetime of lrc->bo as it will use VM's dma reservation object. Using VM's dma reservation object for lrc->bo doesn't provide any advantage. Hence do not pass VM while creating lrc->bo. v2: Use xe_bo_unpin_map_no_vm (Matthew Brost) Fixes: 264eecd ("drm/xe: Decouple xe_exec_queue and xe_lrc") Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com> Link: https://lore.kernel.org/r/20250529052031.2429120-2-niranjana.vishwanathapura@intel.com
1 parent 4f296d7 commit fbeaad0

File tree

2 files changed

+4
-28
lines changed

2 files changed

+4
-28
lines changed

drivers/gpu/drm/xe/xe_exec_queue.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,6 @@ static int __xe_exec_queue_init(struct xe_exec_queue *q)
132132
flags |= XE_LRC_CREATE_RUNALONE;
133133
}
134134

135-
if (vm) {
136-
err = xe_vm_lock(vm, true);
137-
if (err)
138-
return err;
139-
}
140-
141135
for (i = 0; i < q->width; ++i) {
142136
q->lrc[i] = xe_lrc_create(q->hwe, q->vm, SZ_16K, q->msix_vec, flags);
143137
if (IS_ERR(q->lrc[i])) {
@@ -146,9 +140,6 @@ static int __xe_exec_queue_init(struct xe_exec_queue *q)
146140
}
147141
}
148142

149-
if (vm)
150-
xe_vm_unlock(vm);
151-
152143
err = q->ops->init(q);
153144
if (err)
154145
goto err_lrc;

drivers/gpu/drm/xe/xe_lrc.c

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -909,10 +909,7 @@ static void xe_lrc_set_ppgtt(struct xe_lrc *lrc, struct xe_vm *vm)
909909
static void xe_lrc_finish(struct xe_lrc *lrc)
910910
{
911911
xe_hw_fence_ctx_finish(&lrc->fence_ctx);
912-
xe_bo_lock(lrc->bo, false);
913-
xe_bo_unpin(lrc->bo);
914-
xe_bo_unlock(lrc->bo);
915-
xe_bo_put(lrc->bo);
912+
xe_bo_unpin_map_no_vm(lrc->bo);
916913
xe_bo_unpin_map_no_vm(lrc->bb_per_ctx_bo);
917914
}
918915

@@ -1007,7 +1004,7 @@ static int xe_lrc_init(struct xe_lrc *lrc, struct xe_hw_engine *hwe,
10071004
* FIXME: Perma-pinning LRC as we don't yet support moving GGTT address
10081005
* via VM bind calls.
10091006
*/
1010-
lrc->bo = xe_bo_create_pin_map(xe, tile, vm, lrc_size,
1007+
lrc->bo = xe_bo_create_pin_map(xe, tile, NULL, lrc_size,
10111008
ttm_bo_type_kernel,
10121009
bo_flags);
10131010
if (IS_ERR(lrc->bo))
@@ -1795,9 +1792,6 @@ struct xe_lrc_snapshot *xe_lrc_snapshot_capture(struct xe_lrc *lrc)
17951792
if (!snapshot)
17961793
return NULL;
17971794

1798-
if (lrc->bo->vm)
1799-
xe_vm_get(lrc->bo->vm);
1800-
18011795
snapshot->context_desc = xe_lrc_ggtt_addr(lrc);
18021796
snapshot->ring_addr = __xe_lrc_ring_ggtt_addr(lrc);
18031797
snapshot->indirect_context_desc = xe_lrc_indirect_ring_ggtt_addr(lrc);
@@ -1819,14 +1813,12 @@ struct xe_lrc_snapshot *xe_lrc_snapshot_capture(struct xe_lrc *lrc)
18191813
void xe_lrc_snapshot_capture_delayed(struct xe_lrc_snapshot *snapshot)
18201814
{
18211815
struct xe_bo *bo;
1822-
struct xe_vm *vm;
18231816
struct iosys_map src;
18241817

18251818
if (!snapshot)
18261819
return;
18271820

18281821
bo = snapshot->lrc_bo;
1829-
vm = bo->vm;
18301822
snapshot->lrc_bo = NULL;
18311823

18321824
snapshot->lrc_snapshot = kvmalloc(snapshot->lrc_size, GFP_KERNEL);
@@ -1846,8 +1838,6 @@ void xe_lrc_snapshot_capture_delayed(struct xe_lrc_snapshot *snapshot)
18461838
xe_bo_unlock(bo);
18471839
put_bo:
18481840
xe_bo_put(bo);
1849-
if (vm)
1850-
xe_vm_put(vm);
18511841
}
18521842

18531843
void xe_lrc_snapshot_print(struct xe_lrc_snapshot *snapshot, struct drm_printer *p)
@@ -1900,14 +1890,9 @@ void xe_lrc_snapshot_free(struct xe_lrc_snapshot *snapshot)
19001890
return;
19011891

19021892
kvfree(snapshot->lrc_snapshot);
1903-
if (snapshot->lrc_bo) {
1904-
struct xe_vm *vm;
1905-
1906-
vm = snapshot->lrc_bo->vm;
1893+
if (snapshot->lrc_bo)
19071894
xe_bo_put(snapshot->lrc_bo);
1908-
if (vm)
1909-
xe_vm_put(vm);
1910-
}
1895+
19111896
kfree(snapshot);
19121897
}
19131898

0 commit comments

Comments
 (0)