Lines Matching +full:0 +full:xe

15 static int xe_bo_apply_to_pinned(struct xe_device *xe,
22 int ret = 0;
24 spin_lock(&xe->pinned.lock);
32 spin_unlock(&xe->pinned.lock);
36 spin_lock(&xe->pinned.lock);
44 spin_unlock(&xe->pinned.lock);
47 spin_lock(&xe->pinned.lock);
50 spin_unlock(&xe->pinned.lock);
58 * @xe: xe device
62 * Return: 0 on success, negative error code on error.
64 int xe_bo_notifier_prepare_all_pinned(struct xe_device *xe)
68 ret = xe_bo_apply_to_pinned(xe, &xe->pinned.early.kernel_bo_present,
69 &xe->pinned.early.kernel_bo_present,
72 ret = xe_bo_apply_to_pinned(xe, &xe->pinned.late.kernel_bo_present,
73 &xe->pinned.late.kernel_bo_present,
82 * @xe: xe device
87 void xe_bo_notifier_unprepare_all_pinned(struct xe_device *xe)
89 (void)xe_bo_apply_to_pinned(xe, &xe->pinned.early.kernel_bo_present,
90 &xe->pinned.early.kernel_bo_present,
93 (void)xe_bo_apply_to_pinned(xe, &xe->pinned.late.kernel_bo_present,
94 &xe->pinned.late.kernel_bo_present,
100 * @xe: xe device
106 int xe_bo_evict_all_user(struct xe_device *xe)
108 struct ttm_device *bdev = &xe->ttm;
125 if (mem_type == XE_PL_TT && (IS_DGFX(xe) || !xe_device_has_flat_ccs(xe)))
135 return 0;
140 * @xe: xe device
151 int xe_bo_evict_all(struct xe_device *xe)
157 ret = xe_bo_evict_all_user(xe);
161 ret = xe_bo_apply_to_pinned(xe, &xe->pinned.late.kernel_bo_present,
162 &xe->pinned.late.evicted, xe_bo_evict_pinned);
165 ret = xe_bo_apply_to_pinned(xe, &xe->pinned.late.kernel_bo_present,
166 &xe->pinned.late.evicted, xe_bo_evict_pinned);
172 for_each_tile(tile, xe, id)
178 return xe_bo_apply_to_pinned(xe, &xe->pinned.early.kernel_bo_present,
179 &xe->pinned.early.evicted,
185 struct xe_device *xe = xe_bo_device(bo);
208 xe_assert(xe, !(bo->flags & XE_BO_FLAG_PINNED_LATE_RESTORE) ||
211 return 0;
217 * @xe: xe device
225 int xe_bo_restore_early(struct xe_device *xe)
227 return xe_bo_apply_to_pinned(xe, &xe->pinned.early.evicted,
228 &xe->pinned.early.kernel_bo_present,
235 * @xe: xe device
242 int xe_bo_restore_late(struct xe_device *xe)
247 ret = xe_bo_apply_to_pinned(xe, &xe->pinned.late.evicted,
248 &xe->pinned.late.kernel_bo_present,
251 for_each_tile(tile, xe, id)
257 if (!IS_DGFX(xe))
258 return 0;
261 ret = xe_bo_apply_to_pinned(xe, &xe->pinned.late.external,
262 &xe->pinned.late.external,
266 for_each_tile(tile, xe, id)
272 static void xe_bo_pci_dev_remove_pinned(struct xe_device *xe)
277 (void)xe_bo_apply_to_pinned(xe, &xe->pinned.late.external,
278 &xe->pinned.late.external,
280 for_each_tile(tile, xe, id)
286 * @xe: The xe device.
297 void xe_bo_pci_dev_remove_all(struct xe_device *xe)
307 ttm_manager_type(&xe->ttm, mem_type);
310 int ret = ttm_resource_manager_evict_all(&xe->ttm, man);
312 drm_WARN_ON(&xe->drm, ret);
316 xe_bo_pci_dev_remove_pinned(xe);
321 struct xe_device *xe = arg;
323 (void)xe_bo_apply_to_pinned(xe, &xe->pinned.late.kernel_bo_present,
324 &xe->pinned.late.kernel_bo_present,
326 (void)xe_bo_apply_to_pinned(xe, &xe->pinned.early.kernel_bo_present,
327 &xe->pinned.early.kernel_bo_present,
333 * @xe: The xe device.
339 * Return: %0 on success, negative error code on error.
341 int xe_bo_pinned_init(struct xe_device *xe)
343 spin_lock_init(&xe->pinned.lock);
344 INIT_LIST_HEAD(&xe->pinned.early.kernel_bo_present);
345 INIT_LIST_HEAD(&xe->pinned.early.evicted);
346 INIT_LIST_HEAD(&xe->pinned.late.kernel_bo_present);
347 INIT_LIST_HEAD(&xe->pinned.late.evicted);
348 INIT_LIST_HEAD(&xe->pinned.late.external);
350 return devm_add_action_or_reset(xe->drm.dev, xe_bo_pinned_fini, xe);