summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/xe/tests
diff options
context:
space:
mode:
authorMatt Roper <matthew.d.roper@intel.com>2023-06-02 00:52:27 +0300
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-20 02:34:15 +0300
commit08dea7674533cfd49764bcd09ba84de7143361ab (patch)
tree9b7d342551c0ac5512cf68bd69c6195e7c999f72 /drivers/gpu/drm/xe/tests
parent876611c2b75689c6bea43bdbbbef9b358f71526a (diff)
downloadlinux-08dea7674533cfd49764bcd09ba84de7143361ab.tar.xz
drm/xe: Move migration from GT to tile
Migration primarily focuses on the memory associated with a tile, so it makes more sense to track this at the tile level (especially since the driver was already skipping migration operations on media GTs). Note that the blitter engine used to perform the migration always lives in the tile's primary GT today. In theory that could change if media GTs ever start including blitter engines in the future, but we can extend the design if/when that happens in the future. v2: - Fix kunit test build - Kerneldoc parameter name update v3: - Removed leftover prototype for removed function. (Gustavo) - Remove unrelated / unwanted error handling change. (Gustavo) Cc: Gustavo Sousa <gustavo.sousa@intel.com> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> Acked-by: Gustavo Sousa <gustavo.sousa@intel.com> Link: https://lore.kernel.org/r/20230601215244.678611-15-matthew.d.roper@intel.com Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/xe/tests')
-rw-r--r--drivers/gpu/drm/xe/tests/xe_bo.c4
-rw-r--r--drivers/gpu/drm/xe/tests/xe_migrate.c25
2 files changed, 14 insertions, 15 deletions
diff --git a/drivers/gpu/drm/xe/tests/xe_bo.c b/drivers/gpu/drm/xe/tests/xe_bo.c
index f933e5df6c12..5309204d8d1b 100644
--- a/drivers/gpu/drm/xe/tests/xe_bo.c
+++ b/drivers/gpu/drm/xe/tests/xe_bo.c
@@ -35,7 +35,7 @@ static int ccs_test_migrate(struct xe_gt *gt, struct xe_bo *bo,
/* Optionally clear bo *and* CCS data in VRAM. */
if (clear) {
- fence = xe_migrate_clear(gt->migrate, bo, bo->ttm.resource);
+ fence = xe_migrate_clear(gt_to_tile(gt)->migrate, bo, bo->ttm.resource);
if (IS_ERR(fence)) {
KUNIT_FAIL(test, "Failed to submit bo clear.\n");
return PTR_ERR(fence);
@@ -174,7 +174,7 @@ static int evict_test_run_gt(struct xe_device *xe, struct xe_gt *gt, struct kuni
struct xe_bo *bo, *external;
unsigned int bo_flags = XE_BO_CREATE_USER_BIT |
XE_BO_CREATE_VRAM_IF_DGFX(gt_to_tile(gt));
- struct xe_vm *vm = xe_migrate_get_vm(xe_device_get_root_tile(xe)->primary_gt.migrate);
+ struct xe_vm *vm = xe_migrate_get_vm(xe_device_get_root_tile(xe)->migrate);
struct ww_acquire_ctx ww;
int err, i;
diff --git a/drivers/gpu/drm/xe/tests/xe_migrate.c b/drivers/gpu/drm/xe/tests/xe_migrate.c
index 85ef9bacfe52..d9f1f31c92d2 100644
--- a/drivers/gpu/drm/xe/tests/xe_migrate.c
+++ b/drivers/gpu/drm/xe/tests/xe_migrate.c
@@ -101,14 +101,14 @@ static const struct xe_migrate_pt_update_ops sanity_ops = {
static void test_copy(struct xe_migrate *m, struct xe_bo *bo,
struct kunit *test)
{
- struct xe_device *xe = gt_to_xe(m->gt);
+ struct xe_device *xe = tile_to_xe(m->tile);
u64 retval, expected = 0;
bool big = bo->size >= SZ_2M;
struct dma_fence *fence;
const char *str = big ? "Copying big bo" : "Copying small bo";
int err;
- struct xe_bo *sysmem = xe_bo_create_locked(xe, gt_to_tile(m->gt), NULL,
+ struct xe_bo *sysmem = xe_bo_create_locked(xe, m->tile, NULL,
bo->size,
ttm_bo_type_kernel,
XE_BO_CREATE_SYSTEM_BIT);
@@ -189,7 +189,7 @@ out_unlock:
static void test_pt_update(struct xe_migrate *m, struct xe_bo *pt,
struct kunit *test, bool force_gpu)
{
- struct xe_device *xe = gt_to_xe(m->gt);
+ struct xe_device *xe = tile_to_xe(m->tile);
struct dma_fence *fence;
u64 retval, expected;
ktime_t then, now;
@@ -239,16 +239,15 @@ static void test_pt_update(struct xe_migrate *m, struct xe_bo *pt,
static void xe_migrate_sanity_test(struct xe_migrate *m, struct kunit *test)
{
- struct xe_gt *gt = m->gt;
- struct xe_tile *tile = gt_to_tile(m->gt);
- struct xe_device *xe = gt_to_xe(gt);
+ struct xe_tile *tile = m->tile;
+ struct xe_device *xe = tile_to_xe(tile);
struct xe_bo *pt, *bo = m->pt_bo, *big, *tiny;
struct xe_res_cursor src_it;
struct dma_fence *fence;
u64 retval, expected;
struct xe_bb *bb;
int err;
- u8 id = gt->info.id;
+ u8 id = tile->id;
err = xe_bo_vmap(bo);
if (err) {
@@ -287,7 +286,7 @@ static void xe_migrate_sanity_test(struct xe_migrate *m, struct kunit *test)
goto free_pt;
}
- bb = xe_bb_new(gt, 32, xe->info.supports_usm);
+ bb = xe_bb_new(&tile->primary_gt, 32, xe->info.supports_usm);
if (IS_ERR(bb)) {
KUNIT_FAIL(test, "Failed to create batchbuffer: %li\n",
PTR_ERR(bb));
@@ -324,7 +323,7 @@ static void xe_migrate_sanity_test(struct xe_migrate *m, struct kunit *test)
xe_map_wr(xe, &pt->vmap, 0, u32, 0xdeaddead);
expected = 0;
- emit_clear(m->gt, bb, xe_migrate_vm_addr(NUM_KERNEL_PDE - 1, 0), 4, 4,
+ emit_clear(&tile->primary_gt, bb, xe_migrate_vm_addr(NUM_KERNEL_PDE - 1, 0), 4, 4,
IS_DGFX(xe));
run_sanity_job(m, xe, bb, 1, "Writing to our newly mapped pagetable",
test);
@@ -391,14 +390,14 @@ vunmap:
static int migrate_test_run_device(struct xe_device *xe)
{
struct kunit *test = xe_cur_kunit();
- struct xe_gt *gt;
+ struct xe_tile *tile;
int id;
- for_each_gt(gt, xe, id) {
- struct xe_migrate *m = gt->migrate;
+ for_each_tile(tile, xe, id) {
+ struct xe_migrate *m = tile->migrate;
struct ww_acquire_ctx ww;
- kunit_info(test, "Testing gt id %d.\n", id);
+ kunit_info(test, "Testing tile id %d.\n", id);
xe_vm_lock(m->eng->vm, &ww, 0, true);
xe_device_mem_access_get(xe);
xe_migrate_sanity_test(m, test);