diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c index 7fb2fe1f826c..4b351dbf6572 100644 --- a/drivers/gpu/drm/xe/xe_pt.c +++ b/drivers/gpu/drm/xe/xe_pt.c @@ -236,9 +236,11 @@ void xe_pt_destroy(struct xe_pt *pt, u32 flags, struct llist_head *deferred) */ void xe_pt_clear(struct xe_device *xe, struct xe_pt *pt) { - struct iosys_map *map = &pt->bo->vmap; + struct xe_bo *bo = pt->bo; - xe_map_memset(xe, map, 0, 0, SZ_4K); + xe_bo_assert_held(bo); + if (!iosys_map_is_null(&bo->vmap)) + xe_map_memset(xe, &bo->vmap, 0, 0, SZ_4K); } /** diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c index 753a5fc55baa..cc96e2b7f3a7 100644 --- a/drivers/gpu/drm/xe/xe_vm.c +++ b/drivers/gpu/drm/xe/xe_vm.c @@ -1876,6 +1876,8 @@ static void xe_vm_close(struct xe_vm *vm) bound = drm_dev_enter(&xe->drm, &idx); down_write(&vm->lock); + xe_vm_lock(vm, false); + if (xe_vm_in_fault_mode(vm)) xe_svm_notifier_lock(vm); @@ -1903,6 +1905,8 @@ static void xe_vm_close(struct xe_vm *vm) if (xe_vm_in_fault_mode(vm)) xe_svm_notifier_unlock(vm); + + xe_vm_unlock(vm); up_write(&vm->lock); if (bound)