@@ -841,21 +841,6 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict,
841841 goto out ;
842842 }
843843
844- /* Reject BO eviction if BO is bound to current VM. */
845- if (evict && ctx -> resv ) {
846- struct drm_gpuvm_bo * vm_bo ;
847-
848- drm_gem_for_each_gpuvm_bo (vm_bo , & bo -> ttm .base ) {
849- struct xe_vm * vm = gpuvm_to_vm (vm_bo -> vm );
850-
851- if (xe_vm_resv (vm ) == ctx -> resv &&
852- xe_vm_in_preempt_fence_mode (vm )) {
853- ret = - EBUSY ;
854- goto out ;
855- }
856- }
857- }
858-
859844 /*
860845 * Failed multi-hop where the old_mem is still marked as
861846 * TTM_PL_FLAG_TEMPORARY, should just be a dummy move.
@@ -1013,6 +998,25 @@ static long xe_bo_shrink_purge(struct ttm_operation_ctx *ctx,
1013998 return lret ;
1014999}
10151000
1001+ static bool
1002+ xe_bo_eviction_valuable (struct ttm_buffer_object * bo , const struct ttm_place * place )
1003+ {
1004+ struct drm_gpuvm_bo * vm_bo ;
1005+
1006+ if (!ttm_bo_eviction_valuable (bo , place ))
1007+ return false;
1008+
1009+ if (!xe_bo_is_xe_bo (bo ))
1010+ return true;
1011+
1012+ drm_gem_for_each_gpuvm_bo (vm_bo , & bo -> base ) {
1013+ if (xe_vm_is_validating (gpuvm_to_vm (vm_bo -> vm )))
1014+ return false;
1015+ }
1016+
1017+ return true;
1018+ }
1019+
10161020/**
10171021 * xe_bo_shrink() - Try to shrink an xe bo.
10181022 * @ctx: The struct ttm_operation_ctx used for shrinking.
@@ -1047,7 +1051,7 @@ long xe_bo_shrink(struct ttm_operation_ctx *ctx, struct ttm_buffer_object *bo,
10471051 (flags .purge && !xe_tt -> purgeable ))
10481052 return - EBUSY ;
10491053
1050- if (!ttm_bo_eviction_valuable (bo , & place ))
1054+ if (!xe_bo_eviction_valuable (bo , & place ))
10511055 return - EBUSY ;
10521056
10531057 if (!xe_bo_is_xe_bo (bo ) || !xe_bo_get_unless_zero (xe_bo ))
@@ -1588,7 +1592,7 @@ const struct ttm_device_funcs xe_ttm_funcs = {
15881592 .io_mem_pfn = xe_ttm_io_mem_pfn ,
15891593 .access_memory = xe_ttm_access_memory ,
15901594 .release_notify = xe_ttm_bo_release_notify ,
1591- .eviction_valuable = ttm_bo_eviction_valuable ,
1595+ .eviction_valuable = xe_bo_eviction_valuable ,
15921596 .delete_mem_notify = xe_ttm_bo_delete_mem_notify ,
15931597 .swap_notify = xe_ttm_bo_swap_notify ,
15941598};
@@ -2431,6 +2435,8 @@ int xe_bo_validate(struct xe_bo *bo, struct xe_vm *vm, bool allow_res_evict)
24312435 .no_wait_gpu = false,
24322436 .gfp_retry_mayfail = true,
24332437 };
2438+ struct pin_cookie cookie ;
2439+ int ret ;
24342440
24352441 if (vm ) {
24362442 lockdep_assert_held (& vm -> lock );
@@ -2440,8 +2446,12 @@ int xe_bo_validate(struct xe_bo *bo, struct xe_vm *vm, bool allow_res_evict)
24402446 ctx .resv = xe_vm_resv (vm );
24412447 }
24422448
2449+ cookie = xe_vm_set_validating (vm , allow_res_evict );
24432450 trace_xe_bo_validate (bo );
2444- return ttm_bo_validate (& bo -> ttm , & bo -> placement , & ctx );
2451+ ret = ttm_bo_validate (& bo -> ttm , & bo -> placement , & ctx );
2452+ xe_vm_clear_validating (vm , allow_res_evict , cookie );
2453+
2454+ return ret ;
24452455}
24462456
24472457bool xe_bo_is_xe_bo (struct ttm_buffer_object * bo )
@@ -2557,7 +2567,7 @@ typedef int (*xe_gem_create_set_property_fn)(struct xe_device *xe,
25572567 u64 value );
25582568
25592569static const xe_gem_create_set_property_fn gem_create_set_property_funcs [] = {
2560- [DRM_XE_GEM_CREATE_EXTENSION_SET_PROPERTY ] = gem_create_set_pxp_type ,
2570+ [DRM_XE_GEM_CREATE_SET_PROPERTY_PXP_TYPE ] = gem_create_set_pxp_type ,
25612571};
25622572
25632573static int gem_create_user_ext_set_property (struct xe_device * xe ,
0 commit comments