[Intel-xe] [PATCH v4 2/2] drm/xe/tests: Adapt migrate_sanity_test for link copy engines

Balasubramani Vivekanandan balasubramani.vivekanandan at intel.com
Wed Mar 15 08:15:00 UTC 2023


Link copy engines does not support XY_FAST_COLOR instruction and hence
use the MEM_SET instruction in its place. MEM_SET only support setting
8-bit value. To keep it simple, driver uses MEM_SET only to clear
address range.
migrate_sanity tests adapted such that it doesn't try to set any values
in platforms with link copy engines but validates that memory region is
cleared

Signed-off-by: Balasubramani Vivekanandan <balasubramani.vivekanandan at intel.com>
---
 drivers/gpu/drm/xe/tests/xe_migrate.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/xe/tests/xe_migrate.c b/drivers/gpu/drm/xe/tests/xe_migrate.c
index ac659b94e7f5..9bf73a2ce982 100644
--- a/drivers/gpu/drm/xe/tests/xe_migrate.c
+++ b/drivers/gpu/drm/xe/tests/xe_migrate.c
@@ -86,7 +86,7 @@ static void test_copy(struct xe_migrate *m, struct xe_bo *bo,
 		      struct kunit *test)
 {
 	struct xe_device *xe = gt_to_xe(m->gt);
-	u64 retval, expected = 0xc0c0c0c0c0c0c0c0ULL;
+	u64 retval, expected;
 	bool big = bo->size >= SZ_2M;
 	struct dma_fence *fence;
 	const char *str = big ? "Copying big bo" : "Copying small bo";
@@ -117,7 +117,12 @@ static void test_copy(struct xe_migrate *m, struct xe_bo *bo,
 	}
 
 	xe_map_memset(xe, &sysmem->vmap, 0, 0xd0, sysmem->size);
-	fence = xe_migrate_clear(m, sysmem, sysmem->ttm.resource, 0xc0c0c0c0);
+
+	expected = (xe->info.has_link_copy_engine) ? 0 : 0xc0c0c0c0c0c0c0c0ULL;
+	fence = xe_migrate_clear(m, sysmem, sysmem->ttm.resource,
+				 (xe->info.has_link_copy_engine) ? 0 :
+				 0xc0c0c0c0);
+
 	if (!sanity_fence_failed(xe, fence, big ? "Clearing sysmem big bo" :
 				 "Clearing sysmem small bo", test)) {
 		retval = xe_map_rd(xe, &sysmem->vmap, 0, u64);
@@ -287,7 +292,11 @@ static void xe_migrate_sanity_test(struct xe_migrate *m, struct kunit *test)
 	bb->len = 0;
 	bb->cs[bb->len++] = MI_BATCH_BUFFER_END;
 	xe_map_wr(xe, &pt->vmap, 0, u32, 0xdeaddead);
-	expected = 0x12345678U;
+	/*
+	 * Platforms with link copy engines currently doesn't support setting a
+	 * value, but only allow clearing
+	 */
+	expected = (xe->info.has_link_copy_engine) ? 0 : 0x12345678U;
 
 	emit_clear(m->gt, bb, xe_migrate_vm_addr(NUM_KERNEL_PDE - 1, 0), 4, 4,
 		   expected, IS_DGFX(xe));
@@ -302,7 +311,7 @@ static void xe_migrate_sanity_test(struct xe_migrate *m, struct kunit *test)
 	/* Clear a small bo */
 	kunit_info(test, "Clearing small buffer object\n");
 	xe_map_memset(xe, &tiny->vmap, 0, 0x22, tiny->size);
-	expected = 0x224488ff;
+	expected = (xe->info.has_link_copy_engine) ? 0 : 0x224488ff;
 	fence = xe_migrate_clear(m, tiny, tiny->ttm.resource, expected);
 	if (sanity_fence_failed(xe, fence, "Clearing small bo", test))
 		goto out;
@@ -321,7 +330,7 @@ static void xe_migrate_sanity_test(struct xe_migrate *m, struct kunit *test)
 	/* Clear a big bo with a fixed value */
 	kunit_info(test, "Clearing big buffer object\n");
 	xe_map_memset(xe, &big->vmap, 0, 0x11, big->size);
-	expected = 0x11223344U;
+	expected = (xe->info.has_link_copy_engine) ? 0 : 0x11223344U;
 	fence = xe_migrate_clear(m, big, big->ttm.resource, expected);
 	if (sanity_fence_failed(xe, fence, "Clearing big bo", test))
 		goto out;
-- 
2.25.1



More information about the Intel-xe mailing list