Lines Matching +full:vm +full:- +full:map
1 // SPDX-License-Identifier: GPL-2.0 AND MIT
9 #include <linux/iosys-map.h>
46 fence = xe_migrate_clear(tile->migrate, bo, bo->ttm.resource, in ccs_test_migrate()
56 return -ETIME; in ccs_test_migrate()
70 timeout = dma_resv_wait_timeout(bo->ttm.base.resv, in ccs_test_migrate()
76 return -ETIME; in ccs_test_migrate()
82 * we still have a CPU map. in ccs_test_migrate()
84 ttm = bo->ttm.ttm; in ccs_test_migrate()
87 return -EINVAL; in ccs_test_migrate()
91 if (ccs_page >= ttm->num_pages) { in ccs_test_migrate()
93 return -EINVAL; in ccs_test_migrate()
96 page = ttm->pages[ccs_page]; in ccs_test_migrate()
105 ret = -EINVAL; in ccs_test_migrate()
110 offset = min_t(u32, offset, PAGE_SIZE) / sizeof(u64) - 1; in ccs_test_migrate()
116 ret = -EINVAL; in ccs_test_migrate()
138 kunit_info(test, "Testing vram id %u\n", tile->id); in ccs_test_run_tile()
178 kunit_skip(test, "non-flat-ccs device\n"); in ccs_test_run_device()
204 struct xe_device *xe = test->priv; in xe_ccs_migrate_kunit()
213 struct xe_vm *vm = xe_migrate_get_vm(xe_device_get_root_tile(xe)->migrate); in evict_test_run_tile() local
219 dev_name(xe->drm.dev), tile->id); in evict_test_run_tile()
222 xe_vm_lock(vm, false); in evict_test_run_tile()
223 bo = xe_bo_create_user(xe, vm, 0x10000, in evict_test_run_tile()
226 xe_vm_unlock(vm); in evict_test_run_tile()
264 * GT, which re-intializes such things. We could potentially in evict_test_run_tile()
286 err = -EPROTO; in evict_test_run_tile()
292 err = -EPROTO; in evict_test_run_tile()
297 down_read(&vm->lock); in evict_test_run_tile()
298 xe_vm_lock(vm, false); in evict_test_run_tile()
299 err = xe_bo_validate(bo, bo->vm, false, exec); in evict_test_run_tile()
300 xe_vm_unlock(vm); in evict_test_run_tile()
301 up_read(&vm->lock); in evict_test_run_tile()
343 xe_vm_put(vm); in evict_test_run_tile()
355 kunit_skip(test, "non-discrete device\n"); in evict_test_run_device()
371 struct xe_device *xe = test->priv; in xe_bo_evict_kunit()
387 struct iosys_map map; in shrink_test_fill_random() local
388 int ret = ttm_bo_vmap(&bo->ttm, &map); in shrink_test_fill_random()
394 for (i = 0; i < bo->ttm.base.size; i += sizeof(u32)) { in shrink_test_fill_random()
397 iosys_map_wr(&map, i, u32, val); in shrink_test_fill_random()
399 link->val = val; in shrink_test_fill_random()
402 ttm_bo_vunmap(&bo->ttm, &map); in shrink_test_fill_random()
410 struct iosys_map map; in shrink_test_verify() local
411 int ret = ttm_bo_vmap(&bo->ttm, &map); in shrink_test_verify()
420 for (i = 0; i < bo->ttm.base.size; i += sizeof(u32)) { in shrink_test_verify()
423 if (iosys_map_rd(&map, i, u32) != val) { in shrink_test_verify()
427 (unsigned int)iosys_map_rd(&map, i, u32), val); in shrink_test_verify()
428 if (i == 0 && val != link->val) in shrink_test_verify()
435 ttm_bo_vunmap(&bo->ttm, &map); in shrink_test_verify()
480 purgeable = to_alloc - ram_and_swap; in shrink_test_run_device()
497 INIT_LIST_HEAD(&link->link); in shrink_test_run_device()
504 if (bo != ERR_PTR(-ENOMEM) && bo != ERR_PTR(-ENOSPC) && in shrink_test_run_device()
505 bo != ERR_PTR(-EINTR) && bo != ERR_PTR(-ERESTARTSYS)) in shrink_test_run_device()
512 xe_tt = container_of(bo->ttm.ttm, typeof(*xe_tt), ttm); in shrink_test_run_device()
519 xe_ttm_tt_account_subtract(xe, &xe_tt->ttm); in shrink_test_run_device()
520 xe_tt->purgeable = true; in shrink_test_run_device()
521 xe_ttm_tt_account_add(xe, &xe_tt->ttm); in shrink_test_run_device()
522 bo->ttm.priority = 0; in shrink_test_run_device()
523 spin_lock(&bo->ttm.bdev->lru_lock); in shrink_test_run_device()
524 ttm_bo_move_to_lru_tail(&bo->ttm); in shrink_test_run_device()
525 spin_unlock(&bo->ttm.bdev->lru_lock); in shrink_test_run_device()
540 mem_type = bo->ttm.resource->mem_type; in shrink_test_run_device()
542 link->bo = bo; in shrink_test_run_device()
543 list_add_tail(&link->link, &bos); in shrink_test_run_device()
547 bo->ttm.resource->mem_type); in shrink_test_run_device()
556 * Read back and destroy bos. Reset the pseudo-random seed to get an in shrink_test_run_device()
557 * identical pseudo-random number sequence for readback. in shrink_test_run_device()
562 struct xe_bo *bo = link->bo; in shrink_test_run_device()
572 /* xe_tt->purgeable is cleared on validate. */ in shrink_test_run_device()
573 xe_tt = container_of(bo->ttm.ttm, typeof(*xe_tt), ttm); in shrink_test_run_device()
574 purgeable = xe_tt->purgeable; in shrink_test_run_device()
576 ret = ttm_bo_validate(&bo->ttm, &tt_placement, &ctx); in shrink_test_run_device()
577 if (ret == -EINTR) in shrink_test_run_device()
579 } while (ret == -EINTR && !signal_pending(current)); in shrink_test_run_device()
594 xe_bo_put(link->bo); in shrink_test_run_device()
595 list_del(&link->link); in shrink_test_run_device()
606 struct xe_device *xe = test->priv; in xe_bo_shrink_kunit()