Skip to contentSkip to conversation

drm/xe/migrate: Handle clear ccs logic for xe2 dgfx

PATCH New Akshata Jahagirdar 2 participants 9 messages Jul 11, 2024 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/6 drm/xe/migrate: Handle clear ccs logic for xe2 dgfx

For Xe2 dGPU, we clear the bo by modifying the VRAM using an uncompressed pat index which then indirectly updates the compression status as uncompressed i.e zeroed CCS. So xe_migrate_clear() should be updated for BMG to not emit CCS surf copy commands.

---
 drivers/gpu/drm/xe/xe_device.h  | 5 +++++
 drivers/gpu/drm/xe/xe_migrate.c | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/xe_device.h +5 -0
index 0a2a3e7fd402..c3093506c28c 100644
@@ -144,6 +144,11 @@ static inline bool xe_device_has_flat_ccs(struct xe_device *xe)
 	return xe->info.has_flat_ccs;
 }
 
+static inline bool xe_device_needs_ccs_emit(struct xe_device *xe)
+{
+	return xe_device_has_flat_ccs(xe) && !(GRAPHICS_VER(xe) >= 20 && IS_DGFX(xe));
+}
+
 static inline bool xe_device_has_sriov(struct xe_device *xe)
 {
 	return xe->info.has_sriov;
drivers/gpu/drm/xe/xe_migrate.c +3 -3
index fa23a7e7ec43..2fc2cf375b1e 100644
@@ -420,7 +420,7 @@ struct xe_migrate *xe_migrate_init(struct xe_tile *tile)
 		return ERR_PTR(err);
 
 	if (IS_DGFX(xe)) {
-		if (xe_device_has_flat_ccs(xe))
+		if (xe_device_needs_ccs_emit(xe))
 			/* min chunk size corresponds to 4K of CCS Metadata */
 			m->min_chunk_size = SZ_4K * SZ_64K /
 				xe_device_ccs_bytes(xe, SZ_64K);
@@ -1034,7 +1034,7 @@ struct dma_fence *xe_migrate_clear(struct xe_migrate *m,
 					clear_system_ccs ? 0 : emit_clear_cmd_len(gt), 0,
 					avail_pts);
 
-		if (xe_device_has_flat_ccs(xe))
+		if (xe_device_needs_ccs_emit(xe))
 			batch_size += EMIT_COPY_CCS_DW;
 
 		/* Clear commands */
@@ -1062,7 +1062,7 @@ struct dma_fence *xe_migrate_clear(struct xe_migrate *m,
 		if (!clear_system_ccs)
 			emit_clear(gt, bb, clear_L0_ofs, clear_L0, XE_PAGE_SIZE, clear_vram);
 
-		if (xe_device_has_flat_ccs(xe)) {
+		if (xe_device_needs_ccs_emit(xe)) {
 			emit_copy_ccs(gt, bb, clear_L0_ofs, true,
 				      m->cleared_mem_ofs, false, clear_L0);
 			flush_flags = MI_FLUSH_DW_CCS;
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/6 drm/xe/migrate: Add kunit to test clear functionality

In reply to a message not in the archive

This test verifies if the main and ccs data are cleared during bo creation. The motivation to use Kunit instead of IGT is that, although we can verify whether the data is zero following bo creation,
we cannot confirm whether the zero value after bo creation is the result of our clear function or simply because the initial data present there was zero.

---
 drivers/gpu/drm/xe/tests/xe_migrate.c      | 271 +++++++++++++++++++++
 drivers/gpu/drm/xe/tests/xe_migrate_test.c |   1 +
 drivers/gpu/drm/xe/tests/xe_migrate_test.h |   1 +
 3 files changed, 273 insertions(+)
drivers/gpu/drm/xe/tests/xe_migrate.c +271 -0
index 962f6438e219..8e31270f11d1 100644
@@ -359,3 +359,274 @@ void xe_migrate_sanity_kunit(struct kunit *test)
 	xe_call_for_each_device(migrate_test_run_device);
 }
 EXPORT_SYMBOL_IF_KUNIT(xe_migrate_sanity_kunit);
+
+static struct dma_fence *blt_copy(struct xe_tile *tile,
+				struct xe_bo *src_bo, struct xe_bo *dst_bo,
+				bool copy_only_ccs, const char *str, struct kunit *test)
+{
+	struct xe_gt *gt = tile->primary_gt;
+	struct xe_migrate *m = tile->migrate;
+	struct xe_device *xe = gt_to_xe(gt);
+	struct dma_fence *fence = NULL;
+	u64 size = src_bo->size;
+	struct xe_res_cursor src_it, dst_it;
+	struct ttm_resource *src = src_bo->ttm.resource, *dst = dst_bo->ttm.resource;
+	u64 src_L0_ofs, dst_L0_ofs;
+	u32 src_L0_pt, dst_L0_pt;
+	u64 src_L0, dst_L0;
+	int err;
+	bool src_is_vram = mem_type_is_vram(src->mem_type);
+	bool dst_is_vram = mem_type_is_vram(dst->mem_type);
+
+	if (!src_is_vram)
+		xe_res_first_sg(xe_bo_sg(src_bo), 0, size, &src_it);
+	else
+		xe_res_first(src, 0, size, &src_it);
+
+	if (!dst_is_vram)
+		xe_res_first_sg(xe_bo_sg(dst_bo), 0, size, &dst_it);
+	else
+		xe_res_first(dst, 0, size, &dst_it);
+
+	while (size) {
+		u32 batch_size = 2; /* arb_clear() + MI_BATCH_BUFFER_END */
+		struct xe_sched_job *job;
+		struct xe_bb *bb;
+		u32 flush_flags = 0;
+		u32 update_idx;
+		u32 avail_pts = max_mem_transfer_per_pass(xe) / LEVEL0_PAGE_TABLE_ENCODE_SIZE;
+
+		src_L0 = xe_migrate_res_sizes(m, &src_it);
+		dst_L0 = xe_migrate_res_sizes(m, &dst_it);
+
+		src_L0 = min(src_L0, dst_L0);
+
+		batch_size += pte_update_size(m, src_is_vram, src_is_vram, src, &src_it, &src_L0,
+					      &src_L0_ofs, &src_L0_pt, 0, 0,
+					      avail_pts);
+
+		batch_size += pte_update_size(m, dst_is_vram, dst_is_vram, dst, &dst_it, &src_L0,
+					      &dst_L0_ofs, &dst_L0_pt, 0,
+					      avail_pts, avail_pts);
+
+		/* Add copy commands size here */
+		batch_size += ((copy_only_ccs) ? 0 : EMIT_COPY_DW) +
+			((xe_device_has_flat_ccs(xe) && copy_only_ccs) ? EMIT_COPY_CCS_DW : 0);
+
+		bb = xe_bb_new(gt, batch_size, xe->info.has_usm);
+		if (IS_ERR(bb)) {
+			err = PTR_ERR(bb);
+			goto err_sync;
+		}
+
+		if (src_is_vram)
+			xe_res_next(&src_it, src_L0);
+		else
+			emit_pte(m, bb, src_L0_pt, src_is_vram, false,
+				 &src_it, src_L0, src);
+
+		if (dst_is_vram)
+			xe_res_next(&dst_it, src_L0);
+		else
+			emit_pte(m, bb, dst_L0_pt, dst_is_vram, false,
+				 &dst_it, src_L0, dst);
+
+		bb->cs[bb->len++] = MI_BATCH_BUFFER_END;
+		update_idx = bb->len;
+		if (!copy_only_ccs)
+			emit_copy(gt, bb, src_L0_ofs, dst_L0_ofs, src_L0, XE_PAGE_SIZE);
+
+		if (copy_only_ccs)
+			flush_flags = xe_migrate_ccs_copy(m, bb, src_L0_ofs,
+					src_is_vram, dst_L0_ofs,
+					dst_is_vram, src_L0, dst_L0_ofs, copy_only_ccs);
+
+		mutex_lock(&m->job_mutex);
+
+		job = xe_bb_create_migration_job(m->q, bb,
+						 xe_migrate_batch_base(m, xe->info.has_usm),
+						 update_idx);
+		if (IS_ERR(job)) {
+			err = PTR_ERR(job);
+			goto err;
+		}
+
+		xe_sched_job_add_migrate_flush(job, flush_flags);
+
+		xe_sched_job_arm(job);
+		dma_fence_put(fence);
+		fence = dma_fence_get(&job->drm.s_fence->finished);
+		xe_sched_job_push(job);
+
+		dma_fence_put(m->fence);
+		m->fence = dma_fence_get(fence);
+
+		mutex_unlock(&m->job_mutex);
+
+		xe_bb_free(bb, fence);
+		size -= src_L0;
+		continue;
+
+err:
+		mutex_unlock(&m->job_mutex);
+		xe_bb_free(bb, NULL);
+
+err_sync:
+		if (fence) {
+			dma_fence_wait(fence, false);
+			dma_fence_put(fence);
+		}
+		return ERR_PTR(err);
+	}
+
+	return fence;
+}
+
+static void test_clear(struct xe_device *xe, struct xe_tile *tile,
+			struct xe_bo *sys_bo, struct xe_bo *vram_bo, struct kunit *test)
+{
+	struct dma_fence *fence;
+	u64 expected, retval;
+
+	expected = 0xd0d0d0d0d0d0d0d0;
+	xe_map_memset(xe, &sys_bo->vmap, 0, 0xd0, sys_bo->size);
+
+	fence = blt_copy(tile, sys_bo, vram_bo, false, "Blit copy from sysmem to vram", test);
+	if (!sanity_fence_failed(xe, fence, "Blit copy from sysmem to vram", test)) {
+		retval = xe_map_rd(xe, &vram_bo->vmap, 0, u64);
+		if (retval == expected)
+			KUNIT_FAIL(test, "Sanity check failed: VRAM must have compressed value\n");
+	}
+	dma_fence_put(fence);
+
+	fence = blt_copy(tile, vram_bo, sys_bo, false, "Blit copy from vram to sysmem", test);
+	if (!sanity_fence_failed(xe, fence, "Blit copy from vram to sysmem", test)) {
+		retval = xe_map_rd(xe, &sys_bo->vmap, 0, u64);
+		check(retval, expected, "Decompressed value must be equal to initial value", test);
+		retval = xe_map_rd(xe, &sys_bo->vmap, sys_bo->size - 8, u64);
+		check(retval, expected, "Decompressed value must be equal to initial value", test);
+	}
+	dma_fence_put(fence);
+
+	kunit_info(test, "Clear vram buffer object\n");
+	expected = 0x0000000000000000;
+	fence = xe_migrate_clear(tile->migrate, vram_bo, vram_bo->ttm.resource);
+
+	fence = blt_copy(tile, vram_bo, sys_bo,
+				false, "Blit copy from vram to sysmem", test);
+	if (!sanity_fence_failed(xe, fence, "Clear main buffer data", test)) {
+		retval = xe_map_rd(xe, &sys_bo->vmap, 0, u64);
+		check(retval, expected, "Clear main buffer first value", test);
+		retval = xe_map_rd(xe, &sys_bo->vmap, sys_bo->size - 8, u64);
+		check(retval, expected, "Clear main buffer last value", test);
+	}
+	dma_fence_put(fence);
+
+	fence = blt_copy(tile, vram_bo, sys_bo,
+			true, "Blit surf copy from vram to sysmem", test);
+	if (!sanity_fence_failed(xe, fence, "Clear ccs buffer data", test)) {
+		retval = xe_map_rd(xe, &sys_bo->vmap, 0, u64);
+		check(retval, expected, "Clear ccs data first value", test);
+		retval = xe_map_rd(xe, &sys_bo->vmap, sys_bo->size - 8, u64);
+		check(retval, expected, "Clear ccs data last value", test);
+	}
+	dma_fence_put(fence);
+}
+
+static void validate_ccs_test_run_tile(struct xe_device *xe, struct xe_tile *tile, struct kunit *test)
+{
+	struct xe_bo *sys_bo, *vram_bo;
+	unsigned int bo_flags = XE_BO_CREATE_VRAM_IF_DGFX(tile);
+	int ret;
+
+	sys_bo = xe_bo_create_user(xe, NULL, NULL, SZ_4M, DRM_XE_GEM_CPU_CACHING_WC,
+			ttm_bo_type_device, XE_BO_CREATE_SYSTEM_BIT | XE_BO_NEEDS_CPU_ACCESS);
+
+	if (IS_ERR(sys_bo)) {
+		KUNIT_FAIL(test, "xe_bo_create() failed with err=%ld\n",
+			   PTR_ERR(sys_bo));
+		return;
+	}
+
+	xe_bo_lock(sys_bo, false);
+	ret = xe_bo_validate(sys_bo, NULL, false);
+	if (ret) {
+		KUNIT_FAIL(test, "Failed to validate system bo for: %li\n", ret);
+		goto out_unlock;
+	}
+
+	ret = xe_bo_vmap(sys_bo);
+	if (ret) {
+		KUNIT_FAIL(test, "Failed to vmap system bo: %li\n", ret);
+		goto out_unlock;
+	}
+	xe_bo_unlock(sys_bo);
+
+	vram_bo = xe_bo_create_user(xe, NULL, NULL, SZ_4M, DRM_XE_GEM_CPU_CACHING_WC,
+			       ttm_bo_type_device, bo_flags | XE_BO_NEEDS_CPU_ACCESS);
+	if (IS_ERR(vram_bo)) {
+		KUNIT_FAIL(test, "xe_bo_create() failed with err=%ld\n",
+			   PTR_ERR(vram_bo));
+		return;
+	}
+
+	xe_bo_lock(vram_bo, false);
+	ret = xe_bo_validate(vram_bo, NULL, false);
+	if (ret) {
+		KUNIT_FAIL(test, "Failed to validate vram bo for: %li\n", ret);
+		goto out_unlock;
+	}
+
+	ret = xe_bo_vmap(vram_bo);
+	if (ret) {
+		KUNIT_FAIL(test, "Failed to vmap vram bo: %li\n", ret);
+		goto out_unlock;
+	}
+
+	test_clear(xe, tile, sys_bo, vram_bo, test);
+	xe_bo_unlock(vram_bo);
+
+	xe_bo_lock(vram_bo, false);
+	xe_bo_vunmap(vram_bo);
+	xe_bo_unlock(vram_bo);
+
+	xe_bo_lock(sys_bo, false);
+	xe_bo_vunmap(sys_bo);
+	xe_bo_unlock(sys_bo);
+out_unlock:
+	xe_bo_put(vram_bo);
+	xe_bo_put(sys_bo);
+}
+
+static int validate_ccs_test_run_device(struct xe_device *xe)
+{
+	struct kunit *test = xe_cur_kunit();
+	struct xe_tile *tile;
+	int id;
+
+	if (!xe_device_has_flat_ccs(xe)) {
+		kunit_info(test, "Skipping non-flat-ccs device.\n");
+		return 0;
+	}
+
+	if (!(GRAPHICS_VER(xe) >= 20 && IS_DGFX(xe))) {
+		kunit_info(test, "Skipping non-xe2 discrete device %s.\n",
+			   dev_name(xe->drm.dev));
+		return 0;
+	}
+
+	xe_device_mem_access_get(xe);
+
+	for_each_tile(tile, xe, id)
+		validate_ccs_test_run_tile(xe, tile, test);
+
+	xe_device_mem_access_put(xe);
+
+	return 0;
+}
+
+void xe_validate_ccs_kunit(struct kunit *test)
+{
+	xe_call_for_each_device(validate_ccs_test_run_device);
+}
+EXPORT_SYMBOL_IF_KUNIT(xe_validate_ccs_kunit);
drivers/gpu/drm/xe/tests/xe_migrate_test.c +1 -0
index eb0d8963419c..49b9ef060ad3 100644
@@ -9,6 +9,7 @@
 
 static struct kunit_case xe_migrate_tests[] = {
 	KUNIT_CASE(xe_migrate_sanity_kunit),
+	KUNIT_CASE(xe_validate_ccs_kunit),
 	{}
 };
 
drivers/gpu/drm/xe/tests/xe_migrate_test.h +1 -0
index 7c645c66824f..dc0ecfdfad39 100644
@@ -9,5 +9,6 @@
 struct kunit;
 
 void xe_migrate_sanity_kunit(struct kunit *test);
+void xe_validate_ccs_kunit(struct kunit *test);
 
 #endif
Signature · 1 line
2.34.1
#3 lore raw

PATCH 3/6 drm/xe/xe2: Introduce identity map for compressed pat for vram

In reply to a message not in the archive

Xe2+ has unified compression (exactly one compression mode/format), where compression is now controlled via PAT at PTE level. This simplifies KMD operations, as it can now decompress freely without concern for the buffer's original compression format—unlike DG2, which had multiple compression formats and thus required copying the raw CCS state during VRAM eviction. In addition mixed VRAM and system memory buffers were not supported with compression enabled.

On Xe2 dGPU compression is still only supported with VRAM, however we can now support compression with VRAM and system memory buffers, with GPU access being seamless underneath. So long as when doing VRAM -> system memory the KMD uses compressed -> uncompressed, to decompress it. This also allows CPU access to such buffers, assuming that userspace first decompress the corresponding pages being accessed.
If the pages are already in system memory then KMD would have already decompressed them. When restoring such buffers with sysmem -> VRAM the KMD can't easily know which pages were originally compressed, so we always use uncompressed -> uncompressed here.
With this it also means we can drop all the raw CCS handling on such platforms (including needing to allocate extra CCS storage).

In order to support this we now need to have two different identity
mappings for compressed and uncompressed VRAM.
In this patch, we set up the additional identity map for the VRAM with
compressed pat_index. We then select the appropriate mapping during migration/clear.During eviction (vram->sysmem), we use the mapping from compressed -> uncompressed. During restore (sysmem->vram), we need the mapping from uncompressed -> uncompressed. Therefore, we need to have two different mappings for compressed and uncompressed vram. We set up an additional identity map for the vram with compressed
pat_index. We then select the appropriate mapping during migration/clear.

---
 drivers/gpu/drm/xe/xe_migrate.c | 55 +++++++++++++++++++++++++--------
 1 file changed, 42 insertions(+), 13 deletions(-)
drivers/gpu/drm/xe/xe_migrate.c +42 -13
index 2fc2cf375b1e..a3d6d3113ac2 100644
@@ -120,14 +120,20 @@ static u64 xe_migrate_vm_addr(u64 slot, u32 level)
 	return (slot + 1ULL) << xe_pt_shift(level + 1);
 }
 
-static u64 xe_migrate_vram_ofs(struct xe_device *xe, u64 addr)
+static u64 xe_migrate_vram_ofs(struct xe_device *xe, u64 addr, bool is_comp_pte)
 {
 	/*
 	 * Remove the DPA to get a correct offset into identity table for the
 	 * migrate offset
 	 */
+	u64 identity_offset = 256ULL;
+
+	if (GRAPHICS_VER(xe) >= 20 && is_comp_pte)
+		identity_offset = 256ULL +
+				  DIV_ROUND_UP_ULL(xe->mem.vram.actual_physical_size, SZ_1G);
+
 	addr -= xe->mem.vram.dpa_base;
-	return addr + (256ULL << xe_pt_shift(2));
+	return addr + (identity_offset << xe_pt_shift(2));
 }
 
 static int xe_migrate_prepare_vm(struct xe_tile *tile, struct xe_migrate *m,
@@ -214,12 +220,12 @@ static int xe_migrate_prepare_vm(struct xe_tile *tile, struct xe_migrate *m,
 	} else {
 		u64 batch_addr = xe_bo_addr(batch, 0, XE_PAGE_SIZE);
 
-		m->batch_base_ofs = xe_migrate_vram_ofs(xe, batch_addr);
+		m->batch_base_ofs = xe_migrate_vram_ofs(xe, batch_addr, false);
 
 		if (xe->info.has_usm) {
 			batch = tile->primary_gt->usm.bb_pool->bo;
 			batch_addr = xe_bo_addr(batch, 0, XE_PAGE_SIZE);
-			m->usm_batch_base_ofs = xe_migrate_vram_ofs(xe, batch_addr);
+			m->usm_batch_base_ofs = xe_migrate_vram_ofs(xe, batch_addr, false);
 		}
 	}
 
@@ -251,7 +257,7 @@ static int xe_migrate_prepare_vm(struct xe_tile *tile, struct xe_migrate *m,
 		  | XE_PTE_NULL);
 	m->cleared_mem_ofs = (255ULL << xe_pt_shift(level));
 
-	/* Identity map the entire vram at 256GiB offset */
+	/* Identity map the entire vram for uncompressed pat_index at 256GiB offset */
 	if (IS_DGFX(xe)) {
 		u64 pos, ofs, flags;
 		/* XXX: Unclear if this should be usable_size? */
@@ -294,6 +300,30 @@ static int xe_migrate_prepare_vm(struct xe_tile *tile, struct xe_migrate *m,
 		}
 
 		xe_assert(xe, pos == vram_limit);
+
+		/*
+		 * Identity map the entire vram for compressed pat_index for xe2+
+		 * if flat ccs is enabled.
+		 */
+		if (GRAPHICS_VER(xe) >= 20 && xe_device_has_flat_ccs(xe)) {
+			u16 comp_pat_index = xe->pat.idx[XE_CACHE_NONE_COMPRESSION];
+			u64 vram_offset = 256 +
+				DIV_ROUND_UP_ULL(xe->mem.vram.actual_physical_size, SZ_1G);
+
+			level = 2;
+			ofs = map_ofs + XE_PAGE_SIZE * level + vram_offset * 8;
+			flags = vm->pt_ops->pte_encode_addr(xe, 0, comp_pat_index, level,
+								true, 0);
+
+			/*
+			 * Use 1GB pages, it shouldn't matter the physical amount of
+			 * vram is less, when we don't access it.
+			 */
+			for (pos = xe->mem.vram.dpa_base;
+				 pos < xe->mem.vram.actual_physical_size + xe->mem.vram.dpa_base;
+				 pos += SZ_1G, ofs += 8)
+				xe_map_wr(xe, &bo->vmap, ofs, u64, pos | flags);
+		}
 	}
 
 	/*
@@ -475,7 +505,7 @@ static bool xe_migrate_allow_identity(u64 size, const struct xe_res_cursor *cur)
 }
 
 static u32 pte_update_size(struct xe_migrate *m,
-			   bool is_vram,
+			   bool is_vram, bool is_comp_pte,
 			   struct ttm_resource *res,
 			   struct xe_res_cursor *cur,
 			   u64 *L0, u64 *L0_ofs, u32 *L0_pt,
@@ -487,7 +517,7 @@ static u32 pte_update_size(struct xe_migrate *m,
 	if (is_vram && xe_migrate_allow_identity(*L0, cur)) {
 		/* Offset into identity map. */
 		*L0_ofs = xe_migrate_vram_ofs(tile_to_xe(m->tile),
-					      cur->start + vram_region_gpu_offset(res));
+					      cur->start + vram_region_gpu_offset(res), is_comp_pte);
 		cmds += cmd_size;
 	} else {
 		/* Clip L0 to available size */
@@ -778,17 +808,17 @@ struct dma_fence *xe_migrate_copy(struct xe_migrate *m,
 
 		src_L0 = min(src_L0, dst_L0);
 
-		batch_size += pte_update_size(m, src_is_vram, src, &src_it, &src_L0,
+		batch_size += pte_update_size(m, src_is_vram, false, src, &src_it, &src_L0,
 					      &src_L0_ofs, &src_L0_pt, 0, 0,
 					      avail_pts);
 
-		batch_size += pte_update_size(m, dst_is_vram, dst, &dst_it, &src_L0,
+		batch_size += pte_update_size(m, dst_is_vram, false, dst, &dst_it, &src_L0,
 					      &dst_L0_ofs, &dst_L0_pt, 0,
 					      avail_pts, avail_pts);
 
 		if (copy_system_ccs) {
 			ccs_size = xe_device_ccs_bytes(xe, src_L0);
-			batch_size += pte_update_size(m, false, NULL, &ccs_it, &ccs_size,
+			batch_size += pte_update_size(m, false, false, NULL, &ccs_it, &ccs_size,
 						      &ccs_ofs, &ccs_pt, 0,
 						      2 * avail_pts,
 						      avail_pts);
@@ -1029,14 +1059,13 @@ struct dma_fence *xe_migrate_clear(struct xe_migrate *m,
 
 		/* Calculate final sizes and batch size.. */
 		batch_size = 2 +
-			pte_update_size(m, clear_vram, src, &src_it,
+			pte_update_size(m, clear_vram, false, src, &src_it,
 					&clear_L0, &clear_L0_ofs, &clear_L0_pt,
 					clear_system_ccs ? 0 : emit_clear_cmd_len(gt), 0,
 					avail_pts);
 
 		if (xe_device_needs_ccs_emit(xe))
 			batch_size += EMIT_COPY_CCS_DW;
-
 		/* Clear commands */
 
 		if (WARN_ON_ONCE(!clear_L0))
@@ -1146,7 +1175,7 @@ static void write_pgtable(struct xe_tile *tile, struct xe_bb *bb, u64 ppgtt_ofs,
 	if (!ppgtt_ofs)
 		ppgtt_ofs = xe_migrate_vram_ofs(tile_to_xe(tile),
 						xe_bo_addr(update->pt_bo, 0,
-							   XE_PAGE_SIZE));
+							   XE_PAGE_SIZE), false);
 
 	do {
 		u64 addr = ppgtt_ofs + ofs * 8;
Signature · 1 line
2.34.1
#4 lore raw

PATCH 4/6 drm/xe/xe_migrate: Handle migration logic for xe2+ dgfx

In reply to a message not in the archive

During eviction (vram->sysmem), we use the mapping from compressed -> uncompressed. During restore (sysmem->vram), we need the mapping from uncompressed -> uncompressed. Handle logic for selecting the compressed identity map for eviction, and selecting uncompressed map for restore operations.

---
 drivers/gpu/drm/xe/xe_migrate.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/xe_migrate.c +4 -3
index a3d6d3113ac2..96f747cd949d 100644
@@ -690,7 +690,7 @@ static u32 xe_migrate_ccs_copy(struct xe_migrate *m,
 	struct xe_gt *gt = m->tile->primary_gt;
 	u32 flush_flags = 0;
 
-	if (xe_device_has_flat_ccs(gt_to_xe(gt)) && !copy_ccs && dst_is_indirect) {
+	if (xe_device_needs_ccs_emit(gt_to_xe(gt)) && !copy_ccs && dst_is_indirect) {
 		/*
 		 * If the src is already in vram, then it should already
 		 * have been cleared by us, or has been populated by the
@@ -766,6 +766,7 @@ struct dma_fence *xe_migrate_copy(struct xe_migrate *m,
 	bool copy_ccs = xe_device_has_flat_ccs(xe) &&
 		xe_bo_needs_ccs_pages(src_bo) && xe_bo_needs_ccs_pages(dst_bo);
 	bool copy_system_ccs = copy_ccs && (!src_is_vram || !dst_is_vram);
+	bool use_comp_pat = GRAPHICS_VER(xe) >= 20 && IS_DGFX(xe) && src_is_vram && !dst_is_vram;
 
 	/* Copying CCS between two different BOs is not supported yet. */
 	if (XE_WARN_ON(copy_ccs && src_bo != dst_bo))
@@ -808,7 +809,7 @@ struct dma_fence *xe_migrate_copy(struct xe_migrate *m,
 
 		src_L0 = min(src_L0, dst_L0);
 
-		batch_size += pte_update_size(m, src_is_vram, false, src, &src_it, &src_L0,
+		batch_size += pte_update_size(m, src_is_vram, use_comp_pat, src, &src_it, &src_L0,
 					      &src_L0_ofs, &src_L0_pt, 0, 0,
 					      avail_pts);
 
@@ -827,7 +828,7 @@ struct dma_fence *xe_migrate_copy(struct xe_migrate *m,
 
 		/* Add copy commands size here */
 		batch_size += ((copy_only_ccs) ? 0 : EMIT_COPY_DW) +
-			((xe_device_has_flat_ccs(xe) ? EMIT_COPY_CCS_DW : 0));
+			((xe_device_needs_ccs_emit(xe) ? EMIT_COPY_CCS_DW : 0));
 
 		bb = xe_bb_new(gt, batch_size, usm);
 		if (IS_ERR(bb)) {
Signature · 1 line
2.34.1
#5 lore raw

PATCH 5/6 drm/xe/migrate: Add kunit to test migration functionality for BMG

In reply to a message not in the archive

This part of kunit verifies that
- main data is decompressed and ccs data is clear post bo eviction.
- main data is raw copied and ccs data is clear post bo restore.

---
 drivers/gpu/drm/xe/tests/xe_migrate.c | 123 +++++++++++++++++++++++++-
 1 file changed, 120 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/tests/xe_migrate.c +120 -3
index 8e31270f11d1..f487998649c9 100644
@@ -361,8 +361,8 @@ void xe_migrate_sanity_kunit(struct kunit *test)
 EXPORT_SYMBOL_IF_KUNIT(xe_migrate_sanity_kunit);
 
 static struct dma_fence *blt_copy(struct xe_tile *tile,
-				struct xe_bo *src_bo, struct xe_bo *dst_bo,
-				bool copy_only_ccs, const char *str, struct kunit *test)
+				 struct xe_bo *src_bo, struct xe_bo *dst_bo,
+				 bool copy_only_ccs, const char *str, struct kunit *test)
 {
 	struct xe_gt *gt = tile->primary_gt;
 	struct xe_migrate *m = tile->migrate;
@@ -482,6 +482,94 @@ static struct dma_fence *blt_copy(struct xe_tile *tile,
 	return fence;
 }
 
+static void test_migrate(struct xe_device *xe, struct xe_tile *tile,
+			struct xe_bo *sys_bo, struct xe_bo *vram_bo, struct xe_bo *ccs_bo,
+			struct kunit *test)
+{
+	struct dma_fence *fence;
+	u64 expected, retval;
+	long timeout;
+	int ret;
+
+	expected = 0xd0d0d0d0d0d0d0d0;
+	xe_map_memset(xe, &sys_bo->vmap, 0, 0xd0, sys_bo->size);
+
+	fence = blt_copy(tile, sys_bo, vram_bo, false, "Blit copy from sysmem to vram", test);
+	if (!sanity_fence_failed(xe, fence, "Blit copy from sysmem to vram", test)) {
+		retval = xe_map_rd(xe, &vram_bo->vmap, 0, u64);
+		if (retval == expected)
+			KUNIT_FAIL(test, "Sanity check failed: VRAM must have compressed value\n");
+	}
+	dma_fence_put(fence);
+
+	kunit_info(test, "Evict vram buffer object\n");
+	ret = xe_bo_evict(vram_bo, true);
+	if (ret) {
+		KUNIT_FAIL(test, "Failed to evict bo.\n");
+		return;
+	}
+
+	ret = xe_bo_vmap(vram_bo);
+	if (ret) {
+		KUNIT_FAIL(test, "Failed to vmap vram bo: %li\n", ret);
+		return;
+	}
+
+	retval = xe_map_rd(xe, &vram_bo->vmap, 0, u64);
+	check(retval, expected, "Clear evicted vram data first value", test);
+	retval = xe_map_rd(xe, &vram_bo->vmap, vram_bo->size - 8, u64);
+	check(retval, expected, "Clear evicted vram data last value", test);
+
+	fence = blt_copy(tile, vram_bo, ccs_bo,
+			true, "Blit surf copy from vram to sysmem", test);
+	if (!sanity_fence_failed(xe, fence, "Clear ccs buffer data", test)) {
+		retval = xe_map_rd(xe, &ccs_bo->vmap, 0, u64);
+		check(retval, 0, "Clear ccs data first value", test);
+
+		retval = xe_map_rd(xe, &ccs_bo->vmap, ccs_bo->size - 8, u64);
+		check(retval, 0, "Clear ccs data last value", test);
+	}
+	dma_fence_put(fence);
+
+	kunit_info(test, "Restore vram buffer object\n");
+	ret = xe_bo_validate(vram_bo, NULL, false);
+	if (ret) {
+		KUNIT_FAIL(test, "Failed to validate vram bo for: %li\n", ret);
+		return;
+	}
+
+	/* Sync all migration blits */
+	timeout = dma_resv_wait_timeout(vram_bo->ttm.base.resv,
+					DMA_RESV_USAGE_KERNEL,
+					true,
+					5 * HZ);
+	if (timeout <= 0) {
+		KUNIT_FAIL(test, "Failed to sync bo eviction.\n");
+		return;
+	}
+
+	ret = xe_bo_vmap(vram_bo);
+	if (ret) {
+		KUNIT_FAIL(test, "Failed to vmap vram bo: %li\n", ret);
+		return;
+	}
+
+	retval = xe_map_rd(xe, &vram_bo->vmap, 0, u64);
+	check(retval, expected, "Restored value must be equal to initial value", test);
+	retval = xe_map_rd(xe, &vram_bo->vmap, vram_bo->size - 8, u64);
+	check(retval, expected, "Restored value must be equal to initial value", test);
+
+	fence = blt_copy(tile, vram_bo, ccs_bo,
+			true, "Blit surf copy from vram to sysmem", test);
+	if (!sanity_fence_failed(xe, fence, "Clear ccs buffer data", test)) {
+		retval = xe_map_rd(xe, &ccs_bo->vmap, 0, u64);
+		check(retval, 0, "Clear ccs data first value", test);
+		retval = xe_map_rd(xe, &ccs_bo->vmap, ccs_bo->size - 8, u64);
+		check(retval, 0, "Clear ccs data last value", test);
+	}
+	dma_fence_put(fence);
+}
+
 static void test_clear(struct xe_device *xe, struct xe_tile *tile,
 			struct xe_bo *sys_bo, struct xe_bo *vram_bo, struct kunit *test)
 {
@@ -535,7 +623,7 @@ static void test_clear(struct xe_device *xe, struct xe_tile *tile,
 
 static void validate_ccs_test_run_tile(struct xe_device *xe, struct xe_tile *tile, struct kunit *test)
 {
-	struct xe_bo *sys_bo, *vram_bo;
+	struct xe_bo *sys_bo, *vram_bo, *ccs_bo;
 	unsigned int bo_flags = XE_BO_CREATE_VRAM_IF_DGFX(tile);
 	int ret;
 
@@ -562,6 +650,29 @@ static void validate_ccs_test_run_tile(struct xe_device *xe, struct xe_tile *til
 	}
 	xe_bo_unlock(sys_bo);
 
+	ccs_bo = xe_bo_create_user(xe, NULL, NULL, SZ_4M, DRM_XE_GEM_CPU_CACHING_WC,
+				  ttm_bo_type_device, bo_flags | XE_BO_NEEDS_CPU_ACCESS);
+
+	if (IS_ERR(ccs_bo)) {
+		KUNIT_FAIL(test, "xe_bo_create() failed with err=%ld\n",
+			   PTR_ERR(ccs_bo));
+		return;
+	}
+
+	xe_bo_lock(ccs_bo, false);
+	ret = xe_bo_validate(ccs_bo, NULL, false);
+	if (ret) {
+		KUNIT_FAIL(test, "Failed to validate system bo for: %li\n", ret);
+		goto out_unlock;
+	}
+
+	ret = xe_bo_vmap(ccs_bo);
+	if (ret) {
+		KUNIT_FAIL(test, "Failed to vmap system bo: %li\n", ret);
+		goto out_unlock;
+	}
+	xe_bo_unlock(ccs_bo);
+
 	vram_bo = xe_bo_create_user(xe, NULL, NULL, SZ_4M, DRM_XE_GEM_CPU_CACHING_WC,
 			       ttm_bo_type_device, bo_flags | XE_BO_NEEDS_CPU_ACCESS);
 	if (IS_ERR(vram_bo)) {
@@ -584,17 +695,23 @@ static void validate_ccs_test_run_tile(struct xe_device *xe, struct xe_tile *til
 	}
 
 	test_clear(xe, tile, sys_bo, vram_bo, test);
+	test_migrate(xe, tile, sys_bo, vram_bo, ccs_bo, test);
 	xe_bo_unlock(vram_bo);
 
 	xe_bo_lock(vram_bo, false);
 	xe_bo_vunmap(vram_bo);
 	xe_bo_unlock(vram_bo);
 
+	xe_bo_lock(ccs_bo, false);
+	xe_bo_vunmap(ccs_bo);
+	xe_bo_unlock(ccs_bo);
+
 	xe_bo_lock(sys_bo, false);
 	xe_bo_vunmap(sys_bo);
 	xe_bo_unlock(sys_bo);
 out_unlock:
 	xe_bo_put(vram_bo);
+	xe_bo_put(ccs_bo);
 	xe_bo_put(sys_bo);
 }
 
Signature · 1 line
2.34.1
#6 lore raw

PATCH 6/6 drm/xe/xe2: Do not run xe_bo_test for xe2+ dgfx

In reply to a message not in the archive

In xe2+ dgfx, we don't need to handle the copying of ccs metadata during migration. This test validates the ccs data post clear and copy during evict/restore operation. Thus, we can skip this test on xe2+ dgfx.

---
 drivers/gpu/drm/xe/tests/xe_bo.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/xe/tests/xe_bo.c +6 -0
index 9f3c02826464..f7ef91b9a5d2 100644
@@ -163,6 +163,12 @@ static int ccs_test_run_device(struct xe_device *xe)
 		return 0;
 	}
 
+	/* For xe2+ dgfx, we don't handle ccs metadata */
+	if (GRAPHICS_VER(xe) >= 20 && IS_DGFX(xe)) {
+		kunit_info(test, "Skipping on xe2+ dgfx device.\n");
+		return 0;
+	}
+
 	xe_pm_runtime_get(xe);
 
 	for_each_tile(tile, xe, id) {
Signature · 1 line
2.34.1
#7 lore raw

✓ CI.Patch_applied: success for series starting with [1/6] drm/xe/migrate: Handle clear ccs logic for xe2 dgfx

In reply to a message not in the archive
== Series Details ==

== Series Details ==

Series: series starting with [1/6] drm/xe/migrate: Handle clear ccs logic for xe2 dgfx
URL : https://patchwork.freedesktop.org/series/135977/
State : success

== Summary ==

=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: 36e90f69c967 drm-tip: 2024y-07m-10d-21h-00m-19s UTC integration manifest === git am output follows ===
Applying: drm/xe/migrate: Handle clear ccs logic for xe2 dgfx
Applying: drm/xe/migrate: Add kunit to test clear functionality
Applying: drm/xe/xe2: Introduce identity map for compressed pat for vram
Applying: drm/xe/xe_migrate: Handle migration logic for xe2+ dgfx
Applying: drm/xe/migrate: Add kunit to test migration functionality for BMG
Applying: drm/xe/xe2: Do not run xe_bo_test for xe2+ dgfx

#8 lore raw

✗ CI.checkpatch: warning for series starting with [1/6] drm/xe/migrate: Handle clear ccs logic for xe2 dgfx

In reply to a message not in the archive
== Series Details ==

== Series Details ==

Series: series starting with [1/6] drm/xe/migrate: Handle clear ccs logic for xe2 dgfx
URL : https://patchwork.freedesktop.org/series/135977/
State : warning

== Summary ==

+ KERNEL=/kernel
+ git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt Cloning into 'mt'...
warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/
+ git -C mt rev-list -n1 origin/master 51ce9f6cd981d42d7467409d7dbc559a450abc1e
+ cd /kernel
+ git config --global --add safe.directory /kernel
+ git log -n1
commit 87da61e4a9c6a21e5cd3dd7511c10d687183fa7f

Author: Akshata Jahagirdar <[email protected]>
Date:   Thu Jul 11 05:55:05 2024 +0000

drm/xe/xe2: Do not run xe_bo_test for xe2+ dgfx

In xe2+ dgfx, we don't need to handle the copying of ccs metadata during migration. This test validates the ccs data post clear and copy during evict/restore operation. Thus, we can skip this test on xe2+ dgfx.

+ /mt/dim checkpatch 36e90f69c967f4cbcdd02c40c9ef25694ffb1a13 drm-intel
07434ba821fb drm/xe/migrate: Handle clear ccs logic for xe2 dgfx
1c8ccb77d291 drm/xe/migrate: Add kunit to test clear functionality
-:10: WARNING:COMMIT_LOG_LONG_LINE: Prefer a maximum 75 chars per line (possible unwrapped commit description?) #10:
our clear function or simply because the initial data present there was zero.

-:24: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #24: FILE: drivers/gpu/drm/xe/tests/xe_migrate.c:364:
+static struct dma_fence *blt_copy(struct xe_tile *tile,
+ struct xe_bo *src_bo, struct xe_bo *dst_bo,

-:101: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #101: FILE: drivers/gpu/drm/xe/tests/xe_migrate.c:441:
+ flush_flags = xe_migrate_ccs_copy(m, bb, src_L0_ofs,
+ src_is_vram, dst_L0_ofs,

-:146: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #146: FILE: drivers/gpu/drm/xe/tests/xe_migrate.c:486:
+static void test_clear(struct xe_device *xe, struct xe_tile *tile,
+ struct xe_bo *sys_bo, struct xe_bo *vram_bo, struct kunit *test)

-:176: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #176: FILE: drivers/gpu/drm/xe/tests/xe_migrate.c:516:
+ fence = blt_copy(tile, vram_bo, sys_bo,
+ false, "Blit copy from vram to sysmem", test);

-:186: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #186: FILE: drivers/gpu/drm/xe/tests/xe_migrate.c:526:
+ fence = blt_copy(tile, vram_bo, sys_bo,
+ true, "Blit surf copy from vram to sysmem", test);

-:196: WARNING:LONG_LINE: line length of 102 exceeds 100 columns
#196: FILE: drivers/gpu/drm/xe/tests/xe_migrate.c:536:
+static void validate_ccs_test_run_tile(struct xe_device *xe, struct xe_tile *tile, struct kunit *test)

-:203: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #203: FILE: drivers/gpu/drm/xe/tests/xe_migrate.c:543:
+ sys_bo = xe_bo_create_user(xe, NULL, NULL, SZ_4M, DRM_XE_GEM_CPU_CACHING_WC,
+ ttm_bo_type_device, XE_BO_CREATE_SYSTEM_BIT | XE_BO_NEEDS_CPU_ACCESS);

-:226: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #226: FILE: drivers/gpu/drm/xe/tests/xe_migrate.c:566:
+ vram_bo = xe_bo_create_user(xe, NULL, NULL, SZ_4M, DRM_XE_GEM_CPU_CACHING_WC,
+ ttm_bo_type_device, bo_flags | XE_BO_NEEDS_CPU_ACCESS);

total: 0 errors, 2 warnings, 7 checks, 287 lines checked
40d00c6bc128 drm/xe/xe2: Introduce identity map for compressed pat for vram
-:36: WARNING:COMMIT_LOG_LONG_LINE: Prefer a maximum 75 chars per line (possible unwrapped commit description?) #36:
migration/clear.During eviction (vram->sysmem), we use the mapping from compressed -> uncompressed.

-:140: WARNING:LONG_LINE: line length of 101 exceeds 100 columns #140: FILE: drivers/gpu/drm/xe/xe_migrate.c:520:
+ cur->start + vram_region_gpu_offset(res), is_comp_pte);

total: 0 errors, 2 warnings, 0 checks, 133 lines checked
f11ec2ba9304 drm/xe/xe_migrate: Handle migration logic for xe2+ dgfx
-:6: WARNING:COMMIT_LOG_LONG_LINE: Prefer a maximum 75 chars per line (possible unwrapped commit description?) #6:
During eviction (vram->sysmem), we use the mapping from compressed -> uncompressed.

total: 0 errors, 1 warnings, 0 checks, 31 lines checked 4ddee9420c66 drm/xe/migrate: Add kunit to test migration functionality for BMG -:33: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #33: FILE: drivers/gpu/drm/xe/tests/xe_migrate.c:486:
+static void test_migrate(struct xe_device *xe, struct xe_tile *tile,
+ struct xe_bo *sys_bo, struct xe_bo *vram_bo, struct xe_bo *ccs_bo,

-:71: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #71: FILE: drivers/gpu/drm/xe/tests/xe_migrate.c:524:
+ fence = blt_copy(tile, vram_bo, ccs_bo,
+ true, "Blit surf copy from vram to sysmem", test);

-:110: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #110: FILE: drivers/gpu/drm/xe/tests/xe_migrate.c:563:
+ fence = blt_copy(tile, vram_bo, ccs_bo,
+ true, "Blit surf copy from vram to sysmem", test);

-:137: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #137: FILE: drivers/gpu/drm/xe/tests/xe_migrate.c:654:
+ ccs_bo = xe_bo_create_user(xe, NULL, NULL, SZ_4M, DRM_XE_GEM_CPU_CACHING_WC,
+ ttm_bo_type_device, bo_flags | XE_BO_NEEDS_CPU_ACCESS);

total: 0 errors, 0 warnings, 4 checks, 164 lines checked 87da61e4a9c6 drm/xe/xe2: Do not run xe_bo_test for xe2+ dgfx

#9 lore raw

✗ CI.KUnit: failure for series starting with [1/6] drm/xe/migrate: Handle clear ccs logic for xe2 dgfx

In reply to a message not in the archive
== Series Details ==

== Series Details ==

Series: series starting with [1/6] drm/xe/migrate: Handle clear ccs logic for xe2 dgfx
URL : https://patchwork.freedesktop.org/series/135977/
State : failure

== Summary ==

+ trap cleanup EXIT
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig [06:51:51] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:

$ make ARCH=um O=.kunit olddefconfig
[06:51:55] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make ARCH=um O=.kunit --jobs=48
ERROR:root:In file included from ../drivers/gpu/drm/xe/tests/xe_test.h:13,
                 from ../drivers/gpu/drm/xe/xe_migrate.c:20:
../drivers/gpu/drm/xe/tests/xe_migrate.c: In function ‘test_migrate’:
../drivers/gpu/drm/xe/tests/xe_migrate.c:514:20: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘int’ [-Wformat=]
  514 |   KUNIT_FAIL(test, "Failed to vmap vram bo: %li\n", ret);
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                     |
      |                                                     int
../include/kunit/test.h:608:9: note: in definition of macro ‘_KUNIT_FAILED’
  608 |         fmt,           \
      |         ^~~
../include/kunit/test.h:638:2: note: in expansion of macro ‘KUNIT_FAIL_ASSERTION’
  638 |  KUNIT_FAIL_ASSERTION(test,            \
      |  ^~~~~~~~~~~~~~~~~~~~
../drivers/gpu/drm/xe/tests/xe_migrate.c:514:3: note: in expansion of macro ‘KUNIT_FAIL’
  514 |   KUNIT_FAIL(test, "Failed to vmap vram bo: %li\n", ret);
      |   ^~~~~~~~~~
In file included from ../drivers/gpu/drm/xe/xe_migrate.c:1511:
../drivers/gpu/drm/xe/tests/xe_migrate.c:514:47: note: format string is defined here
  514 |   KUNIT_FAIL(test, "Failed to vmap vram bo: %li\n", ret);
      |                                             ~~^
      |                                               |
      |                                               long int
      |                                             %i
In file included from ../drivers/gpu/drm/xe/tests/xe_test.h:13,
                 from ../drivers/gpu/drm/xe/xe_migrate.c:20:
../drivers/gpu/drm/xe/tests/xe_migrate.c:537:20: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘int’ [-Wformat=]
  537 |   KUNIT_FAIL(test, "Failed to validate vram bo for: %li\n", ret);
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                             |
      |                                                             int
../include/kunit/test.h:608:9: note: in definition of macro ‘_KUNIT_FAILED’
  608 |         fmt,           \
      |         ^~~
../include/kunit/test.h:638:2: note: in expansion of macro ‘KUNIT_FAIL_ASSERTION’
  638 |  KUNIT_FAIL_ASSERTION(test,            \
      |  ^~~~~~~~~~~~~~~~~~~~
../drivers/gpu/drm/xe/tests/xe_migrate.c:537:3: note: in expansion of macro ‘KUNIT_FAIL’
  537 |   KUNIT_FAIL(test, "Failed to validate vram bo for: %li\n", ret);
      |   ^~~~~~~~~~
In file included from ../drivers/gpu/drm/xe/xe_migrate.c:1511:
../drivers/gpu/drm/xe/tests/xe_migrate.c:537:55: note: format string is defined here
  537 |   KUNIT_FAIL(test, "Failed to validate vram bo for: %li\n", ret);
      |                                                     ~~^
      |                                                       |
      |                                                       long int
      |                                                     %i
In file included from ../drivers/gpu/drm/xe/tests/xe_test.h:13,
                 from ../drivers/gpu/drm/xe/xe_migrate.c:20:
../drivers/gpu/drm/xe/tests/xe_migrate.c:553:20: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘int’ [-Wformat=]
  553 |   KUNIT_FAIL(test, "Failed to vmap vram bo: %li\n", ret);
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                     |
      |                                                     int
../include/kunit/test.h:608:9: note: in definition of macro ‘_KUNIT_FAILED’
  608 |         fmt,           \
      |         ^~~
../include/kunit/test.h:638:2: note: in expansion of macro ‘KUNIT_FAIL_ASSERTION’
  638 |  KUNIT_FAIL_ASSERTION(test,            \
      |  ^~~~~~~~~~~~~~~~~~~~
../drivers/gpu/drm/xe/tests/xe_migrate.c:553:3: note: in expansion of macro ‘KUNIT_FAIL’
  553 |   KUNIT_FAIL(test, "Failed to vmap vram bo: %li\n", ret);
      |   ^~~~~~~~~~
In file included from ../drivers/gpu/drm/xe/xe_migrate.c:1511:
../drivers/gpu/drm/xe/tests/xe_migrate.c:553:47: note: format string is defined here
  553 |   KUNIT_FAIL(test, "Failed to vmap vram bo: %li\n", ret);
      |                                             ~~^
      |                                               |
      |                                               long int
      |                                             %i
../drivers/gpu/drm/xe/tests/xe_migrate.c: In function ‘validate_ccs_test_run_tile’:
../drivers/gpu/drm/xe/tests/xe_migrate.c:627:26: error: implicit declaration of function ‘XE_BO_CREATE_VRAM_IF_DGFX’; did you mean ‘XE_BO_FLAG_VRAM_IF_DGFX’? [-Werror=implicit-function-declaration]
  627 |  unsigned int bo_flags = XE_BO_CREATE_VRAM_IF_DGFX(tile);
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                          XE_BO_FLAG_VRAM_IF_DGFX
../drivers/gpu/drm/xe/tests/xe_migrate.c:631:24: error: ‘XE_BO_CREATE_SYSTEM_BIT’ undeclared (first use in this function)
  631 |    ttm_bo_type_device, XE_BO_CREATE_SYSTEM_BIT | XE_BO_NEEDS_CPU_ACCESS);
      |                        ^~~~~~~~~~~~~~~~~~~~~~~
../drivers/gpu/drm/xe/tests/xe_migrate.c:631:24: note: each undeclared identifier is reported only once for each function it appears in
../drivers/gpu/drm/xe/tests/xe_migrate.c:631:50: error: ‘XE_BO_NEEDS_CPU_ACCESS’ undeclared (first use in this function); did you mean ‘XE_BO_FLAG_NEEDS_CPU_ACCESS’?
  631 |    ttm_bo_type_device, XE_BO_CREATE_SYSTEM_BIT | XE_BO_NEEDS_CPU_ACCESS);
      |                                                  ^~~~~~~~~~~~~~~~~~~~~~
      |                                                  XE_BO_FLAG_NEEDS_CPU_ACCESS
In file included from ../drivers/gpu/drm/xe/tests/xe_test.h:13,
                 from ../drivers/gpu/drm/xe/xe_migrate.c:20:
../drivers/gpu/drm/xe/tests/xe_migrate.c:642:20: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘int’ [-Wformat=]
  642 |   KUNIT_FAIL(test, "Failed to validate system bo for: %li\n", ret);
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                               |
      |                                                               int
../include/kunit/test.h:608:9: note: in definition of macro ‘_KUNIT_FAILED’
  608 |         fmt,           \
      |         ^~~
../include/kunit/test.h:638:2: note: in expansion of macro ‘KUNIT_FAIL_ASSERTION’
  638 |  KUNIT_FAIL_ASSERTION(test,            \
      |  ^~~~~~~~~~~~~~~~~~~~
../drivers/gpu/drm/xe/tests/xe_migrate.c:642:3: note: in expansion of macro ‘KUNIT_FAIL’
  642 |   KUNIT_FAIL(test, "Failed to validate system bo for: %li\n", ret);
      |   ^~~~~~~~~~
In file included from ../drivers/gpu/drm/xe/xe_migrate.c:1511:
../drivers/gpu/drm/xe/tests/xe_migrate.c:642:57: note: format string is defined here
  642 |   KUNIT_FAIL(test, "Failed to validate system bo for: %li\n", ret);
      |                                                       ~~^
      |                                                         |
      |                                                         long int
      |                                                       %i
In file included from ../drivers/gpu/drm/xe/tests/xe_test.h:13,
                 from ../drivers/gpu/drm/xe/xe_migrate.c:20:
../drivers/gpu/drm/xe/tests/xe_migrate.c:648:20: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘int’ [-Wformat=]
  648 |   KUNIT_FAIL(test, "Failed to vmap system bo: %li\n", ret);
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                       |
      |                                                       int
../include/kunit/test.h:608:9: note: in definition of macro ‘_KUNIT_FAILED’
  608 |         fmt,           \
      |         ^~~
../include/kunit/test.h:638:2: note: in expansion of macro ‘KUNIT_FAIL_ASSERTION’
  638 |  KUNIT_FAIL_ASSERTION(test,            \
      |  ^~~~~~~~~~~~~~~~~~~~
../drivers/gpu/drm/xe/tests/xe_migrate.c:648:3: note: in expansion of macro ‘KUNIT_FAIL’
  648 |   KUNIT_FAIL(test, "Failed to vmap system bo: %li\n", ret);
      |   ^~~~~~~~~~
In file included from ../drivers/gpu/drm/xe/xe_migrate.c:1511:
../drivers/gpu/drm/xe/tests/xe_migrate.c:648:49: note: format string is defined here
  648 |   KUNIT_FAIL(test, "Failed to vmap system bo: %li\n", ret);
      |                                               ~~^
      |                                                 |
      |                                                 long int
      |                                               %i
In file included from ../drivers/gpu/drm/xe/tests/xe_test.h:13,
                 from ../drivers/gpu/drm/xe/xe_migrate.c:20:
../drivers/gpu/drm/xe/tests/xe_migrate.c:665:20: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘int’ [-Wformat=]
  665 |   KUNIT_FAIL(test, "Failed to validate system bo for: %li\n", ret);
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                               |
      |                                                               int
../include/kunit/test.h:608:9: note: in definition of macro ‘_KUNIT_FAILED’
  608 |         fmt,           \
      |         ^~~
../include/kunit/test.h:638:2: note: in expansion of macro ‘KUNIT_FAIL_ASSERTION’
  638 |  KUNIT_FAIL_ASSERTION(test,            \
      |  ^~~~~~~~~~~~~~~~~~~~
../drivers/gpu/drm/xe/tests/xe_migrate.c:665:3: note: in expansion of macro ‘KUNIT_FAIL’
  665 |   KUNIT_FAIL(test, "Failed to validate system bo for: %li\n", ret);
      |   ^~~~~~~~~~
In file included from ../drivers/gpu/drm/xe/xe_migrate.c:1511:
../drivers/gpu/drm/xe/tests/xe_migrate.c:665:57: note: format string is defined here
  665 |   KUNIT_FAIL(test, "Failed to validate system bo for: %li\n", ret);
      |                                                       ~~^
      |                                                         |
      |                                                         long int
      |                                                       %i
In file included from ../drivers/gpu/drm/xe/tests/xe_test.h:13,
                 from ../drivers/gpu/drm/xe/xe_migrate.c:20:
../drivers/gpu/drm/xe/tests/xe_migrate.c:671:20: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘int’ [-Wformat=]
  671 |   KUNIT_FAIL(test, "Failed to vmap system bo: %li\n", ret);
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                       |
      |                                                       int
../include/kunit/test.h:608:9: note: in definition of macro ‘_KUNIT_FAILED’
  608 |         fmt,           \
      |         ^~~
../include/kunit/test.h:638:2: note: in expansion of macro ‘KUNIT_FAIL_ASSERTION’
  638 |  KUNIT_FAIL_ASSERTION(test,            \
      |  ^~~~~~~~~~~~~~~~~~~~
../drivers/gpu/drm/xe/tests/xe_migrate.c:671:3: note: in expansion of macro ‘KUNIT_FAIL’
  671 |   KUNIT_FAIL(test, "Failed to vmap system bo: %li\n", ret);
      |   ^~~~~~~~~~
In file included from ../drivers/gpu/drm/xe/xe_migrate.c:1511:
../drivers/gpu/drm/xe/tests/xe_migrate.c:671:49: note: format string is defined here
  671 |   KUNIT_FAIL(test, "Failed to vmap system bo: %li\n", ret);
      |                                               ~~^
      |                                                 |
      |                                                 long int
      |                                               %i
In file included from ../drivers/gpu/drm/xe/tests/xe_test.h:13,
                 from ../drivers/gpu/drm/xe/xe_migrate.c:20:
../drivers/gpu/drm/xe/tests/xe_migrate.c:687:20: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘int’ [-Wformat=]
  687 |   KUNIT_FAIL(test, "Failed to validate vram bo for: %li\n", ret);
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                             |
      |                                                             int
../include/kunit/test.h:608:9: note: in definition of macro ‘_KUNIT_FAILED’
  608 |         fmt,           \
      |         ^~~
../include/kunit/test.h:638:2: note: in expansion of macro ‘KUNIT_FAIL_ASSERTION’
  638 |  KUNIT_FAIL_ASSERTION(test,            \
      |  ^~~~~~~~~~~~~~~~~~~~
../drivers/gpu/drm/xe/tests/xe_migrate.c:687:3: note: in expansion of macro ‘KUNIT_FAIL’
  687 |   KUNIT_FAIL(test, "Failed to validate vram bo for: %li\n", ret);
      |   ^~~~~~~~~~
In file included from ../drivers/gpu/drm/xe/xe_migrate.c:1511:
../drivers/gpu/drm/xe/tests/xe_migrate.c:687:55: note: format string is defined here
  687 |   KUNIT_FAIL(test, "Failed to validate vram bo for: %li\n", ret);
      |                                                     ~~^
      |                                                       |
      |                                                       long int
      |                                                     %i
In file included from ../drivers/gpu/drm/xe/tests/xe_test.h:13,
                 from ../drivers/gpu/drm/xe/xe_migrate.c:20:
../drivers/gpu/drm/xe/tests/xe_migrate.c:693:20: warning: format ‘%li’ expects argument of type ‘long int’, but argument 7 has type ‘int’ [-Wformat=]
  693 |   KUNIT_FAIL(test, "Failed to vmap vram bo: %li\n", ret);
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                     |
      |                                                     int
../include/kunit/test.h:608:9: note: in definition of macro ‘_KUNIT_FAILED’
  608 |         fmt,           \
      |         ^~~
../include/kunit/test.h:638:2: note: in expansion of macro ‘KUNIT_FAIL_ASSERTION’
  638 |  KUNIT_FAIL_ASSERTION(test,            \
      |  ^~~~~~~~~~~~~~~~~~~~
../drivers/gpu/drm/xe/tests/xe_migrate.c:693:3: note: in expansion of macro ‘KUNIT_FAIL’
  693 |   KUNIT_FAIL(test, "Failed to vmap vram bo: %li\n", ret);
      |   ^~~~~~~~~~
In file included from ../drivers/gpu/drm/xe/xe_migrate.c:1511:
../drivers/gpu/drm/xe/tests/xe_migrate.c:693:47: note: format string is defined here
  693 |   KUNIT_FAIL(test, "Failed to vmap vram bo: %li\n", ret);
      |                                             ~~^
      |                                               |
      |                                               long int
      |                                             %i
../drivers/gpu/drm/xe/tests/xe_migrate.c: In function ‘validate_ccs_test_run_device’:
../drivers/gpu/drm/xe/tests/xe_migrate.c:735:2: error: implicit declaration of function ‘xe_device_mem_access_get’ [-Werror=implicit-function-declaration]
  735 |  xe_device_mem_access_get(xe);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~
../drivers/gpu/drm/xe/tests/xe_migrate.c:740:2: error: implicit declaration of function ‘xe_device_mem_access_put’ [-Werror=implicit-function-declaration]
  740 |  xe_device_mem_access_put(xe);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[7]: *** [../scripts/Makefile.build:244: drivers/gpu/drm/xe/xe_migrate.o] Error 1
make[7]: *** Waiting for unfinished jobs....
../lib/iomap.c:156:5: warning: no previous prototype for ‘ioread64_lo_hi’ [-Wmissing-prototypes]
  156 | u64 ioread64_lo_hi(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~
../lib/iomap.c:163:5: warning: no previous prototype for ‘ioread64_hi_lo’ [-Wmissing-prototypes]
  163 | u64 ioread64_hi_lo(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~
../lib/iomap.c:170:5: warning: no previous prototype for ‘ioread64be_lo_hi’ [-Wmissing-prototypes]
  170 | u64 ioread64be_lo_hi(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~~~
../lib/iomap.c:178:5: warning: no previous prototype for ‘ioread64be_hi_lo’ [-Wmissing-prototypes]
  178 | u64 ioread64be_hi_lo(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~~~
../lib/iomap.c:264:6: warning: no previous prototype for ‘iowrite64_lo_hi’ [-Wmissing-prototypes]
  264 | void iowrite64_lo_hi(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~
../lib/iomap.c:272:6: warning: no previous prototype for ‘iowrite64_hi_lo’ [-Wmissing-prototypes]
  272 | void iowrite64_hi_lo(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~
../lib/iomap.c:280:6: warning: no previous prototype for ‘iowrite64be_lo_hi’ [-Wmissing-prototypes]
  280 | void iowrite64be_lo_hi(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~~~
../lib/iomap.c:288:6: warning: no previous prototype for ‘iowrite64be_hi_lo’ [-Wmissing-prototypes]
  288 | void iowrite64be_hi_lo(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~~~
make[6]: *** [../scripts/Makefile.build:485: drivers/gpu/drm/xe] Error 2
make[6]: *** Waiting for unfinished jobs....
make[5]: *** [../scripts/Makefile.build:485: drivers/gpu/drm] Error 2
make[4]: *** [../scripts/Makefile.build:485: drivers/gpu] Error 2
make[3]: *** [../scripts/Makefile.build:485: drivers] Error 2
make[2]: *** [/kernel/Makefile:1934: .] Error 2
make[1]: *** [/kernel/Makefile:240: __sub-make] Error 2
make: *** [Makefile:240: __sub-make] Error 2

+ cleanup
++ stat -c %u:%g /kernel
+ chown -R 1003:1003 /kernel