Skip to content

Commit 2b0a0ce

Browse files
nvishwa1Thomas Hellström
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 <[email protected]> Reviewed-by: Matthew Brost <[email protected]> Reviewed-by: Maarten Lankhorst <[email protected]> Signed-off-by: Matthew Brost <[email protected]> Link: https://lore.kernel.org/r/[email protected] (cherry picked from commit fbeaad0) Signed-off-by: Thomas Hellström <[email protected]>
1 parent 2e82474 commit 2b0a0ce

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
@@ -876,10 +876,7 @@ static void xe_lrc_set_ppgtt(struct xe_lrc *lrc, struct xe_vm *vm)
876876
static void xe_lrc_finish(struct xe_lrc *lrc)
877877
{
878878
xe_hw_fence_ctx_finish(&lrc->fence_ctx);
879-
xe_bo_lock(lrc->bo, false);
880-
xe_bo_unpin(lrc->bo);
881-
xe_bo_unlock(lrc->bo);
882-
xe_bo_put(lrc->bo);
879+
xe_bo_unpin_map_no_vm(lrc->bo);
883880
}
884881

885882
#define PVC_CTX_ASID (0x2e + 1)
@@ -914,7 +911,7 @@ static int xe_lrc_init(struct xe_lrc *lrc, struct xe_hw_engine *hwe,
914911
* FIXME: Perma-pinning LRC as we don't yet support moving GGTT address
915912
* via VM bind calls.
916913
*/
917-
lrc->bo = xe_bo_create_pin_map(xe, tile, vm, lrc_size,
914+
lrc->bo = xe_bo_create_pin_map(xe, tile, NULL, lrc_size,
918915
ttm_bo_type_kernel,
919916
bo_flags);
920917
if (IS_ERR(lrc->bo))
@@ -1676,9 +1673,6 @@ struct xe_lrc_snapshot *xe_lrc_snapshot_capture(struct xe_lrc *lrc)
16761673
if (!snapshot)
16771674
return NULL;
16781675

1679-
if (lrc->bo->vm)
1680-
xe_vm_get(lrc->bo->vm);
1681-
16821676
snapshot->context_desc = xe_lrc_ggtt_addr(lrc);
16831677
snapshot->ring_addr = __xe_lrc_ring_ggtt_addr(lrc);
16841678
snapshot->indirect_context_desc = xe_lrc_indirect_ring_ggtt_addr(lrc);
@@ -1700,14 +1694,12 @@ struct xe_lrc_snapshot *xe_lrc_snapshot_capture(struct xe_lrc *lrc)
17001694
void xe_lrc_snapshot_capture_delayed(struct xe_lrc_snapshot *snapshot)
17011695
{
17021696
struct xe_bo *bo;
1703-
struct xe_vm *vm;
17041697
struct iosys_map src;
17051698

17061699
if (!snapshot)
17071700
return;
17081701

17091702
bo = snapshot->lrc_bo;
1710-
vm = bo->vm;
17111703
snapshot->lrc_bo = NULL;
17121704

17131705
snapshot->lrc_snapshot = kvmalloc(snapshot->lrc_size, GFP_KERNEL);
@@ -1727,8 +1719,6 @@ void xe_lrc_snapshot_capture_delayed(struct xe_lrc_snapshot *snapshot)
17271719
xe_bo_unlock(bo);
17281720
put_bo:
17291721
xe_bo_put(bo);
1730-
if (vm)
1731-
xe_vm_put(vm);
17321722
}
17331723

17341724
void xe_lrc_snapshot_print(struct xe_lrc_snapshot *snapshot, struct drm_printer *p)
@@ -1781,14 +1771,9 @@ void xe_lrc_snapshot_free(struct xe_lrc_snapshot *snapshot)
17811771
return;
17821772

17831773
kvfree(snapshot->lrc_snapshot);
1784-
if (snapshot->lrc_bo) {
1785-
struct xe_vm *vm;
1786-
1787-
vm = snapshot->lrc_bo->vm;
1774+
if (snapshot->lrc_bo)
17881775
xe_bo_put(snapshot->lrc_bo);
1789-
if (vm)
1790-
xe_vm_put(vm);
1791-
}
1776+
17921777
kfree(snapshot);
17931778
}
17941779

0 commit comments

Comments
 (0)