From b7368cd1cf22a38b67273acc77ec41ccb521ef09 Mon Sep 17 00:00:00 2001 From: Matthew Brost Date: Fri, 25 Sep 2026 13:15:03 -0700 Subject: [PATCH] drm/xe: reference VM from PT BOs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PT BOs share the VM's dma-resv and therefore must keep the VM alive until all PT BOs are destroyed.   Take a VM reference from PT BOs to ensure the shared dma-resv remains valid for the lifetime of the BOs. Scope the change to PT BOs rather than all kernel BOs to minimize risk and avoid extending VM lifetimes unnecessarily. Signed-off-by: Matthew Brost Reviewed-by: Maarten Lankhorst Reviewed-by: Francois Dugast Link: https://patch.msgid.link/20260925201526.1355279-2-matthew.brost@intel.com --- drivers/gpu/drm/xe/xe_bo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c index f2ab9bf43a86..6921b6967330 100644 --- a/drivers/gpu/drm/xe/xe_bo.c +++ b/drivers/gpu/drm/xe/xe_bo.c @@ -1879,7 +1879,7 @@ static void xe_ttm_bo_destroy(struct ttm_buffer_object *ttm_bo) xe_drm_client_remove_bo(bo); #endif - if (bo->vm && xe_bo_is_user(bo)) + if (bo->vm && (xe_bo_is_user(bo) || bo->flags & XE_BO_FLAG_PAGETABLE)) xe_vm_put(bo->vm); if (bo->parent_obj) @@ -2575,7 +2575,7 @@ __xe_bo_create_locked(struct xe_device *xe, * by having all the vm's bo refereferences released at vm close * time. */ - if (vm && xe_bo_is_user(bo)) + if (vm && (xe_bo_is_user(bo) || bo->flags & XE_BO_FLAG_PAGETABLE)) xe_vm_get(vm); bo->vm = vm;