Lines Matching +full:big +full:-

1 // SPDX-License-Identifier: MIT
3 * Copyright © 2020-2022 Intel Corporation
41 u64 batch_base = xe_migrate_batch_base(m, xe->info.has_usm); in run_sanity_job()
42 struct xe_sched_job *job = xe_bb_create_migration_job(m->q, bb, in run_sanity_job()
54 fence = dma_fence_get(&job->drm.s_fence->finished); in run_sanity_job()
58 return -ETIMEDOUT; in run_sanity_job()
75 struct xe_device *xe = tile_to_xe(m->tile); in test_copy()
77 bool big = bo->size >= SZ_2M; in test_copy() local
79 const char *str = big ? "Copying big bo" : "Copying small bo"; in test_copy()
82 struct xe_bo *remote = xe_bo_create_locked(xe, m->tile, NULL, in test_copy()
83 bo->size, in test_copy()
108 xe_map_memset(xe, &remote->vmap, 0, 0xd0, remote->size); in test_copy()
109 fence = xe_migrate_clear(m, remote, remote->ttm.resource, in test_copy()
111 if (!sanity_fence_failed(xe, fence, big ? "Clearing remote big bo" : in test_copy()
113 retval = xe_map_rd(xe, &remote->vmap, 0, u64); in test_copy()
116 retval = xe_map_rd(xe, &remote->vmap, remote->size - 8, u64); in test_copy()
123 xe_map_memset(xe, &remote->vmap, 0, 0xc0, remote->size); in test_copy()
124 xe_map_memset(xe, &bo->vmap, 0, 0xd0, bo->size); in test_copy()
127 fence = xe_migrate_copy(m, remote, bo, remote->ttm.resource, in test_copy()
128 bo->ttm.resource, false); in test_copy()
129 if (!sanity_fence_failed(xe, fence, big ? "Copying big bo remote -> vram" : in test_copy()
130 "Copying small bo remote -> vram", test)) { in test_copy()
131 retval = xe_map_rd(xe, &bo->vmap, 0, u64); in test_copy()
133 "remote -> vram bo first offset should be copied", test); in test_copy()
134 retval = xe_map_rd(xe, &bo->vmap, bo->size - 8, u64); in test_copy()
136 "remote -> vram bo offset should be copied", test); in test_copy()
141 xe_map_memset(xe, &remote->vmap, 0, 0xd0, remote->size); in test_copy()
142 xe_map_memset(xe, &bo->vmap, 0, 0xc0, bo->size); in test_copy()
144 fence = xe_migrate_copy(m, bo, remote, bo->ttm.resource, in test_copy()
145 remote->ttm.resource, false); in test_copy()
146 if (!sanity_fence_failed(xe, fence, big ? "Copying big bo vram -> remote" : in test_copy()
147 "Copying small bo vram -> remote", test)) { in test_copy()
148 retval = xe_map_rd(xe, &remote->vmap, 0, u64); in test_copy()
150 "vram -> remote bo first offset should be copied", test); in test_copy()
151 retval = xe_map_rd(xe, &remote->vmap, bo->size - 8, u64); in test_copy()
153 "vram -> remote bo last offset should be copied", test); in test_copy()
174 if (bo->ttm.resource->mem_type == XE_PL_SYSTEM) in test_copy_vram()
177 if (bo->ttm.resource->mem_type == XE_PL_VRAM0) in test_copy_vram()
186 struct xe_tile *tile = m->tile; in xe_migrate_sanity_test()
188 struct xe_bo *pt, *bo = m->pt_bo, *big, *tiny; in xe_migrate_sanity_test() local
194 u8 id = tile->id; in xe_migrate_sanity_test()
203 big = xe_bo_create_pin_map(xe, tile, m->q->vm, SZ_4M, in xe_migrate_sanity_test()
207 if (IS_ERR(big)) { in xe_migrate_sanity_test()
208 KUNIT_FAIL(test, "Failed to allocate bo: %li\n", PTR_ERR(big)); in xe_migrate_sanity_test()
212 pt = xe_bo_create_pin_map(xe, tile, m->q->vm, XE_PAGE_SIZE, in xe_migrate_sanity_test()
222 tiny = xe_bo_create_pin_map(xe, tile, m->q->vm, in xe_migrate_sanity_test()
233 bb = xe_bb_new(tile->primary_gt, 32, xe->info.has_usm); in xe_migrate_sanity_test()
241 (unsigned long)xe_bo_main_addr(m->q->vm->pt_root[id]->bo, XE_PAGE_SIZE), in xe_migrate_sanity_test()
242 (unsigned long)xe_bo_main_addr(m->pt_bo, XE_PAGE_SIZE)); in xe_migrate_sanity_test()
245 xe_map_wr(xe, &bo->vmap, XE_PAGE_SIZE * (NUM_KERNEL_PDE - 1), u64, in xe_migrate_sanity_test()
247 expected = m->q->vm->pt_ops->pte_encode_bo(pt, 0, xe->pat.idx[XE_CACHE_WB], 0); in xe_migrate_sanity_test()
248 if (m->q->vm->flags & XE_VM_FLAG_64K) in xe_migrate_sanity_test()
251 xe_res_first(pt->ttm.resource, 0, pt->size, &src_it); in xe_migrate_sanity_test()
253 xe_res_first_sg(xe_bo_sg(pt), 0, pt->size, &src_it); in xe_migrate_sanity_test()
255 emit_pte(m, bb, NUM_KERNEL_PDE - 1, xe_bo_is_vram(pt), false, in xe_migrate_sanity_test()
256 &src_it, XE_PAGE_SIZE, pt->ttm.resource); in xe_migrate_sanity_test()
258 run_sanity_job(m, xe, bb, bb->len, "Writing PTE for our fake PT", test); in xe_migrate_sanity_test()
260 retval = xe_map_rd(xe, &bo->vmap, XE_PAGE_SIZE * (NUM_KERNEL_PDE - 1), in xe_migrate_sanity_test()
265 bb->len = 0; in xe_migrate_sanity_test()
266 bb->cs[bb->len++] = MI_BATCH_BUFFER_END; in xe_migrate_sanity_test()
267 xe_map_wr(xe, &pt->vmap, 0, u32, 0xdeaddead); in xe_migrate_sanity_test()
270 emit_clear(tile->primary_gt, bb, xe_migrate_vm_addr(NUM_KERNEL_PDE - 1, 0), 4, 4, in xe_migrate_sanity_test()
275 retval = xe_map_rd(xe, &pt->vmap, 0, u32); in xe_migrate_sanity_test()
282 xe_map_memset(xe, &tiny->vmap, 0, 0x22, tiny->size); in xe_migrate_sanity_test()
284 fence = xe_migrate_clear(m, tiny, tiny->ttm.resource, in xe_migrate_sanity_test()
290 retval = xe_map_rd(xe, &tiny->vmap, 0, u32); in xe_migrate_sanity_test()
292 retval = xe_map_rd(xe, &tiny->vmap, tiny->size - 4, u32); in xe_migrate_sanity_test()
297 if (xe->info.tile_count > 1) { in xe_migrate_sanity_test()
302 /* Clear a big bo */ in xe_migrate_sanity_test()
303 kunit_info(test, "Clearing big buffer object\n"); in xe_migrate_sanity_test()
304 xe_map_memset(xe, &big->vmap, 0, 0x11, big->size); in xe_migrate_sanity_test()
306 fence = xe_migrate_clear(m, big, big->ttm.resource, in xe_migrate_sanity_test()
308 if (sanity_fence_failed(xe, fence, "Clearing big bo", test)) in xe_migrate_sanity_test()
312 retval = xe_map_rd(xe, &big->vmap, 0, u32); in xe_migrate_sanity_test()
313 check(retval, expected, "Command clear big first value", test); in xe_migrate_sanity_test()
314 retval = xe_map_rd(xe, &big->vmap, big->size - 4, u32); in xe_migrate_sanity_test()
315 check(retval, expected, "Command clear big last value", test); in xe_migrate_sanity_test()
317 kunit_info(test, "Copying big buffer object to system\n"); in xe_migrate_sanity_test()
318 test_copy_sysmem(m, big, test); in xe_migrate_sanity_test()
319 if (xe->info.tile_count > 1) { in xe_migrate_sanity_test()
320 kunit_info(test, "Copying big buffer object to other vram\n"); in xe_migrate_sanity_test()
321 test_copy_vram(m, big, test); in xe_migrate_sanity_test()
333 xe_bo_unpin(big); in xe_migrate_sanity_test()
334 xe_bo_put(big); in xe_migrate_sanity_test()
336 xe_bo_vunmap(m->pt_bo); in xe_migrate_sanity_test()
348 struct xe_migrate *m = tile->migrate; in migrate_test_run_device()
351 xe_vm_lock(m->q->vm, false); in migrate_test_run_device()
353 xe_vm_unlock(m->q->vm); in migrate_test_run_device()
363 struct xe_device *xe = test->priv; in xe_migrate_sanity_kunit()
372 struct xe_gt *gt = tile->primary_gt; in blt_copy()
373 struct xe_migrate *m = tile->migrate; in blt_copy()
376 u64 size = src_bo->size; in blt_copy()
378 struct ttm_resource *src = src_bo->ttm.resource, *dst = dst_bo->ttm.resource; in blt_copy()
383 bool src_is_vram = mem_type_is_vram(src->mem_type); in blt_copy()
384 bool dst_is_vram = mem_type_is_vram(dst->mem_type); in blt_copy()
426 bb = xe_bb_new(gt, batch_size, xe->info.has_usm); in blt_copy()
444 bb->cs[bb->len++] = MI_BATCH_BUFFER_END; in blt_copy()
445 update_idx = bb->len; in blt_copy()
455 job = xe_bb_create_migration_job(m->q, bb, in blt_copy()
456 xe_migrate_batch_base(m, xe->info.has_usm), in blt_copy()
465 mutex_lock(&m->job_mutex); in blt_copy()
468 fence = dma_fence_get(&job->drm.s_fence->finished); in blt_copy()
471 dma_fence_put(m->fence); in blt_copy()
472 m->fence = dma_fence_get(fence); in blt_copy()
474 mutex_unlock(&m->job_mutex); in blt_copy()
477 size -= src_L0; in blt_copy()
504 xe_map_memset(xe, &sys_bo->vmap, 0, 0xd0, sys_bo->size); in test_migrate()
508 retval = xe_map_rd(xe, &vram_bo->vmap, 0, u64); in test_migrate()
527 retval = xe_map_rd(xe, &vram_bo->vmap, 0, u64); in test_migrate()
529 retval = xe_map_rd(xe, &vram_bo->vmap, vram_bo->size - 8, u64); in test_migrate()
535 retval = xe_map_rd(xe, &ccs_bo->vmap, 0, u64); in test_migrate()
538 retval = xe_map_rd(xe, &ccs_bo->vmap, ccs_bo->size - 8, u64); in test_migrate()
551 timeout = dma_resv_wait_timeout(vram_bo->ttm.base.resv, in test_migrate()
566 retval = xe_map_rd(xe, &vram_bo->vmap, 0, u64); in test_migrate()
568 retval = xe_map_rd(xe, &vram_bo->vmap, vram_bo->size - 8, u64); in test_migrate()
574 retval = xe_map_rd(xe, &ccs_bo->vmap, 0, u64); in test_migrate()
576 retval = xe_map_rd(xe, &ccs_bo->vmap, ccs_bo->size - 8, u64); in test_migrate()
589 xe_map_memset(xe, &sys_bo->vmap, 0, 0xd0, sys_bo->size); in test_clear()
593 retval = xe_map_rd(xe, &vram_bo->vmap, 0, u64); in test_clear()
601 retval = xe_map_rd(xe, &sys_bo->vmap, 0, u64); in test_clear()
603 retval = xe_map_rd(xe, &sys_bo->vmap, sys_bo->size - 8, u64); in test_clear()
610 fence = xe_migrate_clear(tile->migrate, vram_bo, vram_bo->ttm.resource, in test_clear()
619 retval = xe_map_rd(xe, &sys_bo->vmap, 0, u64); in test_clear()
621 retval = xe_map_rd(xe, &sys_bo->vmap, sys_bo->size - 8, u64); in test_clear()
629 retval = xe_map_rd(xe, &sys_bo->vmap, 0, u64); in test_clear()
631 retval = xe_map_rd(xe, &sys_bo->vmap, sys_bo->size - 8, u64); in test_clear()
748 kunit_skip(test, "non-flat-ccs device\n"); in validate_ccs_test_run_device()
753 kunit_skip(test, "non-xe2 discrete device\n"); in validate_ccs_test_run_device()
769 struct xe_device *xe = test->priv; in xe_validate_ccs_kunit()