intel-xe.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [Intel-xe] [PATCH 0/3] drm/xe: Get xe_migrate_test working
@ 2023-03-31 17:09 Niranjana Vishwanathapura
  2023-03-31 17:09 ` [Intel-xe] [PATCH 1/3] drm/xe/tests: Use proper batch base address Niranjana Vishwanathapura
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Niranjana Vishwanathapura @ 2023-03-31 17:09 UTC (permalink / raw)
  To: intel-xe; +Cc: thomas.hellstrom

Resolve issues in xe_migrate functionality and kunit test and
get the kunit test passing on all platforms includng the
multi-tile systems.

Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>

Niranjana Vishwanathapura (3):
  drm/xe/tests: Use proper batch base address
  drm/xe/tests: Set correct expectation
  drm/xe: Use proper vram offset

 drivers/gpu/drm/xe/tests/xe_migrate.c |  5 ++++-
 drivers/gpu/drm/xe/xe_bo.c            | 12 ++++++------
 drivers/gpu/drm/xe/xe_bo.h            |  1 +
 drivers/gpu/drm/xe/xe_migrate.c       | 13 ++++++++-----
 4 files changed, 19 insertions(+), 12 deletions(-)

-- 
2.21.0.rc0.32.g243a4c7e27


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Intel-xe] [PATCH 1/3] drm/xe/tests: Use proper batch base address
  2023-03-31 17:09 [Intel-xe] [PATCH 0/3] drm/xe: Get xe_migrate_test working Niranjana Vishwanathapura
@ 2023-03-31 17:09 ` Niranjana Vishwanathapura
  2023-03-31 17:09 ` [Intel-xe] [PATCH 2/3] drm/xe/tests: Set correct expectation Niranjana Vishwanathapura
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Niranjana Vishwanathapura @ 2023-03-31 17:09 UTC (permalink / raw)
  To: intel-xe; +Cc: thomas.hellstrom

In xe_migrate_sanity_kunit test, use proper batch base address
by considering usm case.

Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
---
 drivers/gpu/drm/xe/tests/xe_migrate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/tests/xe_migrate.c b/drivers/gpu/drm/xe/tests/xe_migrate.c
index 17829f878757..085ad96d7278 100644
--- a/drivers/gpu/drm/xe/tests/xe_migrate.c
+++ b/drivers/gpu/drm/xe/tests/xe_migrate.c
@@ -35,8 +35,10 @@ static int run_sanity_job(struct xe_migrate *m, struct xe_device *xe,
 			  struct xe_bb *bb, u32 second_idx, const char *str,
 			  struct kunit *test)
 {
+	u64 batch_base = xe_migrate_batch_base(m, xe->info.supports_usm);
+
 	struct xe_sched_job *job = xe_bb_create_migration_job(m->eng, bb,
-							      m->batch_base_ofs,
+							      batch_base,
 							      second_idx);
 	struct dma_fence *fence;
 
-- 
2.21.0.rc0.32.g243a4c7e27


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Intel-xe] [PATCH 2/3] drm/xe/tests: Set correct expectation
  2023-03-31 17:09 [Intel-xe] [PATCH 0/3] drm/xe: Get xe_migrate_test working Niranjana Vishwanathapura
  2023-03-31 17:09 ` [Intel-xe] [PATCH 1/3] drm/xe/tests: Use proper batch base address Niranjana Vishwanathapura
@ 2023-03-31 17:09 ` Niranjana Vishwanathapura
  2023-03-31 17:09 ` [Intel-xe] [PATCH 3/3] drm/xe: Use proper vram offset Niranjana Vishwanathapura
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Niranjana Vishwanathapura @ 2023-03-31 17:09 UTC (permalink / raw)
  To: intel-xe; +Cc: thomas.hellstrom

In xe_migrate_sanity_kunit test, use correct expected value from
xe_migrate_copy() operation.

Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
---
 drivers/gpu/drm/xe/tests/xe_migrate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/xe/tests/xe_migrate.c b/drivers/gpu/drm/xe/tests/xe_migrate.c
index 085ad96d7278..2a836f5bd8ff 100644
--- a/drivers/gpu/drm/xe/tests/xe_migrate.c
+++ b/drivers/gpu/drm/xe/tests/xe_migrate.c
@@ -148,6 +148,7 @@ static void test_copy(struct xe_migrate *m, struct xe_bo *bo,
 	xe_map_memset(xe, &sysmem->vmap, 0, 0xc0, sysmem->size);
 	xe_map_memset(xe, &bo->vmap, 0, 0xd0, bo->size);
 
+	expected = 0xc0c0c0c0c0c0c0c0;
 	fence = xe_migrate_copy(m, sysmem, sysmem->ttm.resource,
 				bo->ttm.resource);
 	if (!sanity_fence_failed(xe, fence, big ? "Copying big bo sysmem -> vram" :
-- 
2.21.0.rc0.32.g243a4c7e27


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Intel-xe] [PATCH 3/3] drm/xe: Use proper vram offset
  2023-03-31 17:09 [Intel-xe] [PATCH 0/3] drm/xe: Get xe_migrate_test working Niranjana Vishwanathapura
  2023-03-31 17:09 ` [Intel-xe] [PATCH 1/3] drm/xe/tests: Use proper batch base address Niranjana Vishwanathapura
  2023-03-31 17:09 ` [Intel-xe] [PATCH 2/3] drm/xe/tests: Set correct expectation Niranjana Vishwanathapura
@ 2023-03-31 17:09 ` Niranjana Vishwanathapura
  2023-03-31 17:12 ` [Intel-xe] ✓ CI.Patch_applied: success for drm/xe: Get xe_migrate_test working Patchwork
  2023-03-31 17:12 ` [Intel-xe] ✗ CI.KUnit: failure " Patchwork
  4 siblings, 0 replies; 7+ messages in thread
From: Niranjana Vishwanathapura @ 2023-03-31 17:09 UTC (permalink / raw)
  To: intel-xe; +Cc: thomas.hellstrom

In xe_migrate functions, use proper vram io offset of the
tiles while calculating addresses.

Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
---
 drivers/gpu/drm/xe/xe_bo.c      | 12 ++++++------
 drivers/gpu/drm/xe/xe_bo.h      |  1 +
 drivers/gpu/drm/xe/xe_migrate.c | 13 ++++++++-----
 3 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
index e4d079b61d52..5460e6fe3c1f 100644
--- a/drivers/gpu/drm/xe/xe_bo.c
+++ b/drivers/gpu/drm/xe/xe_bo.c
@@ -1207,12 +1207,12 @@ struct xe_bo *xe_bo_create_from_data(struct xe_device *xe, struct xe_gt *gt,
  * XXX: This is in the VM bind data path, likely should calculate this once and
  * store, with a recalculation if the BO is moved.
  */
-static uint64_t vram_region_io_offset(struct xe_bo *bo)
+uint64_t vram_region_io_offset(struct ttm_resource *res)
 {
-	struct xe_device *xe = xe_bo_device(bo);
-	struct xe_gt *gt = mem_type_to_gt(xe, bo->ttm.resource->mem_type);
+	struct xe_device *xe = ttm_to_xe_device(res->bo->bdev);
+	struct xe_gt *gt = mem_type_to_gt(xe, res->mem_type);
 
-	if (bo->ttm.resource->mem_type == XE_PL_STOLEN)
+	if (res->mem_type == XE_PL_STOLEN)
 		return xe_ttm_stolen_gpu_offset(xe);
 
 	return gt->mem.vram.io_start - xe->mem.vram.io_start;
@@ -1299,7 +1299,7 @@ int xe_bo_pin(struct xe_bo *bo)
 			XE_BUG_ON(!(place->flags & TTM_PL_FLAG_CONTIGUOUS));
 
 			place->fpfn = (xe_bo_addr(bo, 0, PAGE_SIZE, &vram) -
-				       vram_region_io_offset(bo)) >> PAGE_SHIFT;
+				       vram_region_io_offset(bo->ttm.resource)) >> PAGE_SHIFT;
 			place->lpfn = place->fpfn + (bo->size >> PAGE_SHIFT);
 
 			spin_lock(&xe->pinned.lock);
@@ -1443,7 +1443,7 @@ dma_addr_t xe_bo_addr(struct xe_bo *bo, u64 offset,
 
 		xe_res_first(bo->ttm.resource, page << PAGE_SHIFT,
 			     page_size, &cur);
-		return cur.start + offset + vram_region_io_offset(bo);
+		return cur.start + offset + vram_region_io_offset(bo->ttm.resource);
 	}
 }
 
diff --git a/drivers/gpu/drm/xe/xe_bo.h b/drivers/gpu/drm/xe/xe_bo.h
index 9b26049521de..8f5a7ad10d09 100644
--- a/drivers/gpu/drm/xe/xe_bo.h
+++ b/drivers/gpu/drm/xe/xe_bo.h
@@ -223,6 +223,7 @@ void xe_bo_vunmap(struct xe_bo *bo);
 bool mem_type_is_vram(u32 mem_type);
 bool xe_bo_is_vram(struct xe_bo *bo);
 bool xe_bo_is_stolen(struct xe_bo *bo);
+uint64_t vram_region_io_offset(struct ttm_resource *res);
 
 bool xe_bo_can_migrate(struct xe_bo *bo, u32 mem_type);
 
diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
index deb4233b94fa..e8978440c725 100644
--- a/drivers/gpu/drm/xe/xe_migrate.c
+++ b/drivers/gpu/drm/xe/xe_migrate.c
@@ -392,6 +392,7 @@ static u64 xe_migrate_res_sizes(struct xe_res_cursor *cur)
 
 static u32 pte_update_size(struct xe_migrate *m,
 			   bool is_vram,
+			   struct ttm_resource *res,
 			   struct xe_res_cursor *cur,
 			   u64 *L0, u64 *L0_ofs, u32 *L0_pt,
 			   u32 cmd_size, u32 pt_ofs, u32 avail_pts)
@@ -417,7 +418,8 @@ static u32 pte_update_size(struct xe_migrate *m,
 		cmds += cmd_size;
 	} else {
 		/* Offset into identity map. */
-		*L0_ofs = xe_migrate_vram_ofs(cur->start);
+		*L0_ofs = xe_migrate_vram_ofs(cur->start +
+					      vram_region_io_offset(res));
 		cmds += cmd_size;
 	}
 
@@ -467,6 +469,7 @@ static void emit_pte(struct xe_migrate *m,
 					addr |= GEN12_PTE_PS64;
 				}
 
+				addr += vram_region_io_offset(bo->ttm.resource);
 				addr |= GEN12_PPGTT_PTE_LM;
 			}
 			addr |= PPAT_CACHED | GEN8_PAGE_PRESENT | GEN8_PAGE_RW;
@@ -646,17 +649,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_it, &src_L0,
+		batch_size += pte_update_size(m, src_is_vram, src, &src_it, &src_L0,
 					      &src_L0_ofs, &src_L0_pt, 0, 0,
 					      NUM_PT_PER_BLIT);
 
-		batch_size += pte_update_size(m, dst_is_vram, &dst_it, &src_L0,
+		batch_size += pte_update_size(m, dst_is_vram, dst, &dst_it, &src_L0,
 					      &dst_L0_ofs, &dst_L0_pt, 0,
 					      NUM_PT_PER_BLIT, NUM_PT_PER_BLIT);
 
 		if (copy_system_ccs) {
 			ccs_size = xe_device_ccs_bytes(xe, src_L0);
-			batch_size += pte_update_size(m, false, &ccs_it, &ccs_size,
+			batch_size += pte_update_size(m, false, NULL, &ccs_it, &ccs_size,
 						      &ccs_ofs, &ccs_pt, 0,
 						      2 * NUM_PT_PER_BLIT,
 						      NUM_PT_PER_BLIT);
@@ -879,7 +882,7 @@ 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_it,
+			pte_update_size(m, clear_vram, src, &src_it,
 					&clear_L0, &clear_L0_ofs, &clear_L0_pt,
 					emit_clear_cmd_len(xe), 0,
 					NUM_PT_PER_BLIT);
-- 
2.21.0.rc0.32.g243a4c7e27


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Intel-xe] ✓ CI.Patch_applied: success for drm/xe: Get xe_migrate_test working
  2023-03-31 17:09 [Intel-xe] [PATCH 0/3] drm/xe: Get xe_migrate_test working Niranjana Vishwanathapura
                   ` (2 preceding siblings ...)
  2023-03-31 17:09 ` [Intel-xe] [PATCH 3/3] drm/xe: Use proper vram offset Niranjana Vishwanathapura
@ 2023-03-31 17:12 ` Patchwork
  2023-03-31 17:12 ` [Intel-xe] ✗ CI.KUnit: failure " Patchwork
  4 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2023-03-31 17:12 UTC (permalink / raw)
  To: Niranjana Vishwanathapura; +Cc: intel-xe

== Series Details ==

Series: drm/xe: Get xe_migrate_test working
URL   : https://patchwork.freedesktop.org/series/115949/
State : success

== Summary ==

=== Applying kernel patches on branch 'drm-xe-next' with base: ===
commit 4b3608ff06e78b835a2e50eec94cd041c95e4326
Author:     Matt Roper <matthew.d.roper@intel.com>
AuthorDate: Wed Mar 29 10:33:34 2023 -0700
Commit:     Matt Roper <matthew.d.roper@intel.com>
CommitDate: Thu Mar 30 12:20:22 2023 -0700

    drm/xe: Don't emit extra MI_BATCH_BUFFER_END in WA batchbuffer
    
    The MI_BATCH_BUFFER_END is already added automatically by
    __xe_bb_create_job(); including it in the construction of the workaround
    batchbuffer results in an unnecessary duplicate.
    
    Link: https://lore.kernel.org/r/20230329173334.4015124-4-matthew.d.roper@intel.com
    Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
    Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
=== git am output follows ===
Applying: drm/xe/tests: Use proper batch base address
Applying: drm/xe/tests: Set correct expectation
Applying: drm/xe: Use proper vram offset



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Intel-xe] ✗ CI.KUnit: failure for drm/xe: Get xe_migrate_test working
  2023-03-31 17:09 [Intel-xe] [PATCH 0/3] drm/xe: Get xe_migrate_test working Niranjana Vishwanathapura
                   ` (3 preceding siblings ...)
  2023-03-31 17:12 ` [Intel-xe] ✓ CI.Patch_applied: success for drm/xe: Get xe_migrate_test working Patchwork
@ 2023-03-31 17:12 ` Patchwork
  4 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2023-03-31 17:12 UTC (permalink / raw)
  To: Niranjana Vishwanathapura; +Cc: intel-xe

== Series Details ==

Series: drm/xe: Get xe_migrate_test working
URL   : https://patchwork.freedesktop.org/series/115949/
State : failure

== Summary ==

+ trap cleanup EXIT
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig
ERROR:root:In file included from /usr/include/stdlib.h:1013,
                 from ../arch/um/drivers/chan_user.c:6:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: In function ‘atof’:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:26:1: error: SSE register return with SSE disabled
   26 | {
      | ^
In file included from /usr/include/stdlib.h:1013,
                 from ../arch/um/drivers/fd.c:7:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: In function ‘atof’:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:26:1: error: SSE register return with SSE disabled
   26 | {
      | ^
In file included from /usr/include/stdlib.h:1013,
                 from ../arch/x86/um/os-Linux/registers.c:8:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: In function ‘atof’:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:26:1: error: SSE register return with SSE disabled
   26 | {
      | ^
In file included from /usr/include/stdlib.h:1013,
                 from ../arch/um/os-Linux/execvp.c:24:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: In function ‘atof’:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:26:1: error: SSE register return with SSE disabled
   26 | {
      | ^
In file included from /usr/include/stdlib.h:1013,
                 from ../arch/um/os-Linux/file.c:8:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: In function ‘atof’:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:26:1: error: SSE register return with SSE disabled
   26 | {
      | ^
make[4]: *** [../scripts/Makefile.build:252: arch/x86/um/os-Linux/registers.o] Error 1
make[3]: *** [../scripts/Makefile.build:494: arch/x86/um/os-Linux] Error 2
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [../scripts/Makefile.build:252: arch/um/os-Linux/execvp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [../scripts/Makefile.build:252: arch/um/drivers/fd.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [../scripts/Makefile.build:252: arch/um/drivers/chan_user.o] Error 1
make[3]: *** [../scripts/Makefile.build:252: arch/um/os-Linux/file.o] Error 1
In file included from /usr/include/stdlib.h:1013,
                 from ../arch/um/os-Linux/skas/process.c:7:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: In function ‘atof’:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:26:1: error: SSE register return with SSE disabled
   26 | {
      | ^
make[4]: *** [../scripts/Makefile.build:252: arch/um/os-Linux/skas/process.o] Error 1
make[3]: *** [../scripts/Makefile.build:494: arch/um/os-Linux/skas] Error 2
make[2]: *** [../scripts/Makefile.build:494: arch/um/os-Linux] Error 2
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [../scripts/Makefile.build:494: arch/x86/um] Error 2
make[2]: *** [../scripts/Makefile.build:494: arch/um/drivers] Error 2
In file included from /usr/include/stdlib.h:1013,
                 from arch/um/kernel/config.c:7:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: In function ‘atof’:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:26:1: error: SSE register return with SSE disabled
   26 | {
      | ^
make[3]: *** [../scripts/Makefile.build:252: arch/um/kernel/config.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [../scripts/Makefile.build:494: arch/um/kernel] Error 2
make[1]: *** [/kernel/Makefile:2025: .] Error 2
make: *** [Makefile:226: __sub-make] Error 2

[17:12:30] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
[17:12:34] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make ARCH=um O=.kunit --jobs=48
+ cleanup
++ stat -c %u:%g /kernel
+ chown -R 1003:1003 /kernel



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Intel-xe] [PATCH 0/3] drm/xe: Get xe_migrate_test working
@ 2023-04-01  3:02 Niranjana Vishwanathapura
  0 siblings, 0 replies; 7+ messages in thread
From: Niranjana Vishwanathapura @ 2023-04-01  3:02 UTC (permalink / raw)
  To: intel-xe; +Cc: thomas.hellstrom

Resolve issues in xe_migrate functionality and kunit test and
get the kunit test passing on all platforms includng the
multi-tile systems.

Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>

Niranjana Vishwanathapura (3):
  drm/xe/tests: Use proper batch base address
  drm/xe/tests: Set correct expectation
  drm/xe: Use proper vram offset

 drivers/gpu/drm/xe/tests/xe_migrate.c |  4 +++-
 drivers/gpu/drm/xe/xe_bo.c            | 12 ++++++------
 drivers/gpu/drm/xe/xe_bo.h            |  1 +
 drivers/gpu/drm/xe/xe_migrate.c       | 13 ++++++++-----
 4 files changed, 18 insertions(+), 12 deletions(-)

-- 
2.21.0.rc0.32.g243a4c7e27


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-04-01  3:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-31 17:09 [Intel-xe] [PATCH 0/3] drm/xe: Get xe_migrate_test working Niranjana Vishwanathapura
2023-03-31 17:09 ` [Intel-xe] [PATCH 1/3] drm/xe/tests: Use proper batch base address Niranjana Vishwanathapura
2023-03-31 17:09 ` [Intel-xe] [PATCH 2/3] drm/xe/tests: Set correct expectation Niranjana Vishwanathapura
2023-03-31 17:09 ` [Intel-xe] [PATCH 3/3] drm/xe: Use proper vram offset Niranjana Vishwanathapura
2023-03-31 17:12 ` [Intel-xe] ✓ CI.Patch_applied: success for drm/xe: Get xe_migrate_test working Patchwork
2023-03-31 17:12 ` [Intel-xe] ✗ CI.KUnit: failure " Patchwork
2023-04-01  3:02 [Intel-xe] [PATCH 0/3] " Niranjana Vishwanathapura

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).