forked from mirrors/linux
		
	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: 264eecdba2 ("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
(cherry picked from commit fbeaad071a98fef87deccee81d564de1c8e8e16d)
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
			
			
This commit is contained in:
		
							parent
							
								
									2e824747cf
								
							
						
					
					
						commit
						2b0a0ce0c2
					
				
					 2 changed files with 4 additions and 28 deletions
				
			
		|  | @ -132,12 +132,6 @@ static int __xe_exec_queue_init(struct xe_exec_queue *q) | ||||||
| 			flags |= XE_LRC_CREATE_RUNALONE; | 			flags |= XE_LRC_CREATE_RUNALONE; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (vm) { |  | ||||||
| 		err = xe_vm_lock(vm, true); |  | ||||||
| 		if (err) |  | ||||||
| 			return err; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	for (i = 0; i < q->width; ++i) { | 	for (i = 0; i < q->width; ++i) { | ||||||
| 		q->lrc[i] = xe_lrc_create(q->hwe, q->vm, SZ_16K, q->msix_vec, flags); | 		q->lrc[i] = xe_lrc_create(q->hwe, q->vm, SZ_16K, q->msix_vec, flags); | ||||||
| 		if (IS_ERR(q->lrc[i])) { | 		if (IS_ERR(q->lrc[i])) { | ||||||
|  | @ -146,9 +140,6 @@ static int __xe_exec_queue_init(struct xe_exec_queue *q) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (vm) |  | ||||||
| 		xe_vm_unlock(vm); |  | ||||||
| 
 |  | ||||||
| 	err = q->ops->init(q); | 	err = q->ops->init(q); | ||||||
| 	if (err) | 	if (err) | ||||||
| 		goto err_lrc; | 		goto err_lrc; | ||||||
|  |  | ||||||
|  | @ -876,10 +876,7 @@ static void xe_lrc_set_ppgtt(struct xe_lrc *lrc, struct xe_vm *vm) | ||||||
| static void xe_lrc_finish(struct xe_lrc *lrc) | static void xe_lrc_finish(struct xe_lrc *lrc) | ||||||
| { | { | ||||||
| 	xe_hw_fence_ctx_finish(&lrc->fence_ctx); | 	xe_hw_fence_ctx_finish(&lrc->fence_ctx); | ||||||
| 	xe_bo_lock(lrc->bo, false); | 	xe_bo_unpin_map_no_vm(lrc->bo); | ||||||
| 	xe_bo_unpin(lrc->bo); |  | ||||||
| 	xe_bo_unlock(lrc->bo); |  | ||||||
| 	xe_bo_put(lrc->bo); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #define PVC_CTX_ASID		(0x2e + 1) | #define PVC_CTX_ASID		(0x2e + 1) | ||||||
|  | @ -914,7 +911,7 @@ static int xe_lrc_init(struct xe_lrc *lrc, struct xe_hw_engine *hwe, | ||||||
| 	 * FIXME: Perma-pinning LRC as we don't yet support moving GGTT address | 	 * FIXME: Perma-pinning LRC as we don't yet support moving GGTT address | ||||||
| 	 * via VM bind calls. | 	 * via VM bind calls. | ||||||
| 	 */ | 	 */ | ||||||
| 	lrc->bo = xe_bo_create_pin_map(xe, tile, vm, lrc_size, | 	lrc->bo = xe_bo_create_pin_map(xe, tile, NULL, lrc_size, | ||||||
| 				       ttm_bo_type_kernel, | 				       ttm_bo_type_kernel, | ||||||
| 				       bo_flags); | 				       bo_flags); | ||||||
| 	if (IS_ERR(lrc->bo)) | 	if (IS_ERR(lrc->bo)) | ||||||
|  | @ -1676,9 +1673,6 @@ struct xe_lrc_snapshot *xe_lrc_snapshot_capture(struct xe_lrc *lrc) | ||||||
| 	if (!snapshot) | 	if (!snapshot) | ||||||
| 		return NULL; | 		return NULL; | ||||||
| 
 | 
 | ||||||
| 	if (lrc->bo->vm) |  | ||||||
| 		xe_vm_get(lrc->bo->vm); |  | ||||||
| 
 |  | ||||||
| 	snapshot->context_desc = xe_lrc_ggtt_addr(lrc); | 	snapshot->context_desc = xe_lrc_ggtt_addr(lrc); | ||||||
| 	snapshot->ring_addr = __xe_lrc_ring_ggtt_addr(lrc); | 	snapshot->ring_addr = __xe_lrc_ring_ggtt_addr(lrc); | ||||||
| 	snapshot->indirect_context_desc = xe_lrc_indirect_ring_ggtt_addr(lrc); | 	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) | ||||||
| void xe_lrc_snapshot_capture_delayed(struct xe_lrc_snapshot *snapshot) | void xe_lrc_snapshot_capture_delayed(struct xe_lrc_snapshot *snapshot) | ||||||
| { | { | ||||||
| 	struct xe_bo *bo; | 	struct xe_bo *bo; | ||||||
| 	struct xe_vm *vm; |  | ||||||
| 	struct iosys_map src; | 	struct iosys_map src; | ||||||
| 
 | 
 | ||||||
| 	if (!snapshot) | 	if (!snapshot) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	bo = snapshot->lrc_bo; | 	bo = snapshot->lrc_bo; | ||||||
| 	vm = bo->vm; |  | ||||||
| 	snapshot->lrc_bo = NULL; | 	snapshot->lrc_bo = NULL; | ||||||
| 
 | 
 | ||||||
| 	snapshot->lrc_snapshot = kvmalloc(snapshot->lrc_size, GFP_KERNEL); | 	snapshot->lrc_snapshot = kvmalloc(snapshot->lrc_size, GFP_KERNEL); | ||||||
|  | @ -1727,8 +1719,6 @@ void xe_lrc_snapshot_capture_delayed(struct xe_lrc_snapshot *snapshot) | ||||||
| 	xe_bo_unlock(bo); | 	xe_bo_unlock(bo); | ||||||
| put_bo: | put_bo: | ||||||
| 	xe_bo_put(bo); | 	xe_bo_put(bo); | ||||||
| 	if (vm) |  | ||||||
| 		xe_vm_put(vm); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void xe_lrc_snapshot_print(struct xe_lrc_snapshot *snapshot, struct drm_printer *p) | 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) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	kvfree(snapshot->lrc_snapshot); | 	kvfree(snapshot->lrc_snapshot); | ||||||
| 	if (snapshot->lrc_bo) { | 	if (snapshot->lrc_bo) | ||||||
| 		struct xe_vm *vm; |  | ||||||
| 
 |  | ||||||
| 		vm = snapshot->lrc_bo->vm; |  | ||||||
| 		xe_bo_put(snapshot->lrc_bo); | 		xe_bo_put(snapshot->lrc_bo); | ||||||
| 		if (vm) | 
 | ||||||
| 			xe_vm_put(vm); |  | ||||||
| 	} |  | ||||||
| 	kfree(snapshot); | 	kfree(snapshot); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Niranjana Vishwanathapura
						Niranjana Vishwanathapura