Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v7 00/20] Prefetch Support for svm ranges
@ 2025-05-12 16:47 Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v8 01/20] drm/gpusvm: Introduce devmem_only flag for allocation Himal Prasad Ghimiray
                   ` (26 more replies)
  0 siblings, 27 replies; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, Himal Prasad Ghimiray

This series builds upon the SVM work by Matt Brost and introduces the
ability to prefetch SVM ranges. The prefetch functionality utilizes the
existing ioctl vm_bind for the user interface.

Prefetching ensures that pages are populated in the requested region and
that PTEs are updated, thereby preventing GPU page faults.

Region 0: Ranges will remain in SMEM, and only PTE updates will occur.
Region 1: Ranges will migrate to VRAM, and PTEs will be updated
accordingly

Patches[1 - 5] are part of https://patchwork.freedesktop.org/series/147846/
and are already under review.

v3:
  - Separate out madvise and Prefetch series
  - Rebase on top of atomic fixes for svm
  - address comments from Matthew Brost

v4:
  - CI fixes

v5
  - Move finding start addr of cpu vma to drm gpusvm layer

v6
  - Rebase on top of latest SVM ATOMIC Fixes
  - move eviction logic to prefetch_ranges
  - Rename functions properly

v7
 - Rebase on top of v8 of SVM ATOMIC Fixes
 - devmem_only assigned 0 for prefetch
 - s/mmget/mmget_not_zero/

Himal Prasad Ghimiray (16):
  drm/gpusvm: Introduce devmem_only flag for allocation
  drm/xe: Introduce xe_vma_op_prefetch_range struct for prefetch of
    ranges
  drm/xe: Make xe_svm_alloc_vram public
  drm/xe/svm: Helper to add tile masks to svm ranges
  drm/xe/svm: Make to_xe_range a public function
  drm/xe/svm: Make xe_svm_range_* end/start/size public
  drm/xe/vm: Update xe_vma_ops_incr_pt_update_ops to take an increment
    value
  drm/xe/vm: Add an identifier in xe_vma_ops for svm prefetch
  drm/xe: Rename lookup_vma function to xe_find_vma_by_addr
  drm/xe/svm: Refactor usage of drm_gpusvm* function in xe_svm
  drm/xe/svm: Make xe_svm_range_needs_migrate_to_vram() public
  drm/xe/svm: Add xe_svm_range_validate() and
    xe_svm_range_migrate_to_smem()
  drm/gpusvm: Introduce drm_gpusvm_find_vma_start() function
  drm/xe/svm: Add xe_svm_find_vma_start() helper
  drm/xe/svm: Implement prefetch support for SVM ranges
  drm/xe/vm: Add debug prints for SVM range prefetch

Matthew Brost (4):
  drm/xe: Strict migration policy for atomic SVM faults
  drm/gpusvm: Add timeslicing support to GPU SVM
  drm/xe: Timeslice GPU on atomic SVM fault
  drm/xe: Add atomic_svm_timeslice_ms debugfs entry

 drivers/gpu/drm/drm_gpusvm.c         |  71 ++++++-
 drivers/gpu/drm/xe/xe_debugfs.c      |  38 ++++
 drivers/gpu/drm/xe/xe_device.c       |   1 +
 drivers/gpu/drm/xe/xe_device_types.h |   3 +
 drivers/gpu/drm/xe/xe_gt_pagefault.c |  24 +--
 drivers/gpu/drm/xe/xe_module.c       |   3 -
 drivers/gpu/drm/xe/xe_module.h       |   1 -
 drivers/gpu/drm/xe/xe_pt.c           |  84 ++++++--
 drivers/gpu/drm/xe/xe_svm.c          | 301 +++++++++++++++++++++------
 drivers/gpu/drm/xe/xe_svm.h          | 143 ++++++++++++-
 drivers/gpu/drm/xe/xe_vm.c           | 261 +++++++++++++++++++++--
 drivers/gpu/drm/xe/xe_vm.h           |   2 +
 drivers/gpu/drm/xe/xe_vm_types.h     |  15 ++
 include/drm/drm_gpusvm.h             |  52 +++--
 14 files changed, 847 insertions(+), 152 deletions(-)

-- 
2.34.1


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

* [PATCH v8 01/20] drm/gpusvm: Introduce devmem_only flag for allocation
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
@ 2025-05-12 16:47 ` Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v8 02/20] drm/xe: Strict migration policy for atomic SVM faults Himal Prasad Ghimiray
                   ` (25 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, Himal Prasad Ghimiray, stable

This commit adds a new flag, devmem_only, to the drm_gpusvm structure. The
purpose of this flag is to ensure that the get_pages function allocates
memory exclusively from the device's memory. If the allocation from
device memory fails, the function will return an -EFAULT error.

Required for shared CPU and GPU atomics on certain devices.

v3:
 - s/vram_only/devmem_only/

Fixes: 99624bdff867 ("drm/gpusvm: Add support for GPU Shared Virtual Memory")
Cc: stable@vger.kernel.org
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/drm_gpusvm.c | 5 +++++
 include/drm/drm_gpusvm.h     | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/drm_gpusvm.c b/drivers/gpu/drm/drm_gpusvm.c
index de424e670995..a58d03e6cac2 100644
--- a/drivers/gpu/drm/drm_gpusvm.c
+++ b/drivers/gpu/drm/drm_gpusvm.c
@@ -1454,6 +1454,11 @@ int drm_gpusvm_range_get_pages(struct drm_gpusvm *gpusvm,
 				goto err_unmap;
 			}
 
+			if (ctx->devmem_only) {
+				err = -EFAULT;
+				goto err_unmap;
+			}
+
 			addr = dma_map_page(gpusvm->drm->dev,
 					    page, 0,
 					    PAGE_SIZE << order,
diff --git a/include/drm/drm_gpusvm.h b/include/drm/drm_gpusvm.h
index df120b4d1f83..9fd25fc880a4 100644
--- a/include/drm/drm_gpusvm.h
+++ b/include/drm/drm_gpusvm.h
@@ -286,6 +286,7 @@ struct drm_gpusvm {
  * @in_notifier: entering from a MMU notifier
  * @read_only: operating on read-only memory
  * @devmem_possible: possible to use device memory
+ * @devmem_only: use only device memory
  *
  * Context that is DRM GPUSVM is operating in (i.e. user arguments).
  */
@@ -294,6 +295,7 @@ struct drm_gpusvm_ctx {
 	unsigned int in_notifier :1;
 	unsigned int read_only :1;
 	unsigned int devmem_possible :1;
+	unsigned int devmem_only :1;
 };
 
 int drm_gpusvm_init(struct drm_gpusvm *gpusvm,
-- 
2.34.1


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

* [PATCH v8 02/20] drm/xe: Strict migration policy for atomic SVM faults
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v8 01/20] drm/gpusvm: Introduce devmem_only flag for allocation Himal Prasad Ghimiray
@ 2025-05-12 16:47 ` Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v8 03/20] drm/gpusvm: Add timeslicing support to GPU SVM Himal Prasad Ghimiray
                   ` (24 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, stable, Himal Prasad Ghimiray

From: Matthew Brost <matthew.brost@intel.com>

Mixing GPU and CPU atomics does not work unless a strict migration
policy of GPU atomics must be device memory. Enforce a policy of must be
in VRAM with a retry loop of 3 attempts, if retry loop fails abort
fault.

Removing always_migrate_to_vram modparam as we now have real migration
policy.

v2:
 - Only retry migration on atomics
 - Drop alway migrate modparam
v3:
 - Only set vram_only on DGFX (Himal)
 - Bail on get_pages failure if vram_only and retry count exceeded (Himal)
 - s/vram_only/devmem_only
 - Update xe_svm_range_is_valid to accept devmem_only argument
v4:
 - Fix logic bug get_pages failure
v5:
 - Fix commit message (Himal)
 - Mention removing always_migrate_to_vram in commit message (Lucas)
 - Fix xe_svm_range_is_valid to check for devmem pages
 - Bail on devmem_only && !migrate_devmem (Thomas)
v6:
 - Add READ_ONCE barriers for opportunistic checks (Thomas)
 - Pair READ_ONCE with WRITE_ONCE (Thomas)
v7:
 - Adjust comments (Thomas)

Fixes: 2f118c949160 ("drm/xe: Add SVM VRAM migration")
Cc: stable@vger.kernel.org
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Acked-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>`
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
 drivers/gpu/drm/drm_gpusvm.c   |  23 +++++--
 drivers/gpu/drm/xe/xe_module.c |   3 -
 drivers/gpu/drm/xe/xe_module.h |   1 -
 drivers/gpu/drm/xe/xe_pt.c     |  14 ++++-
 drivers/gpu/drm/xe/xe_svm.c    | 111 +++++++++++++++++++++++++--------
 drivers/gpu/drm/xe/xe_svm.h    |   5 --
 include/drm/drm_gpusvm.h       |  40 +++++++-----
 7 files changed, 140 insertions(+), 57 deletions(-)

diff --git a/drivers/gpu/drm/drm_gpusvm.c b/drivers/gpu/drm/drm_gpusvm.c
index a58d03e6cac2..41f6616bcf76 100644
--- a/drivers/gpu/drm/drm_gpusvm.c
+++ b/drivers/gpu/drm/drm_gpusvm.c
@@ -1118,6 +1118,10 @@ static void __drm_gpusvm_range_unmap_pages(struct drm_gpusvm *gpusvm,
 	lockdep_assert_held(&gpusvm->notifier_lock);
 
 	if (range->flags.has_dma_mapping) {
+		struct drm_gpusvm_range_flags flags = {
+			.__flags = range->flags.__flags,
+		};
+
 		for (i = 0, j = 0; i < npages; j++) {
 			struct drm_pagemap_device_addr *addr = &range->dma_addr[j];
 
@@ -1131,8 +1135,12 @@ static void __drm_gpusvm_range_unmap_pages(struct drm_gpusvm *gpusvm,
 							    dev, *addr);
 			i += 1 << addr->order;
 		}
-		range->flags.has_devmem_pages = false;
-		range->flags.has_dma_mapping = false;
+
+		/* WRITE_ONCE pairs with READ_ONCE for opportunistic checks */
+		flags.has_devmem_pages = false;
+		flags.has_dma_mapping = false;
+		WRITE_ONCE(range->flags.__flags, flags.__flags);
+
 		range->dpagemap = NULL;
 	}
 }
@@ -1334,6 +1342,7 @@ int drm_gpusvm_range_get_pages(struct drm_gpusvm *gpusvm,
 	int err = 0;
 	struct dev_pagemap *pagemap;
 	struct drm_pagemap *dpagemap;
+	struct drm_gpusvm_range_flags flags;
 
 retry:
 	hmm_range.notifier_seq = mmu_interval_read_begin(notifier);
@@ -1378,7 +1387,8 @@ int drm_gpusvm_range_get_pages(struct drm_gpusvm *gpusvm,
 	 */
 	drm_gpusvm_notifier_lock(gpusvm);
 
-	if (range->flags.unmapped) {
+	flags.__flags = range->flags.__flags;
+	if (flags.unmapped) {
 		drm_gpusvm_notifier_unlock(gpusvm);
 		err = -EFAULT;
 		goto err_free;
@@ -1474,14 +1484,17 @@ int drm_gpusvm_range_get_pages(struct drm_gpusvm *gpusvm,
 		}
 		i += 1 << order;
 		num_dma_mapped = i;
-		range->flags.has_dma_mapping = true;
+		flags.has_dma_mapping = true;
 	}
 
 	if (zdd) {
-		range->flags.has_devmem_pages = true;
+		flags.has_devmem_pages = true;
 		range->dpagemap = dpagemap;
 	}
 
+	/* WRITE_ONCE pairs with READ_ONCE for opportunistic checks */
+	WRITE_ONCE(range->flags.__flags, flags.__flags);
+
 	drm_gpusvm_notifier_unlock(gpusvm);
 	kvfree(pfns);
 set_seqno:
diff --git a/drivers/gpu/drm/xe/xe_module.c b/drivers/gpu/drm/xe/xe_module.c
index 64bf46646544..e4742e27e2cd 100644
--- a/drivers/gpu/drm/xe/xe_module.c
+++ b/drivers/gpu/drm/xe/xe_module.c
@@ -30,9 +30,6 @@ struct xe_modparam xe_modparam = {
 module_param_named(svm_notifier_size, xe_modparam.svm_notifier_size, uint, 0600);
 MODULE_PARM_DESC(svm_notifier_size, "Set the svm notifier size(in MiB), must be power of 2");
 
-module_param_named(always_migrate_to_vram, xe_modparam.always_migrate_to_vram, bool, 0444);
-MODULE_PARM_DESC(always_migrate_to_vram, "Always migrate to VRAM on GPU fault");
-
 module_param_named_unsafe(force_execlist, xe_modparam.force_execlist, bool, 0444);
 MODULE_PARM_DESC(force_execlist, "Force Execlist submission");
 
diff --git a/drivers/gpu/drm/xe/xe_module.h b/drivers/gpu/drm/xe/xe_module.h
index 84339e509c80..5a3bfea8b7b4 100644
--- a/drivers/gpu/drm/xe/xe_module.h
+++ b/drivers/gpu/drm/xe/xe_module.h
@@ -12,7 +12,6 @@
 struct xe_modparam {
 	bool force_execlist;
 	bool probe_display;
-	bool always_migrate_to_vram;
 	u32 force_vram_bar_size;
 	int guc_log_level;
 	char *guc_firmware_path;
diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
index b42cf5d1b20c..b04756a97cdc 100644
--- a/drivers/gpu/drm/xe/xe_pt.c
+++ b/drivers/gpu/drm/xe/xe_pt.c
@@ -2270,11 +2270,19 @@ static void op_commit(struct xe_vm *vm,
 	}
 	case DRM_GPUVA_OP_DRIVER:
 	{
+		/* WRITE_ONCE pairs with READ_ONCE in xe_svm.c */
+
 		if (op->subop == XE_VMA_SUBOP_MAP_RANGE) {
-			op->map_range.range->tile_present |= BIT(tile->id);
-			op->map_range.range->tile_invalidated &= ~BIT(tile->id);
+			WRITE_ONCE(op->map_range.range->tile_present,
+				   op->map_range.range->tile_present |
+				   BIT(tile->id));
+			WRITE_ONCE(op->map_range.range->tile_invalidated,
+				   op->map_range.range->tile_invalidated &
+				   ~BIT(tile->id));
 		} else if (op->subop == XE_VMA_SUBOP_UNMAP_RANGE) {
-			op->unmap_range.range->tile_present &= ~BIT(tile->id);
+			WRITE_ONCE(op->unmap_range.range->tile_present,
+				   op->unmap_range.range->tile_present &
+				   ~BIT(tile->id));
 		}
 		break;
 	}
diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
index d25f02c8d7fc..d8e15259a8df 100644
--- a/drivers/gpu/drm/xe/xe_svm.c
+++ b/drivers/gpu/drm/xe/xe_svm.c
@@ -16,8 +16,17 @@
 
 static bool xe_svm_range_in_vram(struct xe_svm_range *range)
 {
-	/* Not reliable without notifier lock */
-	return range->base.flags.has_devmem_pages;
+	/*
+	 * Advisory only check whether the range is currently backed by VRAM
+	 * memory.
+	 */
+
+	struct drm_gpusvm_range_flags flags = {
+		/* Pairs with WRITE_ONCE in drm_gpusvm.c */
+		.__flags = READ_ONCE(range->base.flags.__flags),
+	};
+
+	return flags.has_devmem_pages;
 }
 
 static bool xe_svm_range_has_vram_binding(struct xe_svm_range *range)
@@ -650,9 +659,16 @@ void xe_svm_fini(struct xe_vm *vm)
 }
 
 static bool xe_svm_range_is_valid(struct xe_svm_range *range,
-				  struct xe_tile *tile)
+				  struct xe_tile *tile,
+				  bool devmem_only)
 {
-	return (range->tile_present & ~range->tile_invalidated) & BIT(tile->id);
+	/*
+	 * Advisory only check whether the range currently has a valid mapping,
+	 * READ_ONCE pairs with WRITE_ONCE in xe_pt.c
+	 */
+	return ((READ_ONCE(range->tile_present) &
+		 ~READ_ONCE(range->tile_invalidated)) & BIT(tile->id)) &&
+		(!devmem_only || xe_svm_range_in_vram(range));
 }
 
 #if IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR)
@@ -726,6 +742,36 @@ static int xe_svm_alloc_vram(struct xe_vm *vm, struct xe_tile *tile,
 }
 #endif
 
+static bool supports_4K_migration(struct xe_device *xe)
+{
+	if (xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K)
+		return false;
+
+	return true;
+}
+
+static bool xe_svm_range_needs_migrate_to_vram(struct xe_svm_range *range,
+					       struct xe_vma *vma)
+{
+	struct xe_vm *vm = range_to_vm(&range->base);
+	u64 range_size = xe_svm_range_size(range);
+
+	if (!range->base.flags.migrate_devmem)
+		return false;
+
+	if (xe_svm_range_in_vram(range)) {
+		drm_dbg(&vm->xe->drm, "Range is already in VRAM\n");
+		return false;
+	}
+
+	if (range_size <= SZ_64K && !supports_4K_migration(vm->xe)) {
+		drm_dbg(&vm->xe->drm, "Platform doesn't support SZ_4K range migration\n");
+		return false;
+	}
+
+	return true;
+}
+
 /**
  * xe_svm_handle_pagefault() - SVM handle page fault
  * @vm: The VM.
@@ -749,12 +795,15 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
 			IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR),
 		.check_pages_threshold = IS_DGFX(vm->xe) &&
 			IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR) ? SZ_64K : 0,
+		.devmem_only = atomic && IS_DGFX(vm->xe) &&
+			IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR),
 	};
 	struct xe_svm_range *range;
 	struct drm_gpusvm_range *r;
 	struct drm_exec exec;
 	struct dma_fence *fence;
 	struct xe_tile *tile = gt_to_tile(gt);
+	int migrate_try_count = ctx.devmem_only ? 3 : 1;
 	ktime_t end = 0;
 	int err;
 
@@ -775,24 +824,30 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
 	if (IS_ERR(r))
 		return PTR_ERR(r);
 
+	if (ctx.devmem_only && !r->flags.migrate_devmem)
+		return -EACCES;
+
 	range = to_xe_range(r);
-	if (xe_svm_range_is_valid(range, tile))
+	if (xe_svm_range_is_valid(range, tile, ctx.devmem_only))
 		return 0;
 
 	range_debug(range, "PAGE FAULT");
 
-	/* XXX: Add migration policy, for now migrate range once */
-	if (!range->skip_migrate && range->base.flags.migrate_devmem &&
-	    xe_svm_range_size(range) >= SZ_64K) {
-		range->skip_migrate = true;
-
+	if (--migrate_try_count >= 0 &&
+	    xe_svm_range_needs_migrate_to_vram(range, vma)) {
 		err = xe_svm_alloc_vram(vm, tile, range, &ctx);
 		if (err) {
-			drm_dbg(&vm->xe->drm,
-				"VRAM allocation failed, falling back to "
-				"retrying fault, asid=%u, errno=%pe\n",
-				vm->usm.asid, ERR_PTR(err));
-			goto retry;
+			if (migrate_try_count || !ctx.devmem_only) {
+				drm_dbg(&vm->xe->drm,
+					"VRAM allocation failed, falling back to retrying fault, asid=%u, errno=%pe\n",
+					vm->usm.asid, ERR_PTR(err));
+				goto retry;
+			} else {
+				drm_err(&vm->xe->drm,
+					"VRAM allocation failed, retry count exceeded, asid=%u, errno=%pe\n",
+					vm->usm.asid, ERR_PTR(err));
+				return err;
+			}
 		}
 	}
 
@@ -800,15 +855,22 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
 	err = drm_gpusvm_range_get_pages(&vm->svm.gpusvm, r, &ctx);
 	/* Corner where CPU mappings have changed */
 	if (err == -EOPNOTSUPP || err == -EFAULT || err == -EPERM) {
-		if (err == -EOPNOTSUPP) {
-			range_debug(range, "PAGE FAULT - EVICT PAGES");
-			drm_gpusvm_range_evict(&vm->svm.gpusvm, &range->base);
+		if (migrate_try_count > 0 || !ctx.devmem_only) {
+			if (err == -EOPNOTSUPP) {
+				range_debug(range, "PAGE FAULT - EVICT PAGES");
+				drm_gpusvm_range_evict(&vm->svm.gpusvm,
+						       &range->base);
+			}
+			drm_dbg(&vm->xe->drm,
+				"Get pages failed, falling back to retrying, asid=%u, gpusvm=%p, errno=%pe\n",
+				vm->usm.asid, &vm->svm.gpusvm, ERR_PTR(err));
+			range_debug(range, "PAGE FAULT - RETRY PAGES");
+			goto retry;
+		} else {
+			drm_err(&vm->xe->drm,
+				"Get pages failed, retry count exceeded, asid=%u, gpusvm=%p, errno=%pe\n",
+				vm->usm.asid, &vm->svm.gpusvm, ERR_PTR(err));
 		}
-		drm_dbg(&vm->xe->drm,
-			"Get pages failed, falling back to retrying, asid=%u, gpusvm=%p, errno=%pe\n",
-			vm->usm.asid, &vm->svm.gpusvm, ERR_PTR(err));
-		range_debug(range, "PAGE FAULT - RETRY PAGES");
-		goto retry;
 	}
 	if (err) {
 		range_debug(range, "PAGE FAULT - FAIL PAGE COLLECT");
@@ -842,9 +904,6 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
 	}
 	drm_exec_fini(&exec);
 
-	if (xe_modparam.always_migrate_to_vram)
-		range->skip_migrate = false;
-
 	dma_fence_wait(fence, false);
 	dma_fence_put(fence);
 
diff --git a/drivers/gpu/drm/xe/xe_svm.h b/drivers/gpu/drm/xe/xe_svm.h
index 2881af1e60b2..30fc78b85b30 100644
--- a/drivers/gpu/drm/xe/xe_svm.h
+++ b/drivers/gpu/drm/xe/xe_svm.h
@@ -39,11 +39,6 @@ struct xe_svm_range {
 	 * range. Protected by GPU SVM notifier lock.
 	 */
 	u8 tile_invalidated;
-	/**
-	 * @skip_migrate: Skip migration to VRAM, protected by GPU fault handler
-	 * locking.
-	 */
-	u8 skip_migrate	:1;
 };
 
 /**
diff --git a/include/drm/drm_gpusvm.h b/include/drm/drm_gpusvm.h
index 9fd25fc880a4..653d48dbe1c1 100644
--- a/include/drm/drm_gpusvm.h
+++ b/include/drm/drm_gpusvm.h
@@ -185,6 +185,31 @@ struct drm_gpusvm_notifier {
 	} flags;
 };
 
+/**
+ * struct drm_gpusvm_range_flags - Structure representing a GPU SVM range flags
+ *
+ * @migrate_devmem: Flag indicating whether the range can be migrated to device memory
+ * @unmapped: Flag indicating if the range has been unmapped
+ * @partial_unmap: Flag indicating if the range has been partially unmapped
+ * @has_devmem_pages: Flag indicating if the range has devmem pages
+ * @has_dma_mapping: Flag indicating if the range has a DMA mapping
+ * @__flags: Flags for range in u16 form (used for READ_ONCE)
+ */
+struct drm_gpusvm_range_flags {
+	union {
+		struct {
+			/* All flags below must be set upon creation */
+			u16 migrate_devmem : 1;
+			/* All flags below must be set / cleared under notifier lock */
+			u16 unmapped : 1;
+			u16 partial_unmap : 1;
+			u16 has_devmem_pages : 1;
+			u16 has_dma_mapping : 1;
+		};
+		u16 __flags;
+	};
+};
+
 /**
  * struct drm_gpusvm_range - Structure representing a GPU SVM range
  *
@@ -198,11 +223,6 @@ struct drm_gpusvm_notifier {
  * @dpagemap: The struct drm_pagemap of the device pages we're dma-mapping.
  *            Note this is assuming only one drm_pagemap per range is allowed.
  * @flags: Flags for range
- * @flags.migrate_devmem: Flag indicating whether the range can be migrated to device memory
- * @flags.unmapped: Flag indicating if the range has been unmapped
- * @flags.partial_unmap: Flag indicating if the range has been partially unmapped
- * @flags.has_devmem_pages: Flag indicating if the range has devmem pages
- * @flags.has_dma_mapping: Flag indicating if the range has a DMA mapping
  *
  * This structure represents a GPU SVM range used for tracking memory ranges
  * mapped in a DRM device.
@@ -216,15 +236,7 @@ struct drm_gpusvm_range {
 	unsigned long notifier_seq;
 	struct drm_pagemap_device_addr *dma_addr;
 	struct drm_pagemap *dpagemap;
-	struct {
-		/* All flags below must be set upon creation */
-		u16 migrate_devmem : 1;
-		/* All flags below must be set / cleared under notifier lock */
-		u16 unmapped : 1;
-		u16 partial_unmap : 1;
-		u16 has_devmem_pages : 1;
-		u16 has_dma_mapping : 1;
-	} flags;
+	struct drm_gpusvm_range_flags flags;
 };
 
 /**
-- 
2.34.1


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

* [PATCH v8 03/20] drm/gpusvm: Add timeslicing support to GPU SVM
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v8 01/20] drm/gpusvm: Introduce devmem_only flag for allocation Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v8 02/20] drm/xe: Strict migration policy for atomic SVM faults Himal Prasad Ghimiray
@ 2025-05-12 16:47 ` Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v8 04/20] drm/xe: Timeslice GPU on atomic SVM fault Himal Prasad Ghimiray
                   ` (23 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, stable, Himal Prasad Ghimiray

From: Matthew Brost <matthew.brost@intel.com>

Add timeslicing support to GPU SVM which will guarantee the GPU a
minimum execution time on piece of physical memory before migration back
to CPU. Intended to implement strict migration policies which require
memory to be in a certain placement for correct execution.

Required for shared CPU and GPU atomics on certain devices.

Fixes: 99624bdff867 ("drm/gpusvm: Add support for GPU Shared Virtual Memory")
Cc: stable@vger.kernel.org
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
---
 drivers/gpu/drm/drm_gpusvm.c | 9 +++++++++
 include/drm/drm_gpusvm.h     | 5 +++++
 2 files changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/drm_gpusvm.c b/drivers/gpu/drm/drm_gpusvm.c
index 41f6616bcf76..4b2f32889f00 100644
--- a/drivers/gpu/drm/drm_gpusvm.c
+++ b/drivers/gpu/drm/drm_gpusvm.c
@@ -1783,6 +1783,8 @@ int drm_gpusvm_migrate_to_devmem(struct drm_gpusvm *gpusvm,
 		goto err_finalize;
 
 	/* Upon success bind devmem allocation to range and zdd */
+	devmem_allocation->timeslice_expiration = get_jiffies_64() +
+		msecs_to_jiffies(ctx->timeslice_ms);
 	zdd->devmem_allocation = devmem_allocation;	/* Owns ref */
 
 err_finalize:
@@ -2003,6 +2005,13 @@ static int __drm_gpusvm_migrate_to_ram(struct vm_area_struct *vas,
 	void *buf;
 	int i, err = 0;
 
+	if (page) {
+		zdd = page->zone_device_data;
+		if (time_before64(get_jiffies_64(),
+				  zdd->devmem_allocation->timeslice_expiration))
+			return 0;
+	}
+
 	start = ALIGN_DOWN(fault_addr, size);
 	end = ALIGN(fault_addr + 1, size);
 
diff --git a/include/drm/drm_gpusvm.h b/include/drm/drm_gpusvm.h
index 653d48dbe1c1..eaf704d3d05e 100644
--- a/include/drm/drm_gpusvm.h
+++ b/include/drm/drm_gpusvm.h
@@ -89,6 +89,7 @@ struct drm_gpusvm_devmem_ops {
  * @ops: Pointer to the operations structure for GPU SVM device memory
  * @dpagemap: The struct drm_pagemap of the pages this allocation belongs to.
  * @size: Size of device memory allocation
+ * @timeslice_expiration: Timeslice expiration in jiffies
  */
 struct drm_gpusvm_devmem {
 	struct device *dev;
@@ -97,6 +98,7 @@ struct drm_gpusvm_devmem {
 	const struct drm_gpusvm_devmem_ops *ops;
 	struct drm_pagemap *dpagemap;
 	size_t size;
+	u64 timeslice_expiration;
 };
 
 /**
@@ -295,6 +297,8 @@ struct drm_gpusvm {
  * @check_pages_threshold: Check CPU pages for present if chunk is less than or
  *                         equal to threshold. If not present, reduce chunk
  *                         size.
+ * @timeslice_ms: The timeslice MS which in minimum time a piece of memory
+ *		  remains with either exclusive GPU or CPU access.
  * @in_notifier: entering from a MMU notifier
  * @read_only: operating on read-only memory
  * @devmem_possible: possible to use device memory
@@ -304,6 +308,7 @@ struct drm_gpusvm {
  */
 struct drm_gpusvm_ctx {
 	unsigned long check_pages_threshold;
+	unsigned long timeslice_ms;
 	unsigned int in_notifier :1;
 	unsigned int read_only :1;
 	unsigned int devmem_possible :1;
-- 
2.34.1


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

* [PATCH v8 04/20] drm/xe: Timeslice GPU on atomic SVM fault
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (2 preceding siblings ...)
  2025-05-12 16:47 ` [PATCH v8 03/20] drm/gpusvm: Add timeslicing support to GPU SVM Himal Prasad Ghimiray
@ 2025-05-12 16:47 ` Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v8 05/20] drm/xe: Add atomic_svm_timeslice_ms debugfs entry Himal Prasad Ghimiray
                   ` (22 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, stable, Himal Prasad Ghimiray

From: Matthew Brost <matthew.brost@intel.com>

Ensure GPU can make forward progress on an atomic SVM GPU fault by
giving the GPU a timeslice of 5ms

v2:
 - Reduce timeslice to 5ms
 - Double timeslice on retry
 - Split out GPU SVM changes into independent patch
v5:
 - Double timeslice in a few more places

Fixes: 2f118c949160 ("drm/xe: Add SVM VRAM migration")
Cc: stable@vger.kernel.org
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
---
 drivers/gpu/drm/xe/xe_svm.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
index d8e15259a8df..d934df622276 100644
--- a/drivers/gpu/drm/xe/xe_svm.c
+++ b/drivers/gpu/drm/xe/xe_svm.c
@@ -797,6 +797,8 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
 			IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR) ? SZ_64K : 0,
 		.devmem_only = atomic && IS_DGFX(vm->xe) &&
 			IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR),
+		.timeslice_ms = atomic && IS_DGFX(vm->xe) &&
+			IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR) ? 5 : 0,
 	};
 	struct xe_svm_range *range;
 	struct drm_gpusvm_range *r;
@@ -836,6 +838,7 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
 	if (--migrate_try_count >= 0 &&
 	    xe_svm_range_needs_migrate_to_vram(range, vma)) {
 		err = xe_svm_alloc_vram(vm, tile, range, &ctx);
+		ctx.timeslice_ms <<= 1;	/* Double timeslice if we have to retry */
 		if (err) {
 			if (migrate_try_count || !ctx.devmem_only) {
 				drm_dbg(&vm->xe->drm,
@@ -855,6 +858,7 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
 	err = drm_gpusvm_range_get_pages(&vm->svm.gpusvm, r, &ctx);
 	/* Corner where CPU mappings have changed */
 	if (err == -EOPNOTSUPP || err == -EFAULT || err == -EPERM) {
+		ctx.timeslice_ms <<= 1;	/* Double timeslice if we have to retry */
 		if (migrate_try_count > 0 || !ctx.devmem_only) {
 			if (err == -EOPNOTSUPP) {
 				range_debug(range, "PAGE FAULT - EVICT PAGES");
@@ -894,6 +898,7 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
 			drm_exec_fini(&exec);
 			err = PTR_ERR(fence);
 			if (err == -EAGAIN) {
+				ctx.timeslice_ms <<= 1;	/* Double timeslice if we have to retry */
 				range_debug(range, "PAGE FAULT - RETRY BIND");
 				goto retry;
 			}
-- 
2.34.1


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

* [PATCH v8 05/20] drm/xe: Add atomic_svm_timeslice_ms debugfs entry
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (3 preceding siblings ...)
  2025-05-12 16:47 ` [PATCH v8 04/20] drm/xe: Timeslice GPU on atomic SVM fault Himal Prasad Ghimiray
@ 2025-05-12 16:47 ` Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v7 06/20] drm/xe: Introduce xe_vma_op_prefetch_range struct for prefetch of ranges Himal Prasad Ghimiray
                   ` (21 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, Himal Prasad Ghimiray

From: Matthew Brost <matthew.brost@intel.com>

Add some informal control for atomic SVM fault GPU timeslice to be able
to play around with values and tweak performance.

v2:
 - Reduce timeslice default value to 5ms

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
---
 drivers/gpu/drm/xe/xe_debugfs.c      | 38 ++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_device.c       |  1 +
 drivers/gpu/drm/xe/xe_device_types.h |  3 +++
 drivers/gpu/drm/xe/xe_svm.c          |  3 ++-
 4 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_debugfs.c b/drivers/gpu/drm/xe/xe_debugfs.c
index d0503959a8ed..d83cd6ed3fa8 100644
--- a/drivers/gpu/drm/xe/xe_debugfs.c
+++ b/drivers/gpu/drm/xe/xe_debugfs.c
@@ -191,6 +191,41 @@ static const struct file_operations wedged_mode_fops = {
 	.write = wedged_mode_set,
 };
 
+static ssize_t atomic_svm_timeslice_ms_show(struct file *f, char __user *ubuf,
+					    size_t size, loff_t *pos)
+{
+	struct xe_device *xe = file_inode(f)->i_private;
+	char buf[32];
+	int len = 0;
+
+	len = scnprintf(buf, sizeof(buf), "%d\n", xe->atomic_svm_timeslice_ms);
+
+	return simple_read_from_buffer(ubuf, size, pos, buf, len);
+}
+
+static ssize_t atomic_svm_timeslice_ms_set(struct file *f,
+					   const char __user *ubuf,
+					   size_t size, loff_t *pos)
+{
+	struct xe_device *xe = file_inode(f)->i_private;
+	u32 atomic_svm_timeslice_ms;
+	ssize_t ret;
+
+	ret = kstrtouint_from_user(ubuf, size, 0, &atomic_svm_timeslice_ms);
+	if (ret)
+		return ret;
+
+	xe->atomic_svm_timeslice_ms = atomic_svm_timeslice_ms;
+
+	return size;
+}
+
+static const struct file_operations atomic_svm_timeslice_ms_fops = {
+	.owner = THIS_MODULE,
+	.read = atomic_svm_timeslice_ms_show,
+	.write = atomic_svm_timeslice_ms_set,
+};
+
 void xe_debugfs_register(struct xe_device *xe)
 {
 	struct ttm_device *bdev = &xe->ttm;
@@ -211,6 +246,9 @@ void xe_debugfs_register(struct xe_device *xe)
 	debugfs_create_file("wedged_mode", 0600, root, xe,
 			    &wedged_mode_fops);
 
+	debugfs_create_file("atomic_svm_timeslice_ms", 0600, root, xe,
+			    &atomic_svm_timeslice_ms_fops);
+
 	for (mem_type = XE_PL_VRAM0; mem_type <= XE_PL_VRAM1; ++mem_type) {
 		man = ttm_manager_type(bdev, mem_type);
 
diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index c02c4c4e9412..f4836808f6e9 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -445,6 +445,7 @@ struct xe_device *xe_device_create(struct pci_dev *pdev,
 	xe->info.devid = pdev->device;
 	xe->info.revid = pdev->revision;
 	xe->info.force_execlist = xe_modparam.force_execlist;
+	xe->atomic_svm_timeslice_ms = 5;
 
 	err = xe_irq_init(xe);
 	if (err)
diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
index 495bc00ebed4..59babadeb9d1 100644
--- a/drivers/gpu/drm/xe/xe_device_types.h
+++ b/drivers/gpu/drm/xe/xe_device_types.h
@@ -571,6 +571,9 @@ struct xe_device {
 	/** @pmu: performance monitoring unit */
 	struct xe_pmu pmu;
 
+	/** @atomic_svm_timeslice_ms: Atomic SVM fault timeslice MS */
+	u32 atomic_svm_timeslice_ms;
+
 #ifdef TEST_VM_OPS_ERROR
 	/**
 	 * @vm_inject_error_position: inject errors at different places in VM
diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
index d934df622276..ab88b4194e57 100644
--- a/drivers/gpu/drm/xe/xe_svm.c
+++ b/drivers/gpu/drm/xe/xe_svm.c
@@ -798,7 +798,8 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
 		.devmem_only = atomic && IS_DGFX(vm->xe) &&
 			IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR),
 		.timeslice_ms = atomic && IS_DGFX(vm->xe) &&
-			IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR) ? 5 : 0,
+			IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR) ?
+			vm->xe->atomic_svm_timeslice_ms : 0,
 	};
 	struct xe_svm_range *range;
 	struct drm_gpusvm_range *r;
-- 
2.34.1


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

* [PATCH v7 06/20] drm/xe: Introduce xe_vma_op_prefetch_range struct for prefetch of ranges
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (4 preceding siblings ...)
  2025-05-12 16:47 ` [PATCH v8 05/20] drm/xe: Add atomic_svm_timeslice_ms debugfs entry Himal Prasad Ghimiray
@ 2025-05-12 16:47 ` Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v7 07/20] drm/xe: Make xe_svm_alloc_vram public Himal Prasad Ghimiray
                   ` (20 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, Himal Prasad Ghimiray

Add xe_vma_op_prefetch_range struct for svm ranges prefetching, including
an xarray of SVM range pointers, range count, and target memory region.

-v2: Fix doc

Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_vm_types.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_vm_types.h b/drivers/gpu/drm/xe/xe_vm_types.h
index 1662604c4486..0afd0296a57e 100644
--- a/drivers/gpu/drm/xe/xe_vm_types.h
+++ b/drivers/gpu/drm/xe/xe_vm_types.h
@@ -374,6 +374,16 @@ struct xe_vma_op_unmap_range {
 	struct xe_svm_range *range;
 };
 
+/** struct xe_vma_op_prefetch_range - VMA prefetch range operation */
+struct xe_vma_op_prefetch_range {
+	/** @range: xarray for SVM ranges data */
+	struct xarray range;
+	/** @ranges_count: number of svm ranges to map */
+	u32 ranges_count;
+	/** @region: memory region to prefetch to */
+	u32 region;
+};
+
 /** enum xe_vma_op_flags - flags for VMA operation */
 enum xe_vma_op_flags {
 	/** @XE_VMA_OP_COMMITTED: VMA operation committed */
@@ -416,6 +426,8 @@ struct xe_vma_op {
 		struct xe_vma_op_map_range map_range;
 		/** @unmap_range: VMA unmap range operation specific data */
 		struct xe_vma_op_unmap_range unmap_range;
+		/** @prefetch_range: VMA prefetch range operation specific data */
+		struct xe_vma_op_prefetch_range prefetch_range;
 	};
 };
 
-- 
2.34.1


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

* [PATCH v7 07/20] drm/xe: Make xe_svm_alloc_vram public
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (5 preceding siblings ...)
  2025-05-12 16:47 ` [PATCH v7 06/20] drm/xe: Introduce xe_vma_op_prefetch_range struct for prefetch of ranges Himal Prasad Ghimiray
@ 2025-05-12 16:47 ` Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v7 08/20] drm/xe/svm: Helper to add tile masks to svm ranges Himal Prasad Ghimiray
                   ` (19 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, Himal Prasad Ghimiray

This function will be used in prefetch too, hence make it public.

v2:
  - Add kernel-doc (Matthew Brost)
  - Rebase

v3:
 - Move CONFIG_DRM_XE_DEVMEM_MIRROR stub out to xe_svm.c (Matthew Brost)

Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_svm.c | 30 ++++++++++++++++++++----------
 drivers/gpu/drm/xe/xe_svm.h | 12 ++++++++++++
 2 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
index ab88b4194e57..875376bddc88 100644
--- a/drivers/gpu/drm/xe/xe_svm.c
+++ b/drivers/gpu/drm/xe/xe_svm.c
@@ -677,9 +677,19 @@ static struct xe_vram_region *tile_to_vr(struct xe_tile *tile)
 	return &tile->mem.vram;
 }
 
-static int xe_svm_alloc_vram(struct xe_vm *vm, struct xe_tile *tile,
-			     struct xe_svm_range *range,
-			     const struct drm_gpusvm_ctx *ctx)
+/**
+ * xe_svm_alloc_vram()- Allocate device memory pages for range,
+ * migrating existing data.
+ * @vm: The VM.
+ * @tile: tile to allocate vram from
+ * @range: SVM range
+ * @ctx: DRM GPU SVM context
+ *
+ * Return: 0 on success, error code on failure.
+ */
+int xe_svm_alloc_vram(struct xe_vm *vm, struct xe_tile *tile,
+		      struct xe_svm_range *range,
+		      const struct drm_gpusvm_ctx *ctx)
 {
 	struct mm_struct *mm = vm->svm.gpusvm.mm;
 	struct xe_vram_region *vr = tile_to_vr(tile);
@@ -733,13 +743,6 @@ static int xe_svm_alloc_vram(struct xe_vm *vm, struct xe_tile *tile,
 
 	return err;
 }
-#else
-static int xe_svm_alloc_vram(struct xe_vm *vm, struct xe_tile *tile,
-			     struct xe_svm_range *range,
-			     const struct drm_gpusvm_ctx *ctx)
-{
-	return -EOPNOTSUPP;
-}
 #endif
 
 static bool supports_4K_migration(struct xe_device *xe)
@@ -1025,6 +1028,13 @@ int xe_devm_add(struct xe_tile *tile, struct xe_vram_region *vr)
 	return 0;
 }
 #else
+int xe_svm_alloc_vram(struct xe_vm *vm, struct xe_tile *tile,
+		      struct xe_svm_range *range,
+		      const struct drm_gpusvm_ctx *ctx)
+{
+	return -EOPNOTSUPP;
+}
+
 int xe_devm_add(struct xe_tile *tile, struct xe_vram_region *vr)
 {
 	return 0;
diff --git a/drivers/gpu/drm/xe/xe_svm.h b/drivers/gpu/drm/xe/xe_svm.h
index 30fc78b85b30..36e245ec6422 100644
--- a/drivers/gpu/drm/xe/xe_svm.h
+++ b/drivers/gpu/drm/xe/xe_svm.h
@@ -70,6 +70,9 @@ int xe_svm_bo_evict(struct xe_bo *bo);
 
 void xe_svm_range_debug(struct xe_svm_range *range, const char *operation);
 
+int xe_svm_alloc_vram(struct xe_vm *vm, struct xe_tile *tile,
+		      struct xe_svm_range *range,
+		      const struct drm_gpusvm_ctx *ctx);
 /**
  * xe_svm_range_has_dma_mapping() - SVM range has DMA mapping
  * @range: SVM range
@@ -97,6 +100,7 @@ void xe_svm_flush(struct xe_vm *vm);
 #include <linux/interval_tree.h>
 
 struct drm_pagemap_device_addr;
+struct drm_gpusvm_ctx;
 struct xe_bo;
 struct xe_gt;
 struct xe_vm;
@@ -167,6 +171,14 @@ void xe_svm_range_debug(struct xe_svm_range *range, const char *operation)
 {
 }
 
+static inline
+int xe_svm_alloc_vram(struct xe_vm *vm, struct xe_tile *tile,
+		      struct xe_svm_range *range,
+		      const struct drm_gpusvm_ctx *ctx)
+{
+	return -EOPNOTSUPP;
+}
+
 #define xe_svm_assert_in_notifier(...) do {} while (0)
 #define xe_svm_range_has_dma_mapping(...) false
 
-- 
2.34.1


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

* [PATCH v7 08/20] drm/xe/svm: Helper to add tile masks to svm ranges
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (6 preceding siblings ...)
  2025-05-12 16:47 ` [PATCH v7 07/20] drm/xe: Make xe_svm_alloc_vram public Himal Prasad Ghimiray
@ 2025-05-12 16:47 ` Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v7 09/20] drm/xe/svm: Make to_xe_range a public function Himal Prasad Ghimiray
                   ` (18 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, Himal Prasad Ghimiray

Introduce a helper to add tile mask of binding present and invalidated
for the range. Add a lockdep_assert to ensure it is protected by GPU SVM
notifier lock.

-v7
rebased

Suggested-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_pt.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
index b04756a97cdc..4d248d06bfa5 100644
--- a/drivers/gpu/drm/xe/xe_pt.c
+++ b/drivers/gpu/drm/xe/xe_pt.c
@@ -2216,6 +2216,18 @@ static void unbind_op_commit(struct xe_vm *vm, struct xe_tile *tile,
 	}
 }
 
+static void range_present_and_invalidated_tile(struct xe_vm *vm,
+					       struct xe_svm_range *range,
+					       u8 tile_id)
+{
+	/* WRITE_ONCE pairs with READ_ONCE in xe_svm.c */
+
+	lockdep_assert_held(&vm->svm.gpusvm.notifier_lock);
+
+	WRITE_ONCE(range->tile_present, range->tile_present | BIT(tile_id));
+	WRITE_ONCE(range->tile_invalidated, range->tile_invalidated & ~BIT(tile_id));
+}
+
 static void op_commit(struct xe_vm *vm,
 		      struct xe_tile *tile,
 		      struct xe_vm_pgtable_update_ops *pt_update_ops,
@@ -2271,19 +2283,13 @@ static void op_commit(struct xe_vm *vm,
 	case DRM_GPUVA_OP_DRIVER:
 	{
 		/* WRITE_ONCE pairs with READ_ONCE in xe_svm.c */
-
-		if (op->subop == XE_VMA_SUBOP_MAP_RANGE) {
-			WRITE_ONCE(op->map_range.range->tile_present,
-				   op->map_range.range->tile_present |
-				   BIT(tile->id));
-			WRITE_ONCE(op->map_range.range->tile_invalidated,
-				   op->map_range.range->tile_invalidated &
-				   ~BIT(tile->id));
-		} else if (op->subop == XE_VMA_SUBOP_UNMAP_RANGE) {
+		if (op->subop == XE_VMA_SUBOP_MAP_RANGE)
+			range_present_and_invalidated_tile(vm, op->map_range.range, tile->id);
+		else if (op->subop == XE_VMA_SUBOP_UNMAP_RANGE)
 			WRITE_ONCE(op->unmap_range.range->tile_present,
 				   op->unmap_range.range->tile_present &
 				   ~BIT(tile->id));
-		}
+
 		break;
 	}
 	default:
-- 
2.34.1


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

* [PATCH v7 09/20] drm/xe/svm: Make to_xe_range a public function
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (7 preceding siblings ...)
  2025-05-12 16:47 ` [PATCH v7 08/20] drm/xe/svm: Helper to add tile masks to svm ranges Himal Prasad Ghimiray
@ 2025-05-12 16:47 ` Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v7 10/20] drm/xe/svm: Make xe_svm_range_* end/start/size public Himal Prasad Ghimiray
                   ` (17 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, Himal Prasad Ghimiray

The to_xe_range function will be used in other files. Therefore, make it
public and add kernel-doc documentation

Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_svm.c |  5 -----
 drivers/gpu/drm/xe/xe_svm.h | 20 ++++++++++++++++++++
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
index 875376bddc88..77740730e821 100644
--- a/drivers/gpu/drm/xe/xe_svm.c
+++ b/drivers/gpu/drm/xe/xe_svm.c
@@ -103,11 +103,6 @@ static void xe_svm_range_free(struct drm_gpusvm_range *range)
 	kfree(range);
 }
 
-static struct xe_svm_range *to_xe_range(struct drm_gpusvm_range *r)
-{
-	return container_of(r, struct xe_svm_range, base);
-}
-
 static void
 xe_svm_garbage_collector_add_range(struct xe_vm *vm, struct xe_svm_range *range,
 				   const struct mmu_notifier_range *mmu_range)
diff --git a/drivers/gpu/drm/xe/xe_svm.h b/drivers/gpu/drm/xe/xe_svm.h
index 36e245ec6422..e9257f0b3ffc 100644
--- a/drivers/gpu/drm/xe/xe_svm.h
+++ b/drivers/gpu/drm/xe/xe_svm.h
@@ -85,6 +85,20 @@ static inline bool xe_svm_range_has_dma_mapping(struct xe_svm_range *range)
 	return range->base.flags.has_dma_mapping;
 }
 
+/**
+ * to_xe_range - Convert a drm_gpusvm_range pointer to a xe_svm_range
+ * @r: Pointer to the drm_gpusvm_range structure
+ *
+ * This function takes a pointer to a drm_gpusvm_range structure and
+ * converts it to a pointer to the containing xe_svm_range structure.
+ *
+ * Return: Pointer to the xe_svm_range structure
+ */
+static inline struct xe_svm_range *to_xe_range(struct drm_gpusvm_range *r)
+{
+	return container_of(r, struct xe_svm_range, base);
+}
+
 #define xe_svm_assert_in_notifier(vm__) \
 	lockdep_assert_held_write(&(vm__)->svm.gpusvm.notifier_lock)
 
@@ -101,6 +115,7 @@ void xe_svm_flush(struct xe_vm *vm);
 
 struct drm_pagemap_device_addr;
 struct drm_gpusvm_ctx;
+struct drm_gpusvm_range;
 struct xe_bo;
 struct xe_gt;
 struct xe_vm;
@@ -179,6 +194,11 @@ int xe_svm_alloc_vram(struct xe_vm *vm, struct xe_tile *tile,
 	return -EOPNOTSUPP;
 }
 
+static inline struct xe_svm_range *to_xe_range(struct drm_gpusvm_range *r)
+{
+	return NULL;
+}
+
 #define xe_svm_assert_in_notifier(...) do {} while (0)
 #define xe_svm_range_has_dma_mapping(...) false
 
-- 
2.34.1


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

* [PATCH v7 10/20] drm/xe/svm: Make xe_svm_range_* end/start/size public
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (8 preceding siblings ...)
  2025-05-12 16:47 ` [PATCH v7 09/20] drm/xe/svm: Make to_xe_range a public function Himal Prasad Ghimiray
@ 2025-05-12 16:47 ` Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v7 11/20] drm/xe/vm: Update xe_vma_ops_incr_pt_update_ops to take an increment value Himal Prasad Ghimiray
                   ` (16 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, Himal Prasad Ghimiray

These functions will be used in prefetch too, therefore make them public.

v2
  - Fix kernel doc

Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_svm.c | 15 ------------
 drivers/gpu/drm/xe/xe_svm.h | 48 +++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
index 77740730e821..6cfe92b8adbe 100644
--- a/drivers/gpu/drm/xe/xe_svm.c
+++ b/drivers/gpu/drm/xe/xe_svm.c
@@ -45,21 +45,6 @@ static struct xe_vm *range_to_vm(struct drm_gpusvm_range *r)
 	return gpusvm_to_vm(r->gpusvm);
 }
 
-static unsigned long xe_svm_range_start(struct xe_svm_range *range)
-{
-	return drm_gpusvm_range_start(&range->base);
-}
-
-static unsigned long xe_svm_range_end(struct xe_svm_range *range)
-{
-	return drm_gpusvm_range_end(&range->base);
-}
-
-static unsigned long xe_svm_range_size(struct xe_svm_range *range)
-{
-	return drm_gpusvm_range_size(&range->base);
-}
-
 #define range_debug(r__, operaton__)					\
 	vm_dbg(&range_to_vm(&(r__)->base)->xe->drm,			\
 	       "%s: asid=%u, gpusvm=%p, vram=%d,%d, seqno=%lu, " \
diff --git a/drivers/gpu/drm/xe/xe_svm.h b/drivers/gpu/drm/xe/xe_svm.h
index e9257f0b3ffc..a69bbdc73608 100644
--- a/drivers/gpu/drm/xe/xe_svm.h
+++ b/drivers/gpu/drm/xe/xe_svm.h
@@ -99,6 +99,39 @@ static inline struct xe_svm_range *to_xe_range(struct drm_gpusvm_range *r)
 	return container_of(r, struct xe_svm_range, base);
 }
 
+/**
+ * xe_svm_range_start() - SVM range start address
+ * @range: SVM range
+ *
+ * Return: start address of range.
+ */
+static inline unsigned long xe_svm_range_start(struct xe_svm_range *range)
+{
+	return drm_gpusvm_range_start(&range->base);
+}
+
+/**
+ * xe_svm_range_end() - SVM range end address
+ * @range: SVM range
+ *
+ * Return: end address of range.
+ */
+static inline unsigned long xe_svm_range_end(struct xe_svm_range *range)
+{
+	return drm_gpusvm_range_end(&range->base);
+}
+
+/**
+ * xe_svm_range_size() - SVM range size
+ * @range: SVM range
+ *
+ * Return: Size of range.
+ */
+static inline unsigned long xe_svm_range_size(struct xe_svm_range *range)
+{
+	return drm_gpusvm_range_size(&range->base);
+}
+
 #define xe_svm_assert_in_notifier(vm__) \
 	lockdep_assert_held_write(&(vm__)->svm.gpusvm.notifier_lock)
 
@@ -199,6 +232,21 @@ static inline struct xe_svm_range *to_xe_range(struct drm_gpusvm_range *r)
 	return NULL;
 }
 
+static inline unsigned long xe_svm_range_start(struct xe_svm_range *range)
+{
+	return 0;
+}
+
+static inline unsigned long xe_svm_range_end(struct xe_svm_range *range)
+{
+	return 0;
+}
+
+static inline unsigned long xe_svm_range_size(struct xe_svm_range *range)
+{
+	return 0;
+}
+
 #define xe_svm_assert_in_notifier(...) do {} while (0)
 #define xe_svm_range_has_dma_mapping(...) false
 
-- 
2.34.1


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

* [PATCH v7 11/20] drm/xe/vm: Update xe_vma_ops_incr_pt_update_ops to take an increment value
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (9 preceding siblings ...)
  2025-05-12 16:47 ` [PATCH v7 10/20] drm/xe/svm: Make xe_svm_range_* end/start/size public Himal Prasad Ghimiray
@ 2025-05-12 16:47 ` Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v7 12/20] drm/xe/vm: Add an identifier in xe_vma_ops for svm prefetch Himal Prasad Ghimiray
                   ` (15 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, Himal Prasad Ghimiray

Prefetch for SVM ranges can have more than one operation to increment,
hence modify the function to accept an increment value as input.

v2:
  - Call xe_vma_ops_incr_pt_update_ops only once for REMAP (Matthew Brost)
  - Add check for 0 ops

v3:
  - s/u8/int for inc_val and num_remap_ops (Matthew Brost)

Suggested-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_vm.c | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index 79323c78130f..f4382386b34c 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -806,13 +806,16 @@ static void xe_vma_ops_fini(struct xe_vma_ops *vops)
 		kfree(vops->pt_update_ops[i].ops);
 }
 
-static void xe_vma_ops_incr_pt_update_ops(struct xe_vma_ops *vops, u8 tile_mask)
+static void xe_vma_ops_incr_pt_update_ops(struct xe_vma_ops *vops, u8 tile_mask, int inc_val)
 {
 	int i;
 
+	if (!inc_val)
+		return;
+
 	for (i = 0; i < XE_MAX_TILES_PER_DEVICE; ++i)
 		if (BIT(i) & tile_mask)
-			++vops->pt_update_ops[i].num_ops;
+			vops->pt_update_ops[i].num_ops += inc_val;
 }
 
 static void xe_vm_populate_rebind(struct xe_vma_op *op, struct xe_vma *vma,
@@ -842,7 +845,7 @@ static int xe_vm_ops_add_rebind(struct xe_vma_ops *vops, struct xe_vma *vma,
 
 	xe_vm_populate_rebind(op, vma, tile_mask);
 	list_add_tail(&op->link, &vops->list);
-	xe_vma_ops_incr_pt_update_ops(vops, tile_mask);
+	xe_vma_ops_incr_pt_update_ops(vops, tile_mask, 1);
 
 	return 0;
 }
@@ -977,7 +980,7 @@ xe_vm_ops_add_range_rebind(struct xe_vma_ops *vops,
 
 	xe_vm_populate_range_rebind(op, vma, range, tile_mask);
 	list_add_tail(&op->link, &vops->list);
-	xe_vma_ops_incr_pt_update_ops(vops, tile_mask);
+	xe_vma_ops_incr_pt_update_ops(vops, tile_mask, 1);
 
 	return 0;
 }
@@ -1062,7 +1065,7 @@ xe_vm_ops_add_range_unbind(struct xe_vma_ops *vops,
 
 	xe_vm_populate_range_unbind(op, range);
 	list_add_tail(&op->link, &vops->list);
-	xe_vma_ops_incr_pt_update_ops(vops, range->tile_present);
+	xe_vma_ops_incr_pt_update_ops(vops, range->tile_present, 1);
 
 	return 0;
 }
@@ -2493,7 +2496,7 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct drm_gpuva_ops *ops,
 			     !op->map.is_cpu_addr_mirror) ||
 			    op->map.invalidate_on_bind)
 				xe_vma_ops_incr_pt_update_ops(vops,
-							      op->tile_mask);
+							      op->tile_mask, 1);
 			break;
 		}
 		case DRM_GPUVA_OP_REMAP:
@@ -2502,6 +2505,7 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct drm_gpuva_ops *ops,
 				gpuva_to_vma(op->base.remap.unmap->va);
 			bool skip = xe_vma_is_cpu_addr_mirror(old);
 			u64 start = xe_vma_start(old), end = xe_vma_end(old);
+			int num_remap_ops = 0;
 
 			if (op->base.remap.prev)
 				start = op->base.remap.prev->va.addr +
@@ -2554,7 +2558,7 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct drm_gpuva_ops *ops,
 					       (ULL)op->remap.start,
 					       (ULL)op->remap.range);
 				} else {
-					xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask);
+					num_remap_ops++;
 				}
 			}
 
@@ -2583,11 +2587,13 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct drm_gpuva_ops *ops,
 					       (ULL)op->remap.start,
 					       (ULL)op->remap.range);
 				} else {
-					xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask);
+					num_remap_ops++;
 				}
 			}
 			if (!skip)
-				xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask);
+				num_remap_ops++;
+
+			xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask, num_remap_ops);
 			break;
 		}
 		case DRM_GPUVA_OP_UNMAP:
@@ -2599,7 +2605,7 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct drm_gpuva_ops *ops,
 				return -EBUSY;
 
 			if (!xe_vma_is_cpu_addr_mirror(vma))
-				xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask);
+				xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask, 1);
 			break;
 		case DRM_GPUVA_OP_PREFETCH:
 			vma = gpuva_to_vma(op->base.prefetch.va);
@@ -2611,7 +2617,7 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct drm_gpuva_ops *ops,
 			}
 
 			if (!xe_vma_is_cpu_addr_mirror(vma))
-				xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask);
+				xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask, 1);
 			break;
 		default:
 			drm_warn(&vm->xe->drm, "NOT POSSIBLE");
-- 
2.34.1


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

* [PATCH v7 12/20] drm/xe/vm: Add an identifier in xe_vma_ops for svm prefetch
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (10 preceding siblings ...)
  2025-05-12 16:47 ` [PATCH v7 11/20] drm/xe/vm: Update xe_vma_ops_incr_pt_update_ops to take an increment value Himal Prasad Ghimiray
@ 2025-05-12 16:47 ` Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v7 13/20] drm/xe: Rename lookup_vma function to xe_find_vma_by_addr Himal Prasad Ghimiray
                   ` (14 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, Himal Prasad Ghimiray

Add a flag in xe_vma_ops to determine whether it has svm prefetch ops or
not.

v2:
 - s/false/0 (Matthew Brost)

v3:
 - s/XE_VMA_OPS_HAS_SVM_PREFETCH/XE_VMA_OPS_FLAG_HAS_SVM_PREFETCH

Suggested-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_vm.c       | 1 +
 drivers/gpu/drm/xe/xe_vm_types.h | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index f4382386b34c..21564ecf8765 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -3240,6 +3240,7 @@ static void xe_vma_ops_init(struct xe_vma_ops *vops, struct xe_vm *vm,
 	vops->q = q;
 	vops->syncs = syncs;
 	vops->num_syncs = num_syncs;
+	vops->flags = 0;
 }
 
 static int xe_vm_bind_ioctl_validate_bo(struct xe_device *xe, struct xe_bo *bo,
diff --git a/drivers/gpu/drm/xe/xe_vm_types.h b/drivers/gpu/drm/xe/xe_vm_types.h
index 0afd0296a57e..bfc145baad49 100644
--- a/drivers/gpu/drm/xe/xe_vm_types.h
+++ b/drivers/gpu/drm/xe/xe_vm_types.h
@@ -445,6 +445,9 @@ struct xe_vma_ops {
 	u32 num_syncs;
 	/** @pt_update_ops: page table update operations */
 	struct xe_vm_pgtable_update_ops pt_update_ops[XE_MAX_TILES_PER_DEVICE];
+	/** @flag: signify the properties within xe_vma_ops*/
+#define XE_VMA_OPS_FLAG_HAS_SVM_PREFETCH BIT(0)
+	u32 flags;
 #ifdef TEST_VM_OPS_ERROR
 	/** @inject_error: inject error to test error handling */
 	bool inject_error;
-- 
2.34.1


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

* [PATCH v7 13/20] drm/xe: Rename lookup_vma function to xe_find_vma_by_addr
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (11 preceding siblings ...)
  2025-05-12 16:47 ` [PATCH v7 12/20] drm/xe/vm: Add an identifier in xe_vma_ops for svm prefetch Himal Prasad Ghimiray
@ 2025-05-12 16:47 ` Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v7 14/20] drm/xe/svm: Refactor usage of drm_gpusvm* function in xe_svm Himal Prasad Ghimiray
                   ` (13 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, Himal Prasad Ghimiray

This update renames the lookup_vma function to xe_vm_find_vma_by_addr and
makes it accessible externally. The function, which looks up a VMA by
its address within a specified VM, will be utilized in upcoming patches.

v2
 - Fix doc

Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_gt_pagefault.c | 24 +----------------------
 drivers/gpu/drm/xe/xe_vm.c           | 29 ++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_vm.h           |  2 ++
 3 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_gt_pagefault.c b/drivers/gpu/drm/xe/xe_gt_pagefault.c
index 10622ca471a2..7a8f87709e39 100644
--- a/drivers/gpu/drm/xe/xe_gt_pagefault.c
+++ b/drivers/gpu/drm/xe/xe_gt_pagefault.c
@@ -72,28 +72,6 @@ static bool vma_is_valid(struct xe_tile *tile, struct xe_vma *vma)
 		!(BIT(tile->id) & vma->tile_invalidated);
 }
 
-static bool vma_matches(struct xe_vma *vma, u64 page_addr)
-{
-	if (page_addr > xe_vma_end(vma) - 1 ||
-	    page_addr + SZ_4K - 1 < xe_vma_start(vma))
-		return false;
-
-	return true;
-}
-
-static struct xe_vma *lookup_vma(struct xe_vm *vm, u64 page_addr)
-{
-	struct xe_vma *vma = NULL;
-
-	if (vm->usm.last_fault_vma) {   /* Fast lookup */
-		if (vma_matches(vm->usm.last_fault_vma, page_addr))
-			vma = vm->usm.last_fault_vma;
-	}
-	if (!vma)
-		vma = xe_vm_find_overlapping_vma(vm, page_addr, SZ_4K);
-
-	return vma;
-}
 
 static int xe_pf_begin(struct drm_exec *exec, struct xe_vma *vma,
 		       bool atomic, unsigned int id)
@@ -231,7 +209,7 @@ static int handle_pagefault(struct xe_gt *gt, struct pagefault *pf)
 		goto unlock_vm;
 	}
 
-	vma = lookup_vma(vm, pf->page_addr);
+	vma = xe_vm_find_vma_by_addr(vm, pf->page_addr);
 	if (!vma) {
 		err = -EINVAL;
 		goto unlock_vm;
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index 21564ecf8765..cb79a37d2132 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -2139,6 +2139,35 @@ int xe_vm_destroy_ioctl(struct drm_device *dev, void *data,
 	return err;
 }
 
+static bool vma_matches(struct xe_vma *vma, u64 page_addr)
+{
+	if (page_addr > xe_vma_end(vma) - 1 ||
+	    page_addr + SZ_4K - 1 < xe_vma_start(vma))
+		return false;
+
+	return true;
+}
+
+/**
+ * xe_vm_find_vma_by_addr() - Find a VMA by its address
+ *
+ * @vm: the xe_vm the vma belongs to
+ * @page_addr: address to look up
+ */
+struct xe_vma *xe_vm_find_vma_by_addr(struct xe_vm *vm, u64 page_addr)
+{
+	struct xe_vma *vma = NULL;
+
+	if (vm->usm.last_fault_vma) {   /* Fast lookup */
+		if (vma_matches(vm->usm.last_fault_vma, page_addr))
+			vma = vm->usm.last_fault_vma;
+	}
+	if (!vma)
+		vma = xe_vm_find_overlapping_vma(vm, page_addr, SZ_4K);
+
+	return vma;
+}
+
 static const u32 region_to_mem_type[] = {
 	XE_PL_TT,
 	XE_PL_VRAM0,
diff --git a/drivers/gpu/drm/xe/xe_vm.h b/drivers/gpu/drm/xe/xe_vm.h
index 0ef811fc2bde..99e164852f63 100644
--- a/drivers/gpu/drm/xe/xe_vm.h
+++ b/drivers/gpu/drm/xe/xe_vm.h
@@ -169,6 +169,8 @@ static inline bool xe_vma_is_userptr(struct xe_vma *vma)
 		!xe_vma_is_cpu_addr_mirror(vma);
 }
 
+struct xe_vma *xe_vm_find_vma_by_addr(struct xe_vm *vm, u64 page_addr);
+
 /**
  * to_userptr_vma() - Return a pointer to an embedding userptr vma
  * @vma: Pointer to the embedded struct xe_vma
-- 
2.34.1


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

* [PATCH v7 14/20] drm/xe/svm: Refactor usage of drm_gpusvm* function in xe_svm
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (12 preceding siblings ...)
  2025-05-12 16:47 ` [PATCH v7 13/20] drm/xe: Rename lookup_vma function to xe_find_vma_by_addr Himal Prasad Ghimiray
@ 2025-05-12 16:47 ` Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v7 15/20] drm/xe/svm: Make xe_svm_range_needs_migrate_to_vram() public Himal Prasad Ghimiray
                   ` (12 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, Himal Prasad Ghimiray

Define xe_svm_range_find_or_insert function wrapping
drm_gpusvm_range_find_or_insert for reusing in prefetch.

Define xe_svm_range_get_pages function wrapping
drm_gpusvm_range_get_pages for reusing in prefetch.

-v2 pass pagefault defined drm_gpu_svm context as parameter
in xe_svm_range_find_or_insert(Matthew Brost)

Cc: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_svm.c | 65 ++++++++++++++++++++++++++++++++-----
 drivers/gpu/drm/xe/xe_svm.h | 21 ++++++++++++
 2 files changed, 77 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
index 6cfe92b8adbe..6e593733d473 100644
--- a/drivers/gpu/drm/xe/xe_svm.c
+++ b/drivers/gpu/drm/xe/xe_svm.c
@@ -785,7 +785,6 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
 			vm->xe->atomic_svm_timeslice_ms : 0,
 	};
 	struct xe_svm_range *range;
-	struct drm_gpusvm_range *r;
 	struct drm_exec exec;
 	struct dma_fence *fence;
 	struct xe_tile *tile = gt_to_tile(gt);
@@ -804,16 +803,14 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
 	if (err)
 		return err;
 
-	r = drm_gpusvm_range_find_or_insert(&vm->svm.gpusvm, fault_addr,
-					    xe_vma_start(vma), xe_vma_end(vma),
-					    &ctx);
-	if (IS_ERR(r))
-		return PTR_ERR(r);
+	range = xe_svm_range_find_or_insert(vm, fault_addr, vma, &ctx);
 
-	if (ctx.devmem_only && !r->flags.migrate_devmem)
+	if (IS_ERR(range))
+		return PTR_ERR(range);
+
+	if (ctx.devmem_only && !range->base.flags.migrate_devmem)
 		return -EACCES;
 
-	range = to_xe_range(r);
 	if (xe_svm_range_is_valid(range, tile, ctx.devmem_only))
 		return 0;
 
@@ -839,7 +836,7 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
 	}
 
 	range_debug(range, "GET PAGES");
-	err = drm_gpusvm_range_get_pages(&vm->svm.gpusvm, r, &ctx);
+	err = xe_svm_range_get_pages(vm, range, &ctx);
 	/* Corner where CPU mappings have changed */
 	if (err == -EOPNOTSUPP || err == -EFAULT || err == -EPERM) {
 		ctx.timeslice_ms <<= 1;	/* Double timeslice if we have to retry */
@@ -930,6 +927,56 @@ int xe_svm_bo_evict(struct xe_bo *bo)
 	return drm_gpusvm_evict_to_ram(&bo->devmem_allocation);
 }
 
+/**
+ * xe_svm_range_find_or_insert- Find or insert GPU SVM range
+ * @vm: xe_vm pointer
+ * @addr: address for which range needs to be found/inserted
+ * @vma:  Pointer to struct xe_vma which mirrors CPU
+ * @ctx: GPU SVM context
+ *
+ * This function finds or inserts a newly allocated a SVM range based on the
+ * address.
+ *
+ * Return: Pointer to the SVM range on success, ERR_PTR() on failure.
+ */
+struct xe_svm_range *xe_svm_range_find_or_insert(struct xe_vm *vm, u64 addr,
+						 struct xe_vma *vma, struct drm_gpusvm_ctx *ctx)
+{
+	struct drm_gpusvm_range *r;
+
+	r = drm_gpusvm_range_find_or_insert(&vm->svm.gpusvm, max(addr, xe_vma_start(vma)),
+					    xe_vma_start(vma), xe_vma_end(vma), ctx);
+	if (IS_ERR(r))
+		return ERR_PTR(PTR_ERR(r));
+
+	return to_xe_range(r);
+}
+
+/**
+ * xe_svm_range_get_pages() - Get pages for a SVM range
+ * @vm: Pointer to the struct xe_vm
+ * @range: Pointer to the xe SVM range structure
+ * @ctx: GPU SVM context
+ *
+ * This function gets pages for a SVM range and ensures they are mapped for
+ * DMA access. In case of failure with -EOPNOTSUPP, it evicts the range.
+ *
+ * Return: 0 on success, negative error code on failure.
+ */
+int xe_svm_range_get_pages(struct xe_vm *vm, struct xe_svm_range *range,
+			   struct drm_gpusvm_ctx *ctx)
+{
+	int err = 0;
+
+	err = drm_gpusvm_range_get_pages(&vm->svm.gpusvm, &range->base, ctx);
+	if (err == -EOPNOTSUPP) {
+		range_debug(range, "PAGE FAULT - EVICT PAGES");
+		drm_gpusvm_range_evict(&vm->svm.gpusvm, &range->base);
+	}
+
+	return err;
+}
+
 #if IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR)
 
 static struct drm_pagemap_device_addr
diff --git a/drivers/gpu/drm/xe/xe_svm.h b/drivers/gpu/drm/xe/xe_svm.h
index a69bbdc73608..e304d147d309 100644
--- a/drivers/gpu/drm/xe/xe_svm.h
+++ b/drivers/gpu/drm/xe/xe_svm.h
@@ -73,6 +73,13 @@ void xe_svm_range_debug(struct xe_svm_range *range, const char *operation);
 int xe_svm_alloc_vram(struct xe_vm *vm, struct xe_tile *tile,
 		      struct xe_svm_range *range,
 		      const struct drm_gpusvm_ctx *ctx);
+
+struct xe_svm_range *xe_svm_range_find_or_insert(struct xe_vm *vm, u64 addr,
+						 struct xe_vma *vma, struct drm_gpusvm_ctx *ctx);
+
+int xe_svm_range_get_pages(struct xe_vm *vm, struct xe_svm_range *range,
+			   struct drm_gpusvm_ctx *ctx);
+
 /**
  * xe_svm_range_has_dma_mapping() - SVM range has DMA mapping
  * @range: SVM range
@@ -227,6 +234,20 @@ int xe_svm_alloc_vram(struct xe_vm *vm, struct xe_tile *tile,
 	return -EOPNOTSUPP;
 }
 
+static inline
+struct xe_svm_range *xe_svm_range_find_or_insert(struct xe_vm *vm, u64 addr,
+						 struct xe_vma *vma, struct drm_gpusvm_ctx *ctx)
+{
+	return ERR_PTR(-EINVAL);
+}
+
+static inline
+int xe_svm_range_get_pages(struct xe_vm *vm, struct xe_svm_range *range,
+			   struct drm_gpusvm_ctx *ctx)
+{
+	return -EINVAL;
+}
+
 static inline struct xe_svm_range *to_xe_range(struct drm_gpusvm_range *r)
 {
 	return NULL;
-- 
2.34.1


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

* [PATCH v7 15/20] drm/xe/svm: Make xe_svm_range_needs_migrate_to_vram() public
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (13 preceding siblings ...)
  2025-05-12 16:47 ` [PATCH v7 14/20] drm/xe/svm: Refactor usage of drm_gpusvm* function in xe_svm Himal Prasad Ghimiray
@ 2025-05-12 16:47 ` Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v7 16/20] drm/xe/svm: Add xe_svm_range_validate() and xe_svm_range_migrate_to_smem() Himal Prasad Ghimiray
                   ` (11 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, Himal Prasad Ghimiray

xe_svm_range_needs_migrate_to_vram() determines whether range needs
migration to vram or not, modify it to accept region preference parameter
too, so we can use it in prefetch too.

v2
- add assert instead of warn (Matthew Brost)

Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_svm.c | 26 ++++++++++++++++++--------
 drivers/gpu/drm/xe/xe_svm.h | 10 ++++++++++
 2 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
index 6e593733d473..c6505350c8ff 100644
--- a/drivers/gpu/drm/xe/xe_svm.c
+++ b/drivers/gpu/drm/xe/xe_svm.c
@@ -733,22 +733,32 @@ static bool supports_4K_migration(struct xe_device *xe)
 	return true;
 }
 
-static bool xe_svm_range_needs_migrate_to_vram(struct xe_svm_range *range,
-					       struct xe_vma *vma)
+/**
+ * xe_svm_range_needs_migrate_to_vram() - SVM range needs migrate to VRAM or not
+ * @range: SVM range for which migration needs to be decided
+ * @vma: vma which has range
+ * @preferred_region_is_vram: preferred region for range is vram
+ *
+ * Return: True for range needing migration and migration is supported else false
+ */
+bool xe_svm_range_needs_migrate_to_vram(struct xe_svm_range *range, struct xe_vma *vma,
+					bool preferred_region_is_vram)
 {
 	struct xe_vm *vm = range_to_vm(&range->base);
 	u64 range_size = xe_svm_range_size(range);
 
-	if (!range->base.flags.migrate_devmem)
+	if (!range->base.flags.migrate_devmem || !preferred_region_is_vram)
 		return false;
 
-	if (xe_svm_range_in_vram(range)) {
-		drm_dbg(&vm->xe->drm, "Range is already in VRAM\n");
+	xe_assert(vm->xe, IS_DGFX(vm->xe));
+
+	if (preferred_region_is_vram && xe_svm_range_in_vram(range)) {
+		drm_info(&vm->xe->drm, "Range is already in VRAM\n");
 		return false;
 	}
 
-	if (range_size <= SZ_64K && !supports_4K_migration(vm->xe)) {
-		drm_dbg(&vm->xe->drm, "Platform doesn't support SZ_4K range migration\n");
+	if (preferred_region_is_vram && range_size <= SZ_64K && !supports_4K_migration(vm->xe)) {
+		drm_warn(&vm->xe->drm, "Platform doesn't support SZ_4K range migration\n");
 		return false;
 	}
 
@@ -817,7 +827,7 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
 	range_debug(range, "PAGE FAULT");
 
 	if (--migrate_try_count >= 0 &&
-	    xe_svm_range_needs_migrate_to_vram(range, vma)) {
+	    xe_svm_range_needs_migrate_to_vram(range, vma, IS_DGFX(vm->xe))) {
 		err = xe_svm_alloc_vram(vm, tile, range, &ctx);
 		ctx.timeslice_ms <<= 1;	/* Double timeslice if we have to retry */
 		if (err) {
diff --git a/drivers/gpu/drm/xe/xe_svm.h b/drivers/gpu/drm/xe/xe_svm.h
index e304d147d309..0ee845e35b3e 100644
--- a/drivers/gpu/drm/xe/xe_svm.h
+++ b/drivers/gpu/drm/xe/xe_svm.h
@@ -80,6 +80,9 @@ struct xe_svm_range *xe_svm_range_find_or_insert(struct xe_vm *vm, u64 addr,
 int xe_svm_range_get_pages(struct xe_vm *vm, struct xe_svm_range *range,
 			   struct drm_gpusvm_ctx *ctx);
 
+bool xe_svm_range_needs_migrate_to_vram(struct xe_svm_range *range, struct xe_vma *vma,
+					bool preferred_region_is_vram);
+
 /**
  * xe_svm_range_has_dma_mapping() - SVM range has DMA mapping
  * @range: SVM range
@@ -268,6 +271,13 @@ static inline unsigned long xe_svm_range_size(struct xe_svm_range *range)
 	return 0;
 }
 
+static inline
+bool xe_svm_range_needs_migrate_to_vram(struct xe_svm_range *range, struct xe_vma *vma,
+					u32 region)
+{
+	return false;
+}
+
 #define xe_svm_assert_in_notifier(...) do {} while (0)
 #define xe_svm_range_has_dma_mapping(...) false
 
-- 
2.34.1


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

* [PATCH v7 16/20] drm/xe/svm: Add xe_svm_range_validate() and xe_svm_range_migrate_to_smem()
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (14 preceding siblings ...)
  2025-05-12 16:47 ` [PATCH v7 15/20] drm/xe/svm: Make xe_svm_range_needs_migrate_to_vram() public Himal Prasad Ghimiray
@ 2025-05-12 16:47 ` Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v7 17/20] drm/gpusvm: Introduce drm_gpusvm_find_vma_start() function Himal Prasad Ghimiray
                   ` (10 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, Himal Prasad Ghimiray

The xe_svm_range_validate() function checks if a range is
valid and located in the desired memory region.

xe_svm_range_migrate_to_smem() checks if range have pages in devmem and
migrate them to smem.

v2
- Fix function stub in xe_svm.h
- Fix doc

v3 (Matthew Brost)
- Remove extra new line
- s/range->base.flags.has_devmem_pages/xe_svm_range_in_vram

v4 (Matthew Brost)
- s/xe_svm_range_in_vram/range->base.flags.has_devmem_pages
- Move eviction logic to separate function

Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
---
 drivers/gpu/drm/xe/xe_svm.c | 41 +++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_svm.h | 19 +++++++++++++++++
 2 files changed, 60 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
index c6505350c8ff..248f615a343e 100644
--- a/drivers/gpu/drm/xe/xe_svm.c
+++ b/drivers/gpu/drm/xe/xe_svm.c
@@ -651,6 +651,47 @@ static bool xe_svm_range_is_valid(struct xe_svm_range *range,
 		(!devmem_only || xe_svm_range_in_vram(range));
 }
 
+/** xe_svm_range_migrate_to_smem() - Move range pages from VRAM to SMEM
+ * @vm: xe_vm pointer
+ * @range: Pointer to the SVM range structure
+ *
+ * The xe_svm_range_migrate_to_smem() checks range has pages in VRAM
+ * and migrates them to SMEM
+ */
+void xe_svm_range_migrate_to_smem(struct xe_vm *vm, struct xe_svm_range *range)
+{
+	if (xe_svm_range_in_vram(range))
+		drm_gpusvm_range_evict(&vm->svm.gpusvm, &range->base);
+}
+
+/**
+ * xe_svm_range_validate() - Check if the SVM range is valid
+ * @vm: xe_vm pointer
+ * @range: Pointer to the SVM range structure
+ * @tile_mask: Mask representing the tiles to be checked
+ * @devmem_preferred : if true range needs to be in devmem
+ *
+ * The xe_svm_range_validate() function checks if a range is
+ * valid and located in the desired memory region.
+ *
+ * Return: true if the range is valid, false otherwise
+ */
+bool xe_svm_range_validate(struct xe_vm *vm,
+			   struct xe_svm_range *range,
+			   u8 tile_mask, bool devmem_preferred)
+{
+	bool ret;
+
+	xe_svm_notifier_lock(vm);
+
+	ret = (range->tile_present & ~range->tile_invalidated & tile_mask) == tile_mask &&
+	       (devmem_preferred == range->base.flags.has_devmem_pages);
+
+	xe_svm_notifier_unlock(vm);
+
+	return ret;
+}
+
 #if IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR)
 static struct xe_vram_region *tile_to_vr(struct xe_tile *tile)
 {
diff --git a/drivers/gpu/drm/xe/xe_svm.h b/drivers/gpu/drm/xe/xe_svm.h
index 0ee845e35b3e..42be9e5d0444 100644
--- a/drivers/gpu/drm/xe/xe_svm.h
+++ b/drivers/gpu/drm/xe/xe_svm.h
@@ -83,6 +83,12 @@ int xe_svm_range_get_pages(struct xe_vm *vm, struct xe_svm_range *range,
 bool xe_svm_range_needs_migrate_to_vram(struct xe_svm_range *range, struct xe_vma *vma,
 					bool preferred_region_is_vram);
 
+void xe_svm_range_migrate_to_smem(struct xe_vm *vm, struct xe_svm_range *range);
+
+bool xe_svm_range_validate(struct xe_vm *vm,
+			   struct xe_svm_range *range,
+			   u8 tile_mask, bool devmem_preferred);
+
 /**
  * xe_svm_range_has_dma_mapping() - SVM range has DMA mapping
  * @range: SVM range
@@ -278,6 +284,19 @@ bool xe_svm_range_needs_migrate_to_vram(struct xe_svm_range *range, struct xe_vm
 	return false;
 }
 
+static inline
+void xe_svm_range_migrate_to_smem(struct xe_vm *vm, struct xe_svm_range *range)
+{
+}
+
+static inline
+bool xe_svm_range_validate(struct xe_vm *vm,
+			   struct xe_svm_range *range,
+			   u8 tile_mask, bool devmem_preferred)
+{
+	return false;
+}
+
 #define xe_svm_assert_in_notifier(...) do {} while (0)
 #define xe_svm_range_has_dma_mapping(...) false
 
-- 
2.34.1


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

* [PATCH v7 17/20] drm/gpusvm: Introduce drm_gpusvm_find_vma_start() function
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (15 preceding siblings ...)
  2025-05-12 16:47 ` [PATCH v7 16/20] drm/xe/svm: Add xe_svm_range_validate() and xe_svm_range_migrate_to_smem() Himal Prasad Ghimiray
@ 2025-05-12 16:47 ` Himal Prasad Ghimiray
  2025-05-12 21:24   ` Matthew Brost
  2025-05-12 16:47 ` [PATCH v7 18/20] drm/xe/svm: Add xe_svm_find_vma_start() helper Himal Prasad Ghimiray
                   ` (9 subsequent siblings)
  26 siblings, 1 reply; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, Himal Prasad Ghimiray

The drm_gpusvm_find_vma_start() function is used to determine the starting
address of a CPU VMA within a specified user range. If the range does not
contain any VMA, the function returns ULONG_MAX.

v2
- Rename function as drm_gpusvm_find_vma_start() (Matthew Brost)
- mmget/mmput

v3
- s/mmget/mmget_not_zero/

Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
---
 drivers/gpu/drm/drm_gpusvm.c | 34 ++++++++++++++++++++++++++++++++++
 include/drm/drm_gpusvm.h     |  5 +++++
 2 files changed, 39 insertions(+)

diff --git a/drivers/gpu/drm/drm_gpusvm.c b/drivers/gpu/drm/drm_gpusvm.c
index 4b2f32889f00..7bb9eb71c9aa 100644
--- a/drivers/gpu/drm/drm_gpusvm.c
+++ b/drivers/gpu/drm/drm_gpusvm.c
@@ -980,6 +980,40 @@ static void drm_gpusvm_driver_lock_held(struct drm_gpusvm *gpusvm)
 }
 #endif
 
+/**
+ * drm_gpusvm_find_vma_start() - Find start address for first VMA in range
+ * @gpusvm: Pointer to the GPU SVM structure
+ * @start: The inclusive start user address.
+ * @end: The exclusive end user address.
+ *
+ * Returns: The start address of first VMA within the provided range,
+ * ULONG_MAX otherwise. Assumes start_addr < end_addr.
+ */
+unsigned long
+drm_gpusvm_find_vma_start(struct drm_gpusvm *gpusvm,
+			  unsigned long start,
+			  unsigned long end)
+{
+	struct mm_struct *mm = gpusvm->mm;
+	struct vm_area_struct *vma;
+	unsigned long addr = ULONG_MAX;
+
+	if (!mmget_not_zero(mm))
+		return addr;
+
+	mmap_read_lock(mm);
+
+	vma = find_vma_intersection(mm, start, end);
+	if (vma)
+		addr =  vma->vm_start;
+
+	mmap_read_unlock(mm);
+	mmput(mm);
+
+	return addr;
+}
+EXPORT_SYMBOL_GPL(drm_gpusvm_find_vma_start);
+
 /**
  * drm_gpusvm_range_find_or_insert() - Find or insert GPU SVM range
  * @gpusvm: Pointer to the GPU SVM structure
diff --git a/include/drm/drm_gpusvm.h b/include/drm/drm_gpusvm.h
index eaf704d3d05e..6a5156476bf4 100644
--- a/include/drm/drm_gpusvm.h
+++ b/include/drm/drm_gpusvm.h
@@ -327,6 +327,11 @@ void drm_gpusvm_fini(struct drm_gpusvm *gpusvm);
 
 void drm_gpusvm_free(struct drm_gpusvm *gpusvm);
 
+unsigned long
+drm_gpusvm_find_vma_start(struct drm_gpusvm *gpusvm,
+			  unsigned long start,
+			  unsigned long end);
+
 struct drm_gpusvm_range *
 drm_gpusvm_range_find_or_insert(struct drm_gpusvm *gpusvm,
 				unsigned long fault_addr,
-- 
2.34.1


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

* [PATCH v7 18/20] drm/xe/svm: Add xe_svm_find_vma_start() helper
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (16 preceding siblings ...)
  2025-05-12 16:47 ` [PATCH v7 17/20] drm/gpusvm: Introduce drm_gpusvm_find_vma_start() function Himal Prasad Ghimiray
@ 2025-05-12 16:47 ` Himal Prasad Ghimiray
  2025-05-12 16:47 ` [PATCH v7 19/20] drm/xe/svm: Implement prefetch support for SVM ranges Himal Prasad Ghimiray
                   ` (8 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, Himal Prasad Ghimiray

Add helper xe_svm_find_vma_start() function to determine start of cpu
vma in input range.

Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_svm.c | 22 ++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_svm.h |  8 ++++++++
 2 files changed, 30 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
index 248f615a343e..4432685936ed 100644
--- a/drivers/gpu/drm/xe/xe_svm.c
+++ b/drivers/gpu/drm/xe/xe_svm.c
@@ -692,6 +692,28 @@ bool xe_svm_range_validate(struct xe_vm *vm,
 	return ret;
 }
 
+/**
+ * xe_svm_find_vma_start - Find start of CPU VMA
+ * @vm: xe_vm pointer
+ * @start: start address
+ * @end: end address
+ * @vma: Pointer to struct xe_vma
+ *
+ *
+ * This function searches for a cpu vma, within the specified
+ * range [start, end] in the given VM. It adjusts the range based on the
+ * xe_vma start and end addresses. If no cpu VMA is found, it returns ULONG_MAX.
+ *
+ * Return: The starting address of the VMA within the range,
+ * or ULONG_MAX if no VMA is found
+ */
+u64 xe_svm_find_vma_start(struct xe_vm *vm, u64 start, u64 end, struct xe_vma *vma)
+{
+	return drm_gpusvm_find_vma_start(&vm->svm.gpusvm,
+					 max(start, xe_vma_start(vma)),
+					 min(end, xe_vma_end(vma)));
+}
+
 #if IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR)
 static struct xe_vram_region *tile_to_vr(struct xe_tile *tile)
 {
diff --git a/drivers/gpu/drm/xe/xe_svm.h b/drivers/gpu/drm/xe/xe_svm.h
index 42be9e5d0444..19ce4f2754a7 100644
--- a/drivers/gpu/drm/xe/xe_svm.h
+++ b/drivers/gpu/drm/xe/xe_svm.h
@@ -89,6 +89,8 @@ bool xe_svm_range_validate(struct xe_vm *vm,
 			   struct xe_svm_range *range,
 			   u8 tile_mask, bool devmem_preferred);
 
+u64 xe_svm_find_vma_start(struct xe_vm *vm, u64 addr, u64 end,  struct xe_vma *vma);
+
 /**
  * xe_svm_range_has_dma_mapping() - SVM range has DMA mapping
  * @range: SVM range
@@ -297,6 +299,12 @@ bool xe_svm_range_validate(struct xe_vm *vm,
 	return false;
 }
 
+static inline
+u64 xe_svm_find_vma_start(struct xe_vm *vm, u64 addr, u64 end, struct xe_vma *vma)
+{
+	return ULONG_MAX;
+}
+
 #define xe_svm_assert_in_notifier(...) do {} while (0)
 #define xe_svm_range_has_dma_mapping(...) false
 
-- 
2.34.1


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

* [PATCH v7 19/20] drm/xe/svm: Implement prefetch support for SVM ranges
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (17 preceding siblings ...)
  2025-05-12 16:47 ` [PATCH v7 18/20] drm/xe/svm: Add xe_svm_find_vma_start() helper Himal Prasad Ghimiray
@ 2025-05-12 16:47 ` Himal Prasad Ghimiray
  2025-05-12 21:32   ` Matthew Brost
  2025-05-12 16:47 ` [PATCH v7 20/20] drm/xe/vm: Add debug prints for SVM range prefetch Himal Prasad Ghimiray
                   ` (7 subsequent siblings)
  26 siblings, 1 reply; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, Himal Prasad Ghimiray

This commit adds prefetch support for SVM ranges, utilizing the
existing ioctl vm_bind functionality to achieve this.

v2: rebase

v3:
   - use xa_for_each() instead of manual loop
   - check range is valid and in preferred location before adding to
     xarray
   - Fix naming conventions
   - Fix return condition as -ENODATA instead of -EAGAIN (Matthew Brost)
   - Handle sparsely populated cpu vma range (Matthew Brost)

v4:
   - fix end address to find next cpu vma in case of -ENOENT

v5:
   - Move find next vma logic to drm gpusvm layer
   - Avoid mixing declaration and logic

v6:
  - Use new function names
  - Move eviction logic to prefetch_ranges

v7:
  - devmem_only assigned 0
  - nit address

Cc: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Acked-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
 drivers/gpu/drm/xe/xe_pt.c |  58 ++++++++---
 drivers/gpu/drm/xe/xe_vm.c | 198 +++++++++++++++++++++++++++++++++++--
 2 files changed, 235 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
index 4d248d06bfa5..c9c41fbe125c 100644
--- a/drivers/gpu/drm/xe/xe_pt.c
+++ b/drivers/gpu/drm/xe/xe_pt.c
@@ -1458,6 +1458,7 @@ static int xe_pt_svm_pre_commit(struct xe_migrate_pt_update *pt_update)
 	struct xe_vm *vm = pt_update->vops->vm;
 	struct xe_vma_ops *vops = pt_update->vops;
 	struct xe_vma_op *op;
+	unsigned long i;
 	int err;
 
 	err = xe_pt_pre_commit(pt_update);
@@ -1467,20 +1468,35 @@ static int xe_pt_svm_pre_commit(struct xe_migrate_pt_update *pt_update)
 	xe_svm_notifier_lock(vm);
 
 	list_for_each_entry(op, &vops->list, link) {
-		struct xe_svm_range *range = op->map_range.range;
+		struct xe_svm_range *range = NULL;
 
 		if (op->subop == XE_VMA_SUBOP_UNMAP_RANGE)
 			continue;
 
-		xe_svm_range_debug(range, "PRE-COMMIT");
+		if (op->base.op == DRM_GPUVA_OP_PREFETCH) {
+			xe_assert(vm->xe,
+				  xe_vma_is_cpu_addr_mirror(gpuva_to_vma(op->base.prefetch.va)));
+			xa_for_each(&op->prefetch_range.range, i, range) {
+				xe_svm_range_debug(range, "PRE-COMMIT");
 
-		xe_assert(vm->xe, xe_vma_is_cpu_addr_mirror(op->map_range.vma));
-		xe_assert(vm->xe, op->subop == XE_VMA_SUBOP_MAP_RANGE);
+				if (!xe_svm_range_pages_valid(range)) {
+					xe_svm_range_debug(range, "PRE-COMMIT - RETRY");
+					xe_svm_notifier_unlock(vm);
+					return -ENODATA;
+				}
+			}
+		} else {
+			xe_assert(vm->xe, xe_vma_is_cpu_addr_mirror(op->map_range.vma));
+			xe_assert(vm->xe, op->subop == XE_VMA_SUBOP_MAP_RANGE);
+			range = op->map_range.range;
 
-		if (!xe_svm_range_pages_valid(range)) {
-			xe_svm_range_debug(range, "PRE-COMMIT - RETRY");
-			xe_svm_notifier_unlock(vm);
-			return -EAGAIN;
+			xe_svm_range_debug(range, "PRE-COMMIT");
+
+			if (!xe_svm_range_pages_valid(range)) {
+				xe_svm_range_debug(range, "PRE-COMMIT - RETRY");
+				xe_svm_notifier_unlock(vm);
+				return -EAGAIN;
+			}
 		}
 	}
 
@@ -2065,11 +2081,20 @@ static int op_prepare(struct xe_vm *vm,
 	{
 		struct xe_vma *vma = gpuva_to_vma(op->base.prefetch.va);
 
-		if (xe_vma_is_cpu_addr_mirror(vma))
-			break;
+		if (xe_vma_is_cpu_addr_mirror(vma)) {
+			struct xe_svm_range *range;
+			unsigned long i;
 
-		err = bind_op_prepare(vm, tile, pt_update_ops, vma, false);
-		pt_update_ops->wait_vm_kernel = true;
+			xa_for_each(&op->prefetch_range.range, i, range) {
+				err = bind_range_prepare(vm, tile, pt_update_ops,
+							 vma, range);
+				if (err)
+					return err;
+			}
+		} else {
+			err = bind_op_prepare(vm, tile, pt_update_ops, vma, false);
+			pt_update_ops->wait_vm_kernel = true;
+		}
 		break;
 	}
 	case DRM_GPUVA_OP_DRIVER:
@@ -2275,9 +2300,16 @@ static void op_commit(struct xe_vm *vm,
 	{
 		struct xe_vma *vma = gpuva_to_vma(op->base.prefetch.va);
 
-		if (!xe_vma_is_cpu_addr_mirror(vma))
+		if (xe_vma_is_cpu_addr_mirror(vma)) {
+			struct xe_svm_range *range = NULL;
+			unsigned long i;
+
+			xa_for_each(&op->prefetch_range.range, i, range)
+				range_present_and_invalidated_tile(vm, range, tile->id);
+		} else {
 			bind_op_commit(vm, tile, pt_update_ops, vma, fence,
 				       fence2, false);
+		}
 		break;
 	}
 	case DRM_GPUVA_OP_DRIVER:
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index cb79a37d2132..5504faef4019 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -798,10 +798,33 @@ static int xe_vma_ops_alloc(struct xe_vma_ops *vops, bool array_of_binds)
 }
 ALLOW_ERROR_INJECTION(xe_vma_ops_alloc, ERRNO);
 
+static void xe_vma_svm_prefetch_op_fini(struct xe_vma_op *op)
+{
+	struct xe_vma *vma;
+
+	vma = gpuva_to_vma(op->base.prefetch.va);
+
+	if (op->base.op == DRM_GPUVA_OP_PREFETCH && xe_vma_is_cpu_addr_mirror(vma))
+		xa_destroy(&op->prefetch_range.range);
+}
+
+static void xe_vma_svm_prefetch_ops_fini(struct xe_vma_ops *vops)
+{
+	struct xe_vma_op *op;
+
+	if (!(vops->flags & XE_VMA_OPS_FLAG_HAS_SVM_PREFETCH))
+		return;
+
+	list_for_each_entry(op, &vops->list, link)
+		xe_vma_svm_prefetch_op_fini(op);
+}
+
 static void xe_vma_ops_fini(struct xe_vma_ops *vops)
 {
 	int i;
 
+	xe_vma_svm_prefetch_ops_fini(vops);
+
 	for (i = 0; i < XE_MAX_TILES_PER_DEVICE; ++i)
 		kfree(vops->pt_update_ops[i].ops);
 }
@@ -2248,13 +2271,25 @@ static bool __xe_vm_needs_clear_scratch_pages(struct xe_vm *vm, u32 bind_flags)
 	return true;
 }
 
+static void xe_svm_prefetch_gpuva_ops_fini(struct drm_gpuva_ops *ops)
+{
+	struct drm_gpuva_op *__op;
+
+	drm_gpuva_for_each_op(__op, ops) {
+		struct xe_vma_op *op = gpuva_op_to_vma_op(__op);
+
+		xe_vma_svm_prefetch_op_fini(op);
+	}
+}
+
 /*
  * Create operations list from IOCTL arguments, setup operations fields so parse
  * and commit steps are decoupled from IOCTL arguments. This step can fail.
  */
 static struct drm_gpuva_ops *
-vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
-			 u64 bo_offset_or_userptr, u64 addr, u64 range,
+vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_vma_ops *vops,
+			 struct xe_bo *bo, u64 bo_offset_or_userptr,
+			 u64 addr, u64 range,
 			 u32 operation, u32 flags,
 			 u32 prefetch_region, u16 pat_index)
 {
@@ -2262,6 +2297,7 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
 	struct drm_gpuva_ops *ops;
 	struct drm_gpuva_op *__op;
 	struct drm_gpuvm_bo *vm_bo;
+	u64 range_end = addr + range;
 	int err;
 
 	lockdep_assert_held_write(&vm->lock);
@@ -2323,14 +2359,77 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
 			op->map.invalidate_on_bind =
 				__xe_vm_needs_clear_scratch_pages(vm, flags);
 		} else if (__op->op == DRM_GPUVA_OP_PREFETCH) {
-			op->prefetch.region = prefetch_region;
-		}
+			struct xe_vma *vma = gpuva_to_vma(op->base.prefetch.va);
+			struct xe_svm_range *svm_range;
+			struct drm_gpusvm_ctx ctx;
+			struct xe_tile *tile;
+			u8 id, tile_mask = 0;
+			u32 i;
+
+			if (!xe_vma_is_cpu_addr_mirror(vma)) {
+				op->prefetch.region = prefetch_region;
+				break;
+			}
+
+			ctx.read_only = xe_vma_read_only(vma);
+			ctx.devmem_possible = IS_DGFX(vm->xe) &&
+					      IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR);
+
+			for_each_tile(tile, vm->xe, id)
+				tile_mask |= 0x1 << id;
+
+			xa_init_flags(&op->prefetch_range.range, XA_FLAGS_ALLOC);
+			op->prefetch_range.region = prefetch_region;
+			op->prefetch_range.ranges_count = 0;
+alloc_next_range:
+			svm_range = xe_svm_range_find_or_insert(vm, addr, vma, &ctx);
+
+			if (PTR_ERR(svm_range) == -ENOENT) {
+				u64 ret = xe_svm_find_vma_start(vm, addr, range_end, vma);
+
+				addr = ret == ULONG_MAX ? 0 : ret;
+				if (addr)
+					goto alloc_next_range;
+				else
+					goto print_op_label;
+			}
+
+			if (IS_ERR(svm_range)) {
+				err = PTR_ERR(svm_range);
+				goto unwind_prefetch_ops;
+			}
+
+			if (xe_svm_range_validate(vm, svm_range, tile_mask, !!prefetch_region))
+				goto check_next_range;
+
+			err = xa_alloc(&op->prefetch_range.range,
+				       &i, svm_range, xa_limit_32b,
+				       GFP_KERNEL);
 
+			if (err)
+				goto unwind_prefetch_ops;
+
+			op->prefetch_range.ranges_count++;
+			vops->flags |= XE_VMA_OPS_FLAG_HAS_SVM_PREFETCH;
+check_next_range:
+			if (range_end > xe_svm_range_end(svm_range) &&
+			    xe_svm_range_end(svm_range) < xe_vma_end(vma)) {
+				addr = xe_svm_range_end(svm_range);
+				goto alloc_next_range;
+			}
+		}
+print_op_label:
 		print_op(vm->xe, __op);
 	}
 
 	return ops;
+
+unwind_prefetch_ops:
+	xe_svm_prefetch_gpuva_ops_fini(ops);
+	drm_gpuva_ops_free(&vm->gpuvm, ops);
+	return ERR_PTR(err);
 }
+
 ALLOW_ERROR_INJECTION(vm_bind_ioctl_ops_create, ERRNO);
 
 static struct xe_vma *new_vma(struct xe_vm *vm, struct drm_gpuva_op_map *op,
@@ -2645,8 +2744,12 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct drm_gpuva_ops *ops,
 					return err;
 			}
 
-			if (!xe_vma_is_cpu_addr_mirror(vma))
+			if (xe_vma_is_cpu_addr_mirror(vma))
+				xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask,
+							      op->prefetch_range.ranges_count);
+			else
 				xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask, 1);
+
 			break;
 		default:
 			drm_warn(&vm->xe->drm, "NOT POSSIBLE");
@@ -2772,6 +2875,57 @@ static int check_ufence(struct xe_vma *vma)
 	return 0;
 }
 
+static int prefetch_ranges(struct xe_vm *vm, struct xe_vma_op *op)
+{
+	bool devmem_possible = IS_DGFX(vm->xe) && IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR);
+	struct xe_vma *vma = gpuva_to_vma(op->base.prefetch.va);
+	int err = 0;
+
+	struct xe_svm_range *svm_range;
+	struct drm_gpusvm_ctx ctx;
+	struct xe_tile *tile;
+	unsigned long i;
+	u32 region;
+
+	if (!xe_vma_is_cpu_addr_mirror(vma))
+		return 0;
+
+	region = op->prefetch_range.region;
+
+	ctx.read_only = xe_vma_read_only(vma);
+	ctx.devmem_possible = devmem_possible;
+	ctx.check_pages_threshold = devmem_possible ? SZ_64K : 0;
+	ctx.devmem_only = 0;
+	ctx.timeslice_ms = 0;
+
+	/* TODO: Threading the migration */
+	xa_for_each(&op->prefetch_range.range, i, svm_range) {
+		if (!region)
+			xe_svm_range_migrate_to_smem(vm, svm_range);
+
+		if (xe_svm_range_needs_migrate_to_vram(svm_range, vma, region)) {
+			tile = &vm->xe->tiles[region_to_mem_type[region] - XE_PL_VRAM0];
+			err = xe_svm_alloc_vram(vm, tile, svm_range, &ctx);
+			if (err) {
+				drm_dbg(&vm->xe->drm, "VRAM allocation failed, retry from userspace, asid=%u, gpusvm=%p, errno=%pe\n",
+					vm->usm.asid, &vm->svm.gpusvm, ERR_PTR(err));
+				return -ENODATA;
+			}
+		}
+
+		err = xe_svm_range_get_pages(vm, svm_range, &ctx);
+		if (err) {
+			if (err == -EOPNOTSUPP || err == -EFAULT || err == -EPERM)
+				err = -ENODATA;
+			drm_dbg(&vm->xe->drm, "Get pages failed, asid=%u, gpusvm=%p, errno=%pe\n",
+				vm->usm.asid, &vm->svm.gpusvm, ERR_PTR(err));
+			return err;
+		}
+	}
+
+	return err;
+}
+
 static int op_lock_and_prep(struct drm_exec *exec, struct xe_vm *vm,
 			    struct xe_vma_op *op)
 {
@@ -2809,7 +2963,12 @@ static int op_lock_and_prep(struct drm_exec *exec, struct xe_vm *vm,
 	case DRM_GPUVA_OP_PREFETCH:
 	{
 		struct xe_vma *vma = gpuva_to_vma(op->base.prefetch.va);
-		u32 region = op->prefetch.region;
+		u32 region;
+
+		if (xe_vma_is_cpu_addr_mirror(vma))
+			region = op->prefetch_range.region;
+		else
+			region = op->prefetch.region;
 
 		xe_assert(vm->xe, region <= ARRAY_SIZE(region_to_mem_type));
 
@@ -2828,6 +2987,25 @@ static int op_lock_and_prep(struct drm_exec *exec, struct xe_vm *vm,
 	return err;
 }
 
+static int vm_bind_ioctl_ops_prefetch_ranges(struct xe_vm *vm, struct xe_vma_ops *vops)
+{
+	struct xe_vma_op *op;
+	int err;
+
+	if (!(vops->flags & XE_VMA_OPS_FLAG_HAS_SVM_PREFETCH))
+		return 0;
+
+	list_for_each_entry(op, &vops->list, link) {
+		if (op->base.op  == DRM_GPUVA_OP_PREFETCH) {
+			err = prefetch_ranges(vm, op);
+			if (err)
+				return err;
+		}
+	}
+
+	return 0;
+}
+
 static int vm_bind_ioctl_ops_lock_and_prep(struct drm_exec *exec,
 					   struct xe_vm *vm,
 					   struct xe_vma_ops *vops)
@@ -3477,7 +3655,7 @@ int xe_vm_bind_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
 		u32 prefetch_region = bind_ops[i].prefetch_mem_region_instance;
 		u16 pat_index = bind_ops[i].pat_index;
 
-		ops[i] = vm_bind_ioctl_ops_create(vm, bos[i], obj_offset,
+		ops[i] = vm_bind_ioctl_ops_create(vm, &vops, bos[i], obj_offset,
 						  addr, range, op, flags,
 						  prefetch_region, pat_index);
 		if (IS_ERR(ops[i])) {
@@ -3510,6 +3688,10 @@ int xe_vm_bind_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
 	if (err)
 		goto unwind_ops;
 
+	err = vm_bind_ioctl_ops_prefetch_ranges(vm, &vops);
+	if (err)
+		goto unwind_ops;
+
 	fence = vm_bind_ioctl_ops_execute(vm, &vops);
 	if (IS_ERR(fence))
 		err = PTR_ERR(fence);
@@ -3579,7 +3761,7 @@ struct dma_fence *xe_vm_bind_kernel_bo(struct xe_vm *vm, struct xe_bo *bo,
 
 	xe_vma_ops_init(&vops, vm, q, NULL, 0);
 
-	ops = vm_bind_ioctl_ops_create(vm, bo, 0, addr, bo->size,
+	ops = vm_bind_ioctl_ops_create(vm, &vops, bo, 0, addr, bo->size,
 				       DRM_XE_VM_BIND_OP_MAP, 0, 0,
 				       vm->xe->pat.idx[cache_lvl]);
 	if (IS_ERR(ops)) {
-- 
2.34.1


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

* [PATCH v7 20/20] drm/xe/vm: Add debug prints for SVM range prefetch
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (18 preceding siblings ...)
  2025-05-12 16:47 ` [PATCH v7 19/20] drm/xe/svm: Implement prefetch support for SVM ranges Himal Prasad Ghimiray
@ 2025-05-12 16:47 ` Himal Prasad Ghimiray
  2025-05-12 17:00 ` ✓ CI.Patch_applied: success for Prefetch Support for svm ranges (rev6) Patchwork
                   ` (6 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Himal Prasad Ghimiray @ 2025-05-12 16:47 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, thomas.hellstrom, Himal Prasad Ghimiray

Introduce debug logs for the prefetch operation of SVM ranges.

Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_vm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index 5504faef4019..2f42c4fe159e 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -2399,8 +2399,10 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_vma_ops *vops,
 				goto unwind_prefetch_ops;
 			}
 
-			if (xe_svm_range_validate(vm, svm_range, tile_mask, !!prefetch_region))
+			if (xe_svm_range_validate(vm, svm_range, tile_mask, !!prefetch_region)) {
+				xe_svm_range_debug(svm_range, "PREFETCH - RANGE IS VALID");
 				goto check_next_range;
+			}
 
 			err = xa_alloc(&op->prefetch_range.range,
 				       &i, svm_range, xa_limit_32b,
@@ -2411,6 +2413,7 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_vma_ops *vops,
 
 			op->prefetch_range.ranges_count++;
 			vops->flags |= XE_VMA_OPS_FLAG_HAS_SVM_PREFETCH;
+			xe_svm_range_debug(svm_range, "PREFETCH - RANGE CREATED");
 check_next_range:
 			if (range_end > xe_svm_range_end(svm_range) &&
 			    xe_svm_range_end(svm_range) < xe_vma_end(vma)) {
@@ -2911,6 +2914,7 @@ static int prefetch_ranges(struct xe_vm *vm, struct xe_vma_op *op)
 					vm->usm.asid, &vm->svm.gpusvm, ERR_PTR(err));
 				return -ENODATA;
 			}
+			xe_svm_range_debug(svm_range, "PREFETCH - RANGE MIGRATED TO VRAM");
 		}
 
 		err = xe_svm_range_get_pages(vm, svm_range, &ctx);
@@ -2921,6 +2925,7 @@ static int prefetch_ranges(struct xe_vm *vm, struct xe_vma_op *op)
 				vm->usm.asid, &vm->svm.gpusvm, ERR_PTR(err));
 			return err;
 		}
+		xe_svm_range_debug(svm_range, "PREFETCH - RANGE GET PAGES DONE");
 	}
 
 	return err;
-- 
2.34.1


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

* ✓ CI.Patch_applied: success for Prefetch Support for svm ranges (rev6)
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (19 preceding siblings ...)
  2025-05-12 16:47 ` [PATCH v7 20/20] drm/xe/vm: Add debug prints for SVM range prefetch Himal Prasad Ghimiray
@ 2025-05-12 17:00 ` Patchwork
  2025-05-12 17:00 ` ✗ CI.checkpatch: warning " Patchwork
                   ` (5 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Patchwork @ 2025-05-12 17:00 UTC (permalink / raw)
  To: Himal Prasad Ghimiray; +Cc: intel-xe

== Series Details ==

Series: Prefetch Support for svm ranges (rev6)
URL   : https://patchwork.freedesktop.org/series/146079/
State : success

== Summary ==

=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: f3767db51c5d drm-tip: 2025y-05m-12d-14h-06m-28s UTC integration manifest
=== git am output follows ===
Applying: drm/gpusvm: Introduce devmem_only flag for allocation
Applying: drm/xe: Strict migration policy for atomic SVM faults
Applying: drm/gpusvm: Add timeslicing support to GPU SVM
Applying: drm/xe: Timeslice GPU on atomic SVM fault
Applying: drm/xe: Add atomic_svm_timeslice_ms debugfs entry
Applying: drm/xe: Introduce xe_vma_op_prefetch_range struct for prefetch of ranges
Applying: drm/xe: Make xe_svm_alloc_vram public
Applying: drm/xe/svm: Helper to add tile masks to svm ranges
Applying: drm/xe/svm: Make to_xe_range a public function
Applying: drm/xe/svm: Make xe_svm_range_* end/start/size public
Applying: drm/xe/vm: Update xe_vma_ops_incr_pt_update_ops to take an increment value
Applying: drm/xe/vm: Add an identifier in xe_vma_ops for svm prefetch
Applying: drm/xe: Rename lookup_vma function to xe_find_vma_by_addr
Applying: drm/xe/svm: Refactor usage of drm_gpusvm* function in xe_svm
Applying: drm/xe/svm: Make xe_svm_range_needs_migrate_to_vram() public
Applying: drm/xe/svm: Add xe_svm_range_validate() and xe_svm_range_migrate_to_smem()
Applying: drm/gpusvm: Introduce drm_gpusvm_find_vma_start() function
Applying: drm/xe/svm: Add xe_svm_find_vma_start() helper
Applying: drm/xe/svm: Implement prefetch support for SVM ranges
Applying: drm/xe/vm: Add debug prints for SVM range prefetch



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

* ✗ CI.checkpatch: warning for Prefetch Support for svm ranges (rev6)
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (20 preceding siblings ...)
  2025-05-12 17:00 ` ✓ CI.Patch_applied: success for Prefetch Support for svm ranges (rev6) Patchwork
@ 2025-05-12 17:00 ` Patchwork
  2025-05-12 17:02 ` ✓ CI.KUnit: success " Patchwork
                   ` (4 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Patchwork @ 2025-05-12 17:00 UTC (permalink / raw)
  To: Himal Prasad Ghimiray; +Cc: intel-xe

== Series Details ==

Series: Prefetch Support for svm ranges (rev6)
URL   : https://patchwork.freedesktop.org/series/146079/
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
202708c00696422fd217223bb679a353a5936e23
+ cd /kernel
+ git config --global --add safe.directory /kernel
+ git log -n1
commit 2b93fd781baed1fed4ebf3682f75ee473d722ae5
Author: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Date:   Mon May 12 22:17:40 2025 +0530

    drm/xe/vm: Add debug prints for SVM range prefetch
    
    Introduce debug logs for the prefetch operation of SVM ranges.
    
    Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
    Reviewed-by: Matthew Brost <matthew.brost@intel.com>
+ /mt/dim checkpatch f3767db51c5d8bc3ba3f2b342332ab329044fe5b drm-intel
2391a07784e3 drm/gpusvm: Introduce devmem_only flag for allocation
9b7c64a36ad7 drm/xe: Strict migration policy for atomic SVM faults
-:42: WARNING:BAD_SIGN_OFF: Unexpected content after email: 'Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>`', should be: 'Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>'
#42: 
Acked-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>`

total: 0 errors, 1 warnings, 0 checks, 334 lines checked
290971336365 drm/gpusvm: Add timeslicing support to GPU SVM
d9fdec32edd5 drm/xe: Timeslice GPU on atomic SVM fault
be1cec17e83d drm/xe: Add atomic_svm_timeslice_ms debugfs entry
292cc672ec56 drm/xe: Introduce xe_vma_op_prefetch_range struct for prefetch of ranges
df5042c1d763 drm/xe: Make xe_svm_alloc_vram public
78038f1ff57f drm/xe/svm: Helper to add tile masks to svm ranges
a6fd124816a6 drm/xe/svm: Make to_xe_range a public function
5159918e1215 drm/xe/svm: Make xe_svm_range_* end/start/size public
00a614c27ce9 drm/xe/vm: Update xe_vma_ops_incr_pt_update_ops to take an increment value
e8a567923cc4 drm/xe/vm: Add an identifier in xe_vma_ops for svm prefetch
907ab1da2723 drm/xe: Rename lookup_vma function to xe_find_vma_by_addr
e7b544c0d5cd drm/xe/svm: Refactor usage of drm_gpusvm* function in xe_svm
a939c2ee8b05 drm/xe/svm: Make xe_svm_range_needs_migrate_to_vram() public
6ff28dadfbba drm/xe/svm: Add xe_svm_range_validate() and xe_svm_range_migrate_to_smem()
70ae187685c7 drm/gpusvm: Introduce drm_gpusvm_find_vma_start() function
13775669d1a2 drm/xe/svm: Add xe_svm_find_vma_start() helper
888f641167bb drm/xe/svm: Implement prefetch support for SVM ranges
2b93fd781bae drm/xe/vm: Add debug prints for SVM range prefetch



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

* ✓ CI.KUnit: success for Prefetch Support for svm ranges (rev6)
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (21 preceding siblings ...)
  2025-05-12 17:00 ` ✗ CI.checkpatch: warning " Patchwork
@ 2025-05-12 17:02 ` Patchwork
  2025-05-12 17:12 ` ✗ CI.Build: failure " Patchwork
                   ` (3 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Patchwork @ 2025-05-12 17:02 UTC (permalink / raw)
  To: Himal Prasad Ghimiray; +Cc: intel-xe

== Series Details ==

Series: Prefetch Support for svm ranges (rev6)
URL   : https://patchwork.freedesktop.org/series/146079/
State : success

== Summary ==

+ trap cleanup EXIT
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig
[17:00:55] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
[17:00:59] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=48
[17:01:25] Starting KUnit Kernel (1/1)...
[17:01:25] ============================================================
Running tests with:
$ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
[17:01:25] ================== guc_buf (11 subtests) ===================
[17:01:25] [PASSED] test_smallest
[17:01:25] [PASSED] test_largest
[17:01:25] [PASSED] test_granular
[17:01:25] [PASSED] test_unique
[17:01:25] [PASSED] test_overlap
[17:01:25] [PASSED] test_reusable
[17:01:25] [PASSED] test_too_big
[17:01:25] [PASSED] test_flush
[17:01:25] [PASSED] test_lookup
[17:01:25] [PASSED] test_data
[17:01:25] [PASSED] test_class
[17:01:25] ===================== [PASSED] guc_buf =====================
[17:01:25] =================== guc_dbm (7 subtests) ===================
[17:01:25] [PASSED] test_empty
[17:01:25] [PASSED] test_default
[17:01:25] ======================== test_size  ========================
[17:01:25] [PASSED] 4
[17:01:25] [PASSED] 8
[17:01:25] [PASSED] 32
[17:01:25] [PASSED] 256
[17:01:25] ==================== [PASSED] test_size ====================
[17:01:25] ======================= test_reuse  ========================
[17:01:25] [PASSED] 4
[17:01:25] [PASSED] 8
[17:01:25] [PASSED] 32
[17:01:25] [PASSED] 256
[17:01:25] =================== [PASSED] test_reuse ====================
[17:01:25] =================== test_range_overlap  ====================
[17:01:25] [PASSED] 4
[17:01:25] [PASSED] 8
[17:01:25] [PASSED] 32
[17:01:25] [PASSED] 256
[17:01:25] =============== [PASSED] test_range_overlap ================
[17:01:25] =================== test_range_compact  ====================
[17:01:25] [PASSED] 4
[17:01:25] [PASSED] 8
[17:01:25] [PASSED] 32
[17:01:25] [PASSED] 256
[17:01:25] =============== [PASSED] test_range_compact ================
[17:01:25] ==================== test_range_spare  =====================
[17:01:25] [PASSED] 4
[17:01:25] [PASSED] 8
[17:01:25] [PASSED] 32
[17:01:25] [PASSED] 256
[17:01:25] ================ [PASSED] test_range_spare =================
[17:01:25] ===================== [PASSED] guc_dbm =====================
[17:01:25] =================== guc_idm (6 subtests) ===================
[17:01:25] [PASSED] bad_init
[17:01:25] [PASSED] no_init
[17:01:25] [PASSED] init_fini
[17:01:25] [PASSED] check_used
[17:01:25] [PASSED] check_quota
[17:01:25] [PASSED] check_all
[17:01:25] ===================== [PASSED] guc_idm =====================
[17:01:25] ================== no_relay (3 subtests) ===================
[17:01:25] [PASSED] xe_drops_guc2pf_if_not_ready
[17:01:25] [PASSED] xe_drops_guc2vf_if_not_ready
[17:01:25] [PASSED] xe_rejects_send_if_not_ready
[17:01:25] ==================== [PASSED] no_relay =====================
[17:01:25] ================== pf_relay (14 subtests) ==================
[17:01:25] [PASSED] pf_rejects_guc2pf_too_short
[17:01:25] [PASSED] pf_rejects_guc2pf_too_long
[17:01:25] [PASSED] pf_rejects_guc2pf_no_payload
[17:01:25] [PASSED] pf_fails_no_payload
[17:01:25] [PASSED] pf_fails_bad_origin
[17:01:25] [PASSED] pf_fails_bad_type
[17:01:25] [PASSED] pf_txn_reports_error
[17:01:25] [PASSED] pf_txn_sends_pf2guc
[17:01:25] [PASSED] pf_sends_pf2guc
[17:01:25] [SKIPPED] pf_loopback_nop
[17:01:25] [SKIPPED] pf_loopback_echo
[17:01:25] [SKIPPED] pf_loopback_fail
[17:01:25] [SKIPPED] pf_loopback_busy
[17:01:25] [SKIPPED] pf_loopback_retry
[17:01:25] ==================== [PASSED] pf_relay =====================
[17:01:25] ================== vf_relay (3 subtests) ===================
[17:01:25] [PASSED] vf_rejects_guc2vf_too_short
[17:01:25] [PASSED] vf_rejects_guc2vf_too_long
[17:01:25] [PASSED] vf_rejects_guc2vf_no_payload
[17:01:25] ==================== [PASSED] vf_relay =====================
[17:01:25] ================= pf_service (11 subtests) =================
[17:01:25] [PASSED] pf_negotiate_any
[17:01:25] [PASSED] pf_negotiate_base_match
[17:01:25] [PASSED] pf_negotiate_base_newer
[17:01:25] [PASSED] pf_negotiate_base_next
[17:01:25] [SKIPPED] pf_negotiate_base_older
[17:01:25] [PASSED] pf_negotiate_base_prev
[17:01:25] [PASSED] pf_negotiate_latest_match
[17:01:25] [PASSED] pf_negotiate_latest_newer
[17:01:25] [PASSED] pf_negotiate_latest_next
[17:01:25] [SKIPPED] pf_negotiate_latest_older
[17:01:25] [SKIPPED] pf_negotiate_latest_prev
[17:01:25] =================== [PASSED] pf_service ====================
[17:01:25] ===================== lmtt (1 subtest) =====================
[17:01:25] ======================== test_ops  =========================
[17:01:25] [PASSED] 2-level
[17:01:25] [PASSED] multi-level
[17:01:25] ==================== [PASSED] test_ops =====================
[17:01:25] ====================== [PASSED] lmtt =======================
[17:01:25] =================== xe_mocs (2 subtests) ===================
[17:01:25] ================ xe_live_mocs_kernel_kunit  ================
[17:01:25] =========== [SKIPPED] xe_live_mocs_kernel_kunit ============
[17:01:25] ================ xe_live_mocs_reset_kunit  =================
[17:01:25] ============ [SKIPPED] xe_live_mocs_reset_kunit ============
[17:01:25] ==================== [SKIPPED] xe_mocs =====================
[17:01:25] ================= xe_migrate (2 subtests) ==================
[17:01:25] ================= xe_migrate_sanity_kunit  =================
[17:01:25] ============ [SKIPPED] xe_migrate_sanity_kunit =============
[17:01:25] ================== xe_validate_ccs_kunit  ==================
[17:01:25] ============= [SKIPPED] xe_validate_ccs_kunit ==============
[17:01:25] =================== [SKIPPED] xe_migrate ===================
[17:01:25] ================== xe_dma_buf (1 subtest) ==================
[17:01:25] ==================== xe_dma_buf_kunit  =====================
[17:01:25] ================ [SKIPPED] xe_dma_buf_kunit ================
[17:01:25] =================== [SKIPPED] xe_dma_buf ===================
[17:01:25] ================= xe_bo_shrink (1 subtest) =================
[17:01:25] =================== xe_bo_shrink_kunit  ====================
[17:01:25] =============== [SKIPPED] xe_bo_shrink_kunit ===============
[17:01:25] ================== [SKIPPED] xe_bo_shrink ==================
[17:01:25] ==================== xe_bo (2 subtests) ====================
[17:01:25] ================== xe_ccs_migrate_kunit  ===================
[17:01:26] ============== [SKIPPED] xe_ccs_migrate_kunit ==============
[17:01:26] ==================== xe_bo_evict_kunit  ====================
[17:01:26] =============== [SKIPPED] xe_bo_evict_kunit ================
[17:01:26] ===================== [SKIPPED] xe_bo ======================
[17:01:26] ==================== args (11 subtests) ====================
[17:01:26] [PASSED] count_args_test
[17:01:26] [PASSED] call_args_example
[17:01:26] [PASSED] call_args_test
[17:01:26] [PASSED] drop_first_arg_example
[17:01:26] [PASSED] drop_first_arg_test
[17:01:26] [PASSED] first_arg_example
[17:01:26] [PASSED] first_arg_test
[17:01:26] [PASSED] last_arg_example
[17:01:26] [PASSED] last_arg_test
[17:01:26] [PASSED] pick_arg_example
[17:01:26] [PASSED] sep_comma_example
[17:01:26] ====================== [PASSED] args =======================
[17:01:26] =================== xe_pci (2 subtests) ====================
[17:01:26] [PASSED] xe_gmdid_graphics_ip
[17:01:26] [PASSED] xe_gmdid_media_ip
[17:01:26] ===================== [PASSED] xe_pci ======================
[17:01:26] =================== xe_rtp (2 subtests) ====================
[17:01:26] =============== xe_rtp_process_to_sr_tests  ================
[17:01:26] [PASSED] coalesce-same-reg
[17:01:26] [PASSED] no-match-no-add
[17:01:26] [PASSED] match-or
[17:01:26] [PASSED] match-or-xfail
[17:01:26] [PASSED] no-match-no-add-multiple-rules
[17:01:26] [PASSED] two-regs-two-entries
[17:01:26] [PASSED] clr-one-set-other
[17:01:26] [PASSED] set-field
[17:01:26] [PASSED] conflict-duplicate
[17:01:26] [PASSED] conflict-not-disjoint
stty: 'standard input': Inappropriate ioctl for device
[17:01:26] [PASSED] conflict-reg-type
[17:01:26] =========== [PASSED] xe_rtp_process_to_sr_tests ============
[17:01:26] ================== xe_rtp_process_tests  ===================
[17:01:26] [PASSED] active1
[17:01:26] [PASSED] active2
[17:01:26] [PASSED] active-inactive
[17:01:26] [PASSED] inactive-active
[17:01:26] [PASSED] inactive-1st_or_active-inactive
[17:01:26] [PASSED] inactive-2nd_or_active-inactive
[17:01:26] [PASSED] inactive-last_or_active-inactive
[17:01:26] [PASSED] inactive-no_or_active-inactive
[17:01:26] ============== [PASSED] xe_rtp_process_tests ===============
[17:01:26] ===================== [PASSED] xe_rtp ======================
[17:01:26] ==================== xe_wa (1 subtest) =====================
[17:01:26] ======================== xe_wa_gt  =========================
[17:01:26] [PASSED] TIGERLAKE (B0)
[17:01:26] [PASSED] DG1 (A0)
[17:01:26] [PASSED] DG1 (B0)
[17:01:26] [PASSED] ALDERLAKE_S (A0)
[17:01:26] [PASSED] ALDERLAKE_S (B0)
[17:01:26] [PASSED] ALDERLAKE_S (C0)
[17:01:26] [PASSED] ALDERLAKE_S (D0)
[17:01:26] [PASSED] ALDERLAKE_P (A0)
[17:01:26] [PASSED] ALDERLAKE_P (B0)
[17:01:26] [PASSED] ALDERLAKE_P (C0)
[17:01:26] [PASSED] ALDERLAKE_S_RPLS (D0)
[17:01:26] [PASSED] ALDERLAKE_P_RPLU (E0)
[17:01:26] [PASSED] DG2_G10 (C0)
[17:01:26] [PASSED] DG2_G11 (B1)
[17:01:26] [PASSED] DG2_G12 (A1)
[17:01:26] [PASSED] METEORLAKE (g:A0, m:A0)
[17:01:26] [PASSED] METEORLAKE (g:A0, m:A0)
[17:01:26] [PASSED] METEORLAKE (g:A0, m:A0)
[17:01:26] [PASSED] LUNARLAKE (g:A0, m:A0)
[17:01:26] [PASSED] LUNARLAKE (g:B0, m:A0)
[17:01:26] [PASSED] BATTLEMAGE (g:A0, m:A1)
[17:01:26] ==================== [PASSED] xe_wa_gt =====================
[17:01:26] ====================== [PASSED] xe_wa ======================
[17:01:26] ============================================================
[17:01:26] Testing complete. Ran 133 tests: passed: 117, skipped: 16
[17:01:26] Elapsed time: 31.024s total, 4.268s configuring, 26.439s building, 0.293s running

+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/tests/.kunitconfig
[17:01:26] Configuring KUnit Kernel ...
Regenerating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
[17:01:27] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=48
[17:01:49] Starting KUnit Kernel (1/1)...
[17:01:49] ============================================================
Running tests with:
$ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
[17:01:49] == drm_test_atomic_get_connector_for_encoder (1 subtest) ===
[17:01:49] [PASSED] drm_test_drm_atomic_get_connector_for_encoder
[17:01:49] ==== [PASSED] drm_test_atomic_get_connector_for_encoder ====
[17:01:49] =========== drm_validate_clone_mode (2 subtests) ===========
[17:01:49] ============== drm_test_check_in_clone_mode  ===============
[17:01:49] [PASSED] in_clone_mode
[17:01:49] [PASSED] not_in_clone_mode
[17:01:49] ========== [PASSED] drm_test_check_in_clone_mode ===========
[17:01:49] =============== drm_test_check_valid_clones  ===============
[17:01:49] [PASSED] not_in_clone_mode
[17:01:49] [PASSED] valid_clone
[17:01:49] [PASSED] invalid_clone
[17:01:49] =========== [PASSED] drm_test_check_valid_clones ===========
[17:01:49] ============= [PASSED] drm_validate_clone_mode =============
[17:01:49] ============= drm_validate_modeset (1 subtest) =============
[17:01:49] [PASSED] drm_test_check_connector_changed_modeset
[17:01:49] ============== [PASSED] drm_validate_modeset ===============
[17:01:49] ====== drm_test_bridge_get_current_state (2 subtests) ======
[17:01:49] [PASSED] drm_test_drm_bridge_get_current_state_atomic
[17:01:49] [PASSED] drm_test_drm_bridge_get_current_state_legacy
[17:01:49] ======== [PASSED] drm_test_bridge_get_current_state ========
[17:01:49] ====== drm_test_bridge_helper_reset_crtc (3 subtests) ======
[17:01:49] [PASSED] drm_test_drm_bridge_helper_reset_crtc_atomic
[17:01:49] [PASSED] drm_test_drm_bridge_helper_reset_crtc_atomic_disabled
[17:01:49] [PASSED] drm_test_drm_bridge_helper_reset_crtc_legacy
[17:01:49] ======== [PASSED] drm_test_bridge_helper_reset_crtc ========
[17:01:49] ================== drm_buddy (7 subtests) ==================
[17:01:49] [PASSED] drm_test_buddy_alloc_limit
[17:01:49] [PASSED] drm_test_buddy_alloc_optimistic
[17:01:49] [PASSED] drm_test_buddy_alloc_pessimistic
[17:01:49] [PASSED] drm_test_buddy_alloc_pathological
[17:01:49] [PASSED] drm_test_buddy_alloc_contiguous
[17:01:49] [PASSED] drm_test_buddy_alloc_clear
[17:01:49] [PASSED] drm_test_buddy_alloc_range_bias
[17:01:49] ==================== [PASSED] drm_buddy ====================
[17:01:49] ============= drm_cmdline_parser (40 subtests) =============
[17:01:49] [PASSED] drm_test_cmdline_force_d_only
[17:01:49] [PASSED] drm_test_cmdline_force_D_only_dvi
[17:01:49] [PASSED] drm_test_cmdline_force_D_only_hdmi
[17:01:49] [PASSED] drm_test_cmdline_force_D_only_not_digital
[17:01:49] [PASSED] drm_test_cmdline_force_e_only
[17:01:49] [PASSED] drm_test_cmdline_res
[17:01:49] [PASSED] drm_test_cmdline_res_vesa
[17:01:49] [PASSED] drm_test_cmdline_res_vesa_rblank
[17:01:49] [PASSED] drm_test_cmdline_res_rblank
[17:01:49] [PASSED] drm_test_cmdline_res_bpp
[17:01:49] [PASSED] drm_test_cmdline_res_refresh
[17:01:49] [PASSED] drm_test_cmdline_res_bpp_refresh
[17:01:49] [PASSED] drm_test_cmdline_res_bpp_refresh_interlaced
[17:01:49] [PASSED] drm_test_cmdline_res_bpp_refresh_margins
[17:01:49] [PASSED] drm_test_cmdline_res_bpp_refresh_force_off
[17:01:49] [PASSED] drm_test_cmdline_res_bpp_refresh_force_on
[17:01:49] [PASSED] drm_test_cmdline_res_bpp_refresh_force_on_analog
[17:01:49] [PASSED] drm_test_cmdline_res_bpp_refresh_force_on_digital
[17:01:49] [PASSED] drm_test_cmdline_res_bpp_refresh_interlaced_margins_force_on
[17:01:49] [PASSED] drm_test_cmdline_res_margins_force_on
[17:01:49] [PASSED] drm_test_cmdline_res_vesa_margins
[17:01:49] [PASSED] drm_test_cmdline_name
[17:01:49] [PASSED] drm_test_cmdline_name_bpp
[17:01:49] [PASSED] drm_test_cmdline_name_option
[17:01:49] [PASSED] drm_test_cmdline_name_bpp_option
[17:01:49] [PASSED] drm_test_cmdline_rotate_0
[17:01:49] [PASSED] drm_test_cmdline_rotate_90
[17:01:49] [PASSED] drm_test_cmdline_rotate_180
[17:01:49] [PASSED] drm_test_cmdline_rotate_270
[17:01:49] [PASSED] drm_test_cmdline_hmirror
[17:01:49] [PASSED] drm_test_cmdline_vmirror
[17:01:49] [PASSED] drm_test_cmdline_margin_options
[17:01:49] [PASSED] drm_test_cmdline_multiple_options
[17:01:49] [PASSED] drm_test_cmdline_bpp_extra_and_option
[17:01:49] [PASSED] drm_test_cmdline_extra_and_option
[17:01:49] [PASSED] drm_test_cmdline_freestanding_options
[17:01:49] [PASSED] drm_test_cmdline_freestanding_force_e_and_options
[17:01:49] [PASSED] drm_test_cmdline_panel_orientation
[17:01:49] ================ drm_test_cmdline_invalid  =================
[17:01:49] [PASSED] margin_only
[17:01:49] [PASSED] interlace_only
[17:01:49] [PASSED] res_missing_x
[17:01:49] [PASSED] res_missing_y
[17:01:49] [PASSED] res_bad_y
[17:01:49] [PASSED] res_missing_y_bpp
[17:01:49] [PASSED] res_bad_bpp
[17:01:49] [PASSED] res_bad_refresh
[17:01:49] [PASSED] res_bpp_refresh_force_on_off
[17:01:49] [PASSED] res_invalid_mode
[17:01:49] [PASSED] res_bpp_wrong_place_mode
[17:01:49] [PASSED] name_bpp_refresh
[17:01:49] [PASSED] name_refresh
[17:01:49] [PASSED] name_refresh_wrong_mode
[17:01:49] [PASSED] name_refresh_invalid_mode
[17:01:49] [PASSED] rotate_multiple
[17:01:49] [PASSED] rotate_invalid_val
[17:01:49] [PASSED] rotate_truncated
[17:01:49] [PASSED] invalid_option
[17:01:49] [PASSED] invalid_tv_option
[17:01:49] [PASSED] truncated_tv_option
[17:01:49] ============ [PASSED] drm_test_cmdline_invalid =============
[17:01:49] =============== drm_test_cmdline_tv_options  ===============
[17:01:49] [PASSED] NTSC
[17:01:49] [PASSED] NTSC_443
[17:01:49] [PASSED] NTSC_J
[17:01:49] [PASSED] PAL
[17:01:49] [PASSED] PAL_M
[17:01:49] [PASSED] PAL_N
[17:01:49] [PASSED] SECAM
[17:01:49] [PASSED] MONO_525
[17:01:49] [PASSED] MONO_625
[17:01:49] =========== [PASSED] drm_test_cmdline_tv_options ===========
[17:01:49] =============== [PASSED] drm_cmdline_parser ================
[17:01:49] ========== drmm_connector_hdmi_init (20 subtests) ==========
[17:01:49] [PASSED] drm_test_connector_hdmi_init_valid
[17:01:49] [PASSED] drm_test_connector_hdmi_init_bpc_8
[17:01:49] [PASSED] drm_test_connector_hdmi_init_bpc_10
[17:01:49] [PASSED] drm_test_connector_hdmi_init_bpc_12
[17:01:49] [PASSED] drm_test_connector_hdmi_init_bpc_invalid
[17:01:49] [PASSED] drm_test_connector_hdmi_init_bpc_null
[17:01:49] [PASSED] drm_test_connector_hdmi_init_formats_empty
[17:01:49] [PASSED] drm_test_connector_hdmi_init_formats_no_rgb
[17:01:49] === drm_test_connector_hdmi_init_formats_yuv420_allowed  ===
[17:01:49] [PASSED] supported_formats=0x9 yuv420_allowed=1
[17:01:49] [PASSED] supported_formats=0x9 yuv420_allowed=0
[17:01:49] [PASSED] supported_formats=0x3 yuv420_allowed=1
[17:01:49] [PASSED] supported_formats=0x3 yuv420_allowed=0
[17:01:49] === [PASSED] drm_test_connector_hdmi_init_formats_yuv420_allowed ===
[17:01:49] [PASSED] drm_test_connector_hdmi_init_null_ddc
[17:01:49] [PASSED] drm_test_connector_hdmi_init_null_product
[17:01:49] [PASSED] drm_test_connector_hdmi_init_null_vendor
[17:01:49] [PASSED] drm_test_connector_hdmi_init_product_length_exact
[17:01:49] [PASSED] drm_test_connector_hdmi_init_product_length_too_long
[17:01:49] [PASSED] drm_test_connector_hdmi_init_product_valid
[17:01:49] [PASSED] drm_test_connector_hdmi_init_vendor_length_exact
[17:01:49] [PASSED] drm_test_connector_hdmi_init_vendor_length_too_long
[17:01:49] [PASSED] drm_test_connector_hdmi_init_vendor_valid
[17:01:49] ========= drm_test_connector_hdmi_init_type_valid  =========
[17:01:49] [PASSED] HDMI-A
[17:01:49] [PASSED] HDMI-B
[17:01:49] ===== [PASSED] drm_test_connector_hdmi_init_type_valid =====
[17:01:49] ======== drm_test_connector_hdmi_init_type_invalid  ========
[17:01:49] [PASSED] Unknown
[17:01:49] [PASSED] VGA
[17:01:49] [PASSED] DVI-I
[17:01:49] [PASSED] DVI-D
[17:01:49] [PASSED] DVI-A
[17:01:49] [PASSED] Composite
[17:01:49] [PASSED] SVIDEO
[17:01:49] [PASSED] LVDS
[17:01:49] [PASSED] Component
[17:01:49] [PASSED] DIN
[17:01:49] [PASSED] DP
[17:01:49] [PASSED] TV
[17:01:49] [PASSED] eDP
[17:01:49] [PASSED] Virtual
[17:01:49] [PASSED] DSI
[17:01:49] [PASSED] DPI
[17:01:49] [PASSED] Writeback
[17:01:49] [PASSED] SPI
[17:01:49] [PASSED] USB
[17:01:49] ==== [PASSED] drm_test_connector_hdmi_init_type_invalid ====
[17:01:49] ============ [PASSED] drmm_connector_hdmi_init =============
[17:01:49] ============= drmm_connector_init (3 subtests) =============
[17:01:49] [PASSED] drm_test_drmm_connector_init
[17:01:49] [PASSED] drm_test_drmm_connector_init_null_ddc
[17:01:49] ========= drm_test_drmm_connector_init_type_valid  =========
[17:01:49] [PASSED] Unknown
[17:01:49] [PASSED] VGA
[17:01:49] [PASSED] DVI-I
[17:01:49] [PASSED] DVI-D
[17:01:49] [PASSED] DVI-A
[17:01:49] [PASSED] Composite
[17:01:49] [PASSED] SVIDEO
[17:01:49] [PASSED] LVDS
[17:01:49] [PASSED] Component
[17:01:49] [PASSED] DIN
[17:01:49] [PASSED] DP
[17:01:49] [PASSED] HDMI-A
[17:01:49] [PASSED] HDMI-B
[17:01:49] [PASSED] TV
[17:01:49] [PASSED] eDP
[17:01:49] [PASSED] Virtual
[17:01:49] [PASSED] DSI
[17:01:49] [PASSED] DPI
[17:01:49] [PASSED] Writeback
[17:01:49] [PASSED] SPI
[17:01:49] [PASSED] USB
[17:01:49] ===== [PASSED] drm_test_drmm_connector_init_type_valid =====
[17:01:49] =============== [PASSED] drmm_connector_init ===============
[17:01:49] ========= drm_connector_dynamic_init (6 subtests) ==========
[17:01:49] [PASSED] drm_test_drm_connector_dynamic_init
[17:01:49] [PASSED] drm_test_drm_connector_dynamic_init_null_ddc
[17:01:49] [PASSED] drm_test_drm_connector_dynamic_init_not_added
[17:01:49] [PASSED] drm_test_drm_connector_dynamic_init_properties
[17:01:49] ===== drm_test_drm_connector_dynamic_init_type_valid  ======
[17:01:49] [PASSED] Unknown
[17:01:49] [PASSED] VGA
[17:01:49] [PASSED] DVI-I
[17:01:49] [PASSED] DVI-D
[17:01:49] [PASSED] DVI-A
[17:01:49] [PASSED] Composite
[17:01:49] [PASSED] SVIDEO
[17:01:49] [PASSED] LVDS
[17:01:49] [PASSED] Component
[17:01:49] [PASSED] DIN
[17:01:49] [PASSED] DP
[17:01:49] [PASSED] HDMI-A
[17:01:49] [PASSED] HDMI-B
[17:01:49] [PASSED] TV
[17:01:49] [PASSED] eDP
[17:01:49] [PASSED] Virtual
[17:01:49] [PASSED] DSI
[17:01:49] [PASSED] DPI
[17:01:49] [PASSED] Writeback
[17:01:49] [PASSED] SPI
[17:01:49] [PASSED] USB
[17:01:49] = [PASSED] drm_test_drm_connector_dynamic_init_type_valid ==
[17:01:49] ======== drm_test_drm_connector_dynamic_init_name  =========
[17:01:49] [PASSED] Unknown
[17:01:49] [PASSED] VGA
[17:01:49] [PASSED] DVI-I
[17:01:49] [PASSED] DVI-D
[17:01:49] [PASSED] DVI-A
[17:01:49] [PASSED] Composite
[17:01:49] [PASSED] SVIDEO
[17:01:49] [PASSED] LVDS
[17:01:49] [PASSED] Component
[17:01:49] [PASSED] DIN
[17:01:49] [PASSED] DP
[17:01:49] [PASSED] HDMI-A
[17:01:49] [PASSED] HDMI-B
[17:01:49] [PASSED] TV
[17:01:49] [PASSED] eDP
[17:01:49] [PASSED] Virtual
[17:01:49] [PASSED] DSI
[17:01:49] [PASSED] DPI
[17:01:49] [PASSED] Writeback
[17:01:49] [PASSED] SPI
[17:01:49] [PASSED] USB
[17:01:49] ==== [PASSED] drm_test_drm_connector_dynamic_init_name =====
[17:01:49] =========== [PASSED] drm_connector_dynamic_init ============
[17:01:49] ==== drm_connector_dynamic_register_early (4 subtests) =====
[17:01:49] [PASSED] drm_test_drm_connector_dynamic_register_early_on_list
[17:01:49] [PASSED] drm_test_drm_connector_dynamic_register_early_defer
[17:01:49] [PASSED] drm_test_drm_connector_dynamic_register_early_no_init
[17:01:49] [PASSED] drm_test_drm_connector_dynamic_register_early_no_mode_object
[17:01:49] ====== [PASSED] drm_connector_dynamic_register_early =======
[17:01:49] ======= drm_connector_dynamic_register (7 subtests) ========
[17:01:49] [PASSED] drm_test_drm_connector_dynamic_register_on_list
[17:01:49] [PASSED] drm_test_drm_connector_dynamic_register_no_defer
[17:01:49] [PASSED] drm_test_drm_connector_dynamic_register_no_init
[17:01:49] [PASSED] drm_test_drm_connector_dynamic_register_mode_object
[17:01:49] [PASSED] drm_test_drm_connector_dynamic_register_sysfs
[17:01:49] [PASSED] drm_test_drm_connector_dynamic_register_sysfs_name
[17:01:49] [PASSED] drm_test_drm_connector_dynamic_register_debugfs
[17:01:49] ========= [PASSED] drm_connector_dynamic_register ==========
[17:01:49] = drm_connector_attach_broadcast_rgb_property (2 subtests) =
[17:01:49] [PASSED] drm_test_drm_connector_attach_broadcast_rgb_property
[17:01:49] [PASSED] drm_test_drm_connector_attach_broadcast_rgb_property_hdmi_connector
[17:01:49] === [PASSED] drm_connector_attach_broadcast_rgb_property ===
[17:01:49] ========== drm_get_tv_mode_from_name (2 subtests) ==========
[17:01:49] ========== drm_test_get_tv_mode_from_name_valid  ===========
[17:01:49] [PASSED] NTSC
[17:01:49] [PASSED] NTSC-443
[17:01:49] [PASSED] NTSC-J
[17:01:49] [PASSED] PAL
[17:01:49] [PASSED] PAL-M
[17:01:49] [PASSED] PAL-N
[17:01:49] [PASSED] SECAM
[17:01:49] [PASSED] Mono
[17:01:49] ====== [PASSED] drm_test_get_tv_mode_from_name_valid =======
[17:01:49] [PASSED] drm_test_get_tv_mode_from_name_truncated
[17:01:49] ============ [PASSED] drm_get_tv_mode_from_name ============
[17:01:49] = drm_test_connector_hdmi_compute_mode_clock (12 subtests) =
[17:01:49] [PASSED] drm_test_drm_hdmi_compute_mode_clock_rgb
[17:01:49] [PASSED] drm_test_drm_hdmi_compute_mode_clock_rgb_10bpc
[17:01:49] [PASSED] drm_test_drm_hdmi_compute_mode_clock_rgb_10bpc_vic_1
[17:01:49] [PASSED] drm_test_drm_hdmi_compute_mode_clock_rgb_12bpc
[17:01:49] [PASSED] drm_test_drm_hdmi_compute_mode_clock_rgb_12bpc_vic_1
[17:01:49] [PASSED] drm_test_drm_hdmi_compute_mode_clock_rgb_double
[17:01:49] = drm_test_connector_hdmi_compute_mode_clock_yuv420_valid  =
[17:01:49] [PASSED] VIC 96
[17:01:49] [PASSED] VIC 97
[17:01:49] [PASSED] VIC 101
[17:01:49] [PASSED] VIC 102
[17:01:49] [PASSED] VIC 106
[17:01:49] [PASSED] VIC 107
[17:01:49] === [PASSED] drm_test_connector_hdmi_compute_mode_clock_yuv420_valid ===
[17:01:49] [PASSED] drm_test_connector_hdmi_compute_mode_clock_yuv420_10_bpc
[17:01:49] [PASSED] drm_test_connector_hdmi_compute_mode_clock_yuv420_12_bpc
[17:01:49] [PASSED] drm_test_connector_hdmi_compute_mode_clock_yuv422_8_bpc
[17:01:49] [PASSED] drm_test_connector_hdmi_compute_mode_clock_yuv422_10_bpc
[17:01:49] [PASSED] drm_test_connector_hdmi_compute_mode_clock_yuv422_12_bpc
[17:01:49] === [PASSED] drm_test_connector_hdmi_compute_mode_clock ====
[17:01:49] == drm_hdmi_connector_get_broadcast_rgb_name (2 subtests) ==
[17:01:49] === drm_test_drm_hdmi_connector_get_broadcast_rgb_name  ====
[17:01:49] [PASSED] Automatic
[17:01:49] [PASSED] Full
[17:01:49] [PASSED] Limited 16:235
[17:01:49] === [PASSED] drm_test_drm_hdmi_connector_get_broadcast_rgb_name ===
[17:01:49] [PASSED] drm_test_drm_hdmi_connector_get_broadcast_rgb_name_invalid
[17:01:49] ==== [PASSED] drm_hdmi_connector_get_broadcast_rgb_name ====
[17:01:49] == drm_hdmi_connector_get_output_format_name (2 subtests) ==
[17:01:49] === drm_test_drm_hdmi_connector_get_output_format_name  ====
[17:01:49] [PASSED] RGB
[17:01:49] [PASSED] YUV 4:2:0
[17:01:49] [PASSED] YUV 4:2:2
[17:01:49] [PASSED] YUV 4:4:4
[17:01:49] === [PASSED] drm_test_drm_hdmi_connector_get_output_format_name ===
[17:01:49] [PASSED] drm_test_drm_hdmi_connector_get_output_format_name_invalid
[17:01:49] ==== [PASSED] drm_hdmi_connector_get_output_format_name ====
[17:01:49] ============= drm_damage_helper (21 subtests) ==============
[17:01:49] [PASSED] drm_test_damage_iter_no_damage
[17:01:49] [PASSED] drm_test_damage_iter_no_damage_fractional_src
[17:01:49] [PASSED] drm_test_damage_iter_no_damage_src_moved
[17:01:49] [PASSED] drm_test_damage_iter_no_damage_fractional_src_moved
[17:01:49] [PASSED] drm_test_damage_iter_no_damage_not_visible
[17:01:49] [PASSED] drm_test_damage_iter_no_damage_no_crtc
[17:01:49] [PASSED] drm_test_damage_iter_no_damage_no_fb
[17:01:49] [PASSED] drm_test_damage_iter_simple_damage
[17:01:49] [PASSED] drm_test_damage_iter_single_damage
[17:01:49] [PASSED] drm_test_damage_iter_single_damage_intersect_src
[17:01:49] [PASSED] drm_test_damage_iter_single_damage_outside_src
[17:01:49] [PASSED] drm_test_damage_iter_single_damage_fractional_src
[17:01:49] [PASSED] drm_test_damage_iter_single_damage_intersect_fractional_src
[17:01:49] [PASSED] drm_test_damage_iter_single_damage_outside_fractional_src
[17:01:49] [PASSED] drm_test_damage_iter_single_damage_src_moved
[17:01:49] [PASSED] drm_test_damage_iter_single_damage_fractional_src_moved
[17:01:49] [PASSED] drm_test_damage_iter_damage
[17:01:49] [PASSED] drm_test_damage_iter_damage_one_intersect
[17:01:49] [PASSED] drm_test_damage_iter_damage_one_outside
[17:01:49] [PASSED] drm_test_damage_iter_damage_src_moved
[17:01:49] [PASSED] drm_test_damage_iter_damage_not_visible
[17:01:49] ================ [PASSED] drm_damage_helper ================
[17:01:49] ============== drm_dp_mst_helper (3 subtests) ==============
[17:01:49] ============== drm_test_dp_mst_calc_pbn_mode  ==============
[17:01:49] [PASSED] Clock 154000 BPP 30 DSC disabled
[17:01:49] [PASSED] Clock 234000 BPP 30 DSC disabled
[17:01:49] [PASSED] Clock 297000 BPP 24 DSC disabled
[17:01:49] [PASSED] Clock 332880 BPP 24 DSC enabled
[17:01:49] [PASSED] Clock 324540 BPP 24 DSC enabled
[17:01:49] ========== [PASSED] drm_test_dp_mst_calc_pbn_mode ==========
[17:01:49] ============== drm_test_dp_mst_calc_pbn_div  ===============
[17:01:49] [PASSED] Link rate 2000000 lane count 4
[17:01:49] [PASSED] Link rate 2000000 lane count 2
[17:01:49] [PASSED] Link rate 2000000 lane count 1
[17:01:49] [PASSED] Link rate 1350000 lane count 4
[17:01:49] [PASSED] Link rate 1350000 lane count 2
[17:01:49] [PASSED] Link rate 1350000 lane count 1
[17:01:49] [PASSED] Link rate 1000000 lane count 4
[17:01:49] [PASSED] Link rate 1000000 lane count 2
[17:01:49] [PASSED] Link rate 1000000 lane count 1
[17:01:49] [PASSED] Link rate 810000 lane count 4
[17:01:49] [PASSED] Link rate 810000 lane count 2
[17:01:49] [PASSED] Link rate 810000 lane count 1
[17:01:49] [PASSED] Link rate 540000 lane count 4
[17:01:49] [PASSED] Link rate 540000 lane count 2
[17:01:49] [PASSED] Link rate 540000 lane count 1
[17:01:49] [PASSED] Link rate 270000 lane count 4
[17:01:49] [PASSED] Link rate 270000 lane count 2
[17:01:49] [PASSED] Link rate 270000 lane count 1
[17:01:49] [PASSED] Link rate 162000 lane count 4
[17:01:49] [PASSED] Link rate 162000 lane count 2
[17:01:49] [PASSED] Link rate 162000 lane count 1
[17:01:49] ========== [PASSED] drm_test_dp_mst_calc_pbn_div ===========
[17:01:49] ========= drm_test_dp_mst_sideband_msg_req_decode  =========
[17:01:49] [PASSED] DP_ENUM_PATH_RESOURCES with port number
[17:01:49] [PASSED] DP_POWER_UP_PHY with port number
[17:01:49] [PASSED] DP_POWER_DOWN_PHY with port number
[17:01:49] [PASSED] DP_ALLOCATE_PAYLOAD with SDP stream sinks
[17:01:49] [PASSED] DP_ALLOCATE_PAYLOAD with port number
[17:01:49] [PASSED] DP_ALLOCATE_PAYLOAD with VCPI
[17:01:49] [PASSED] DP_ALLOCATE_PAYLOAD with PBN
[17:01:49] [PASSED] DP_QUERY_PAYLOAD with port number
[17:01:49] [PASSED] DP_QUERY_PAYLOAD with VCPI
[17:01:49] [PASSED] DP_REMOTE_DPCD_READ with port number
[17:01:49] [PASSED] DP_REMOTE_DPCD_READ with DPCD address
[17:01:49] [PASSED] DP_REMOTE_DPCD_READ with max number of bytes
[17:01:49] [PASSED] DP_REMOTE_DPCD_WRITE with port number
[17:01:49] [PASSED] DP_REMOTE_DPCD_WRITE with DPCD address
[17:01:49] [PASSED] DP_REMOTE_DPCD_WRITE with data array
[17:01:49] [PASSED] DP_REMOTE_I2C_READ with port number
[17:01:49] [PASSED] DP_REMOTE_I2C_READ with I2C device ID
[17:01:49] [PASSED] DP_REMOTE_I2C_READ with transactions array
[17:01:49] [PASSED] DP_REMOTE_I2C_WRITE with port number
[17:01:49] [PASSED] DP_REMOTE_I2C_WRITE with I2C device ID
[17:01:49] [PASSED] DP_REMOTE_I2C_WRITE with data array
[17:01:49] [PASSED] DP_QUERY_STREAM_ENC_STATUS with stream ID
[17:01:49] [PASSED] DP_QUERY_STREAM_ENC_STATUS with client ID
[17:01:49] [PASSED] DP_QUERY_STREAM_ENC_STATUS with stream event
[17:01:49] [PASSED] DP_QUERY_STREAM_ENC_STATUS with valid stream event
[17:01:49] [PASSED] DP_QUERY_STREAM_ENC_STATUS with stream behavior
[17:01:49] [PASSED] DP_QUERY_STREAM_ENC_STATUS with a valid stream behavior
[17:01:49] ===== [PASSED] drm_test_dp_mst_sideband_msg_req_decode =====
[17:01:49] ================ [PASSED] drm_dp_mst_helper ================
[17:01:49] ================== drm_exec (7 subtests) ===================
[17:01:49] [PASSED] sanitycheck
[17:01:49] [PASSED] test_lock
[17:01:49] [PASSED] test_lock_unlock
[17:01:49] [PASSED] test_duplicates
[17:01:49] [PASSED] test_prepare
[17:01:49] [PASSED] test_prepare_array
[17:01:49] [PASSED] test_multiple_loops
[17:01:49] ==================== [PASSED] drm_exec =====================
[17:01:49] =========== drm_format_helper_test (18 subtests) ===========
[17:01:49] ============== drm_test_fb_xrgb8888_to_gray8  ==============
[17:01:49] [PASSED] single_pixel_source_buffer
[17:01:49] [PASSED] single_pixel_clip_rectangle
[17:01:49] [PASSED] well_known_colors
[17:01:49] [PASSED] destination_pitch
[17:01:49] ========== [PASSED] drm_test_fb_xrgb8888_to_gray8 ==========
[17:01:49] ============= drm_test_fb_xrgb8888_to_rgb332  ==============
[17:01:49] [PASSED] single_pixel_source_buffer
[17:01:49] [PASSED] single_pixel_clip_rectangle
[17:01:49] [PASSED] well_known_colors
[17:01:49] [PASSED] destination_pitch
[17:01:49] ========= [PASSED] drm_test_fb_xrgb8888_to_rgb332 ==========
[17:01:49] ============= drm_test_fb_xrgb8888_to_rgb565  ==============
[17:01:49] [PASSED] single_pixel_source_buffer
[17:01:49] [PASSED] single_pixel_clip_rectangle
[17:01:49] [PASSED] well_known_colors
[17:01:49] [PASSED] destination_pitch
[17:01:49] ========= [PASSED] drm_test_fb_xrgb8888_to_rgb565 ==========
[17:01:49] ============ drm_test_fb_xrgb8888_to_xrgb1555  =============
[17:01:49] [PASSED] single_pixel_source_buffer
[17:01:49] [PASSED] single_pixel_clip_rectangle
[17:01:49] [PASSED] well_known_colors
[17:01:49] [PASSED] destination_pitch
[17:01:49] ======== [PASSED] drm_test_fb_xrgb8888_to_xrgb1555 =========
[17:01:49] ============ drm_test_fb_xrgb8888_to_argb1555  =============
[17:01:49] [PASSED] single_pixel_source_buffer
[17:01:49] [PASSED] single_pixel_clip_rectangle
[17:01:49] [PASSED] well_known_colors
[17:01:49] [PASSED] destination_pitch
[17:01:49] ======== [PASSED] drm_test_fb_xrgb8888_to_argb1555 =========
[17:01:49] ============ drm_test_fb_xrgb8888_to_rgba5551  =============
[17:01:49] [PASSED] single_pixel_source_buffer
[17:01:49] [PASSED] single_pixel_clip_rectangle
[17:01:49] [PASSED] well_known_colors
[17:01:49] [PASSED] destination_pitch
[17:01:49] ======== [PASSED] drm_test_fb_xrgb8888_to_rgba5551 =========
[17:01:49] ============= drm_test_fb_xrgb8888_to_rgb888  ==============
[17:01:49] [PASSED] single_pixel_source_buffer
[17:01:49] [PASSED] single_pixel_clip_rectangle
[17:01:49] [PASSED] well_known_colors
[17:01:49] [PASSED] destination_pitch
[17:01:49] ========= [PASSED] drm_test_fb_xrgb8888_to_rgb888 ==========
[17:01:49] ============= drm_test_fb_xrgb8888_to_bgr888  ==============
[17:01:49] [PASSED] single_pixel_source_buffer
[17:01:49] [PASSED] single_pixel_clip_rectangle
[17:01:49] [PASSED] well_known_colors
[17:01:49] [PASSED] destination_pitch
[17:01:49] ========= [PASSED] drm_test_fb_xrgb8888_to_bgr888 ==========
[17:01:49] ============ drm_test_fb_xrgb8888_to_argb8888  =============
[17:01:49] [PASSED] single_pixel_source_buffer
[17:01:49] [PASSED] single_pixel_clip_rectangle
[17:01:49] [PASSED] well_known_colors
[17:01:49] [PASSED] destination_pitch
[17:01:49] ======== [PASSED] drm_test_fb_xrgb8888_to_argb8888 =========
[17:01:49] =========== drm_test_fb_xrgb8888_to_xrgb2101010  ===========
[17:01:49] [PASSED] single_pixel_source_buffer
[17:01:49] [PASSED] single_pixel_clip_rectangle
[17:01:49] [PASSED] well_known_colors
[17:01:49] [PASSED] destination_pitch
[17:01:49] ======= [PASSED] drm_test_fb_xrgb8888_to_xrgb2101010 =======
[17:01:49] =========== drm_test_fb_xrgb8888_to_argb2101010  ===========
[17:01:49] [PASSED] single_pixel_source_buffer
[17:01:49] [PASSED] single_pixel_clip_rectangle
[17:01:49] [PASSED] well_known_colors
[17:01:49] [PASSED] destination_pitch
[17:01:49] ======= [PASSED] drm_test_fb_xrgb8888_to_argb2101010 =======
[17:01:49] ============== drm_test_fb_xrgb8888_to_mono  ===============
[17:01:49] [PASSED] single_pixel_source_buffer
[17:01:49] [PASSED] single_pixel_clip_rectangle
[17:01:49] [PASSED] well_known_colors
[17:01:49] [PASSED] destination_pitch
[17:01:49] ========== [PASSED] drm_test_fb_xrgb8888_to_mono ===========
[17:01:49] ==================== drm_test_fb_swab  =====================
[17:01:49] [PASSED] single_pixel_source_buffer
[17:01:49] [PASSED] single_pixel_clip_rectangle
[17:01:49] [PASSED] well_known_colors
[17:01:49] [PASSED] destination_pitch
[17:01:49] ================ [PASSED] drm_test_fb_swab =================
[17:01:49] ============ drm_test_fb_xrgb8888_to_xbgr8888  =============
[17:01:49] [PASSED] single_pixel_source_buffer
[17:01:49] [PASSED] single_pixel_clip_rectangle
[17:01:49] [PASSED] well_known_colors
[17:01:49] [PASSED] destination_pitch
[17:01:49] ======== [PASSED] drm_test_fb_xrgb8888_to_xbgr8888 =========
[17:01:49] ============ drm_test_fb_xrgb8888_to_abgr8888  =============
[17:01:49] [PASSED] single_pixel_source_buffer
[17:01:49] [PASSED] single_pixel_clip_rectangle
[17:01:49] [PASSED] well_known_colors
[17:01:49] [PASSED] destination_pitch
[17:01:49] ======== [PASSED] drm_test_fb_xrgb8888_to_abgr8888 =========
[17:01:49] ================= drm_test_fb_clip_offset  =================
[17:01:49] [PASSED] pass through
[17:01:49] [PASSED] horizontal offset
[17:01:49] [PASSED] vertical offset
[17:01:49] [PASSED] horizontal and vertical offset
[17:01:49] [PASSED] horizontal offset (custom pitch)
[17:01:49] [PASSED] vertical offset (custom pitch)
[17:01:49] [PASSED] horizontal and vertical offset (custom pitch)
[17:01:49] ============= [PASSED] drm_test_fb_clip_offset =============
[17:01:49] ============== drm_test_fb_build_fourcc_list  ==============
[17:01:49] [PASSED] no native formats
[17:01:49] [PASSED] XRGB8888 as native format
[17:01:49] [PASSED] remove duplicates
[17:01:49] [PASSED] convert alpha formats
[17:01:49] [PASSED] random formats
[17:01:49] ========== [PASSED] drm_test_fb_build_fourcc_list ==========
[17:01:49] =================== drm_test_fb_memcpy  ====================
[17:01:49] [PASSED] single_pixel_source_buffer: XR24 little-endian (0x34325258)
[17:01:49] [PASSED] single_pixel_source_buffer: XRA8 little-endian (0x38415258)
[17:01:49] [PASSED] single_pixel_source_buffer: YU24 little-endian (0x34325559)
[17:01:49] [PASSED] single_pixel_clip_rectangle: XB24 little-endian (0x34324258)
[17:01:49] [PASSED] single_pixel_clip_rectangle: XRA8 little-endian (0x38415258)
[17:01:49] [PASSED] single_pixel_clip_rectangle: YU24 little-endian (0x34325559)
[17:01:49] [PASSED] well_known_colors: XB24 little-endian (0x34324258)
[17:01:49] [PASSED] well_known_colors: XRA8 little-endian (0x38415258)
[17:01:49] [PASSED] well_known_colors: YU24 little-endian (0x34325559)
[17:01:49] [PASSED] destination_pitch: XB24 little-endian (0x34324258)
[17:01:49] [PASSED] destination_pitch: XRA8 little-endian (0x38415258)
[17:01:49] [PASSED] destination_pitch: YU24 little-endian (0x34325559)
[17:01:49] =============== [PASSED] drm_test_fb_memcpy ================
[17:01:49] ============= [PASSED] drm_format_helper_test ==============
[17:01:49] ================= drm_format (18 subtests) =================
[17:01:49] [PASSED] drm_test_format_block_width_invalid
[17:01:49] [PASSED] drm_test_format_block_width_one_plane
[17:01:49] [PASSED] drm_test_format_block_width_two_plane
[17:01:49] [PASSED] drm_test_format_block_width_three_plane
[17:01:49] [PASSED] drm_test_format_block_width_tiled
[17:01:49] [PASSED] drm_test_format_block_height_invalid
[17:01:49] [PASSED] drm_test_format_block_height_one_plane
[17:01:49] [PASSED] drm_test_format_block_height_two_plane
[17:01:49] [PASSED] drm_test_format_block_height_three_plane
[17:01:49] [PASSED] drm_test_format_block_height_tiled
[17:01:49] [PASSED] drm_test_format_min_pitch_invalid
[17:01:49] [PASSED] drm_test_format_min_pitch_one_plane_8bpp
[17:01:49] [PASSED] drm_test_format_min_pitch_one_plane_16bpp
[17:01:49] [PASSED] drm_test_format_min_pitch_one_plane_24bpp
[17:01:49] [PASSED] drm_test_format_min_pitch_one_plane_32bpp
[17:01:49] [PASSED] drm_test_format_min_pitch_two_plane
[17:01:49] [PASSED] drm_test_format_min_pitch_three_plane_8bpp
[17:01:49] [PASSED] drm_test_format_min_pitch_tiled
[17:01:49] =================== [PASSED] drm_format ====================
[17:01:49] ============== drm_framebuffer (10 subtests) ===============
[17:01:49] ========== drm_test_framebuffer_check_src_coords  ==========
[17:01:49] [PASSED] Success: source fits into fb
[17:01:49] [PASSED] Fail: overflowing fb with x-axis coordinate
[17:01:49] [PASSED] Fail: overflowing fb with y-axis coordinate
[17:01:49] [PASSED] Fail: overflowing fb with source width
[17:01:49] [PASSED] Fail: overflowing fb with source height
[17:01:49] ====== [PASSED] drm_test_framebuffer_check_src_coords ======
[17:01:49] [PASSED] drm_test_framebuffer_cleanup
[17:01:49] =============== drm_test_framebuffer_create  ===============
[17:01:49] [PASSED] ABGR8888 normal sizes
[17:01:49] [PASSED] ABGR8888 max sizes
[17:01:49] [PASSED] ABGR8888 pitch greater than min required
[17:01:49] [PASSED] ABGR8888 pitch less than min required
[17:01:49] [PASSED] ABGR8888 Invalid width
[17:01:49] [PASSED] ABGR8888 Invalid buffer handle
[17:01:49] [PASSED] No pixel format
[17:01:49] [PASSED] ABGR8888 Width 0
[17:01:49] [PASSED] ABGR8888 Height 0
[17:01:49] [PASSED] ABGR8888 Out of bound height * pitch combination
[17:01:49] [PASSED] ABGR8888 Large buffer offset
[17:01:49] [PASSED] ABGR8888 Buffer offset for inexistent plane
[17:01:49] [PASSED] ABGR8888 Invalid flag
[17:01:49] [PASSED] ABGR8888 Set DRM_MODE_FB_MODIFIERS without modifiers
[17:01:49] [PASSED] ABGR8888 Valid buffer modifier
[17:01:49] [PASSED] ABGR8888 Invalid buffer modifier(DRM_FORMAT_MOD_SAMSUNG_64_32_TILE)
[17:01:49] [PASSED] ABGR8888 Extra pitches without DRM_MODE_FB_MODIFIERS
[17:01:49] [PASSED] ABGR8888 Extra pitches with DRM_MODE_FB_MODIFIERS
[17:01:49] [PASSED] NV12 Normal sizes
[17:01:49] [PASSED] NV12 Max sizes
[17:01:49] [PASSED] NV12 Invalid pitch
[17:01:49] [PASSED] NV12 Invalid modifier/missing DRM_MODE_FB_MODIFIERS flag
[17:01:49] [PASSED] NV12 different  modifier per-plane
[17:01:49] [PASSED] NV12 with DRM_FORMAT_MOD_SAMSUNG_64_32_TILE
[17:01:49] [PASSED] NV12 Valid modifiers without DRM_MODE_FB_MODIFIERS
[17:01:49] [PASSED] NV12 Modifier for inexistent plane
[17:01:49] [PASSED] NV12 Handle for inexistent plane
[17:01:49] [PASSED] NV12 Handle for inexistent plane without DRM_MODE_FB_MODIFIERS
[17:01:49] [PASSED] YVU420 DRM_MODE_FB_MODIFIERS set without modifier
[17:01:49] [PASSED] YVU420 Normal sizes
[17:01:49] [PASSED] YVU420 Max sizes
[17:01:49] [PASSED] YVU420 Invalid pitch
[17:01:49] [PASSED] YVU420 Different pitches
[17:01:49] [PASSED] YVU420 Different buffer offsets/pitches
[17:01:49] [PASSED] YVU420 Modifier set just for plane 0, without DRM_MODE_FB_MODIFIERS
[17:01:49] [PASSED] YVU420 Modifier set just for planes 0, 1, without DRM_MODE_FB_MODIFIERS
[17:01:49] [PASSED] YVU420 Modifier set just for plane 0, 1, with DRM_MODE_FB_MODIFIERS
[17:01:49] [PASSED] YVU420 Valid modifier
[17:01:49] [PASSED] YVU420 Different modifiers per plane
[17:01:49] [PASSED] YVU420 Modifier for inexistent plane
[17:01:49] [PASSED] YUV420_10BIT Invalid modifier(DRM_FORMAT_MOD_LINEAR)
[17:01:49] [PASSED] X0L2 Normal sizes
[17:01:49] [PASSED] X0L2 Max sizes
[17:01:49] [PASSED] X0L2 Invalid pitch
[17:01:49] [PASSED] X0L2 Pitch greater than minimum required
[17:01:49] [PASSED] X0L2 Handle for inexistent plane
[17:01:49] [PASSED] X0L2 Offset for inexistent plane, without DRM_MODE_FB_MODIFIERS set
[17:01:49] [PASSED] X0L2 Modifier without DRM_MODE_FB_MODIFIERS set
[17:01:49] [PASSED] X0L2 Valid modifier
[17:01:49] [PASSED] X0L2 Modifier for inexistent plane
[17:01:49] =========== [PASSED] drm_test_framebuffer_create ===========
[17:01:49] [PASSED] drm_test_framebuffer_free
[17:01:49] [PASSED] drm_test_framebuffer_init
[17:01:49] [PASSED] drm_test_framebuffer_init_bad_format
[17:01:49] [PASSED] drm_test_framebuffer_init_dev_mismatch
[17:01:49] [PASSED] drm_test_framebuffer_lookup
[17:01:49] [PASSED] drm_test_framebuffer_lookup_inexistent
[17:01:49] [PASSED] drm_test_framebuffer_modifiers_not_supported
[17:01:49] ================= [PASSED] drm_framebuffer =================
[17:01:49] ================ drm_gem_shmem (8 subtests) ================
[17:01:49] [PASSED] drm_gem_shmem_test_obj_create
[17:01:49] [PASSED] drm_gem_shmem_test_obj_create_private
[17:01:49] [PASSED] drm_gem_shmem_test_pin_pages
[17:01:49] [PASSED] drm_gem_shmem_test_vmap
[17:01:49] [PASSED] drm_gem_shmem_test_get_pages_sgt
[17:01:49] [PASSED] drm_gem_shmem_test_get_sg_table
[17:01:49] [PASSED] drm_gem_shmem_test_madvise
[17:01:49] [PASSED] drm_gem_shmem_test_purge
[17:01:49] ================== [PASSED] drm_gem_shmem ==================
[17:01:49] === drm_atomic_helper_connector_hdmi_check (23 subtests) ===
[17:01:49] [PASSED] drm_test_check_broadcast_rgb_auto_cea_mode
[17:01:49] [PASSED] drm_test_check_broadcast_rgb_auto_cea_mode_vic_1
[17:01:49] [PASSED] drm_test_check_broadcast_rgb_full_cea_mode
[17:01:49] [PASSED] drm_test_check_broadcast_rgb_full_cea_mode_vic_1
[17:01:49] [PASSED] drm_test_check_broadcast_rgb_limited_cea_mode
[17:01:49] [PASSED] drm_test_check_broadcast_rgb_limited_cea_mode_vic_1
[17:01:49] [PASSED] drm_test_check_broadcast_rgb_crtc_mode_changed
[17:01:49] [PASSED] drm_test_check_broadcast_rgb_crtc_mode_not_changed
[17:01:49] [PASSED] drm_test_check_disable_connector
[17:01:49] [PASSED] drm_test_check_hdmi_funcs_reject_rate
[17:01:49] [PASSED] drm_test_check_max_tmds_rate_bpc_fallback
[17:01:49] [PASSED] drm_test_check_max_tmds_rate_format_fallback
[17:01:49] [PASSED] drm_test_check_output_bpc_crtc_mode_changed
[17:01:49] [PASSED] drm_test_check_output_bpc_crtc_mode_not_changed
[17:01:49] [PASSED] drm_test_check_output_bpc_dvi
[17:01:49] [PASSED] drm_test_check_output_bpc_format_vic_1
[17:01:49] [PASSED] drm_test_check_output_bpc_format_display_8bpc_only
[17:01:49] [PASSED] drm_test_check_output_bpc_format_display_rgb_only
[17:01:49] [PASSED] drm_test_check_output_bpc_format_driver_8bpc_only
[17:01:49] [PASSED] drm_test_check_output_bpc_format_driver_rgb_only
[17:01:49] [PASSED] drm_test_check_tmds_char_rate_rgb_8bpc
[17:01:49] [PASSED] drm_test_check_tmds_char_rate_rgb_10bpc
[17:01:49] [PASSED] drm_test_check_tmds_char_rate_rgb_12bpc
[17:01:49] ===== [PASSED] drm_atomic_helper_connector_hdmi_check ======
[17:01:49] === drm_atomic_helper_connector_hdmi_reset (6 subtests) ====
[17:01:49] [PASSED] drm_test_check_broadcast_rgb_value
[17:01:49] [PASSED] drm_test_check_bpc_8_value
[17:01:49] [PASSED] drm_test_check_bpc_10_value
[17:01:49] [PASSED] drm_test_check_bpc_12_value
[17:01:49] [PASSED] drm_test_check_format_value
[17:01:49] [PASSED] drm_test_check_tmds_char_value
[17:01:49] ===== [PASSED] drm_atomic_helper_connector_hdmi_reset ======
[17:01:49] = drm_atomic_helper_connector_hdmi_mode_valid (4 subtests) =
[17:01:49] [PASSED] drm_test_check_mode_valid
[17:01:49] [PASSED] drm_test_check_mode_valid_reject
[17:01:49] [PASSED] drm_test_check_mode_valid_reject_rate
[17:01:49] [PASSED] drm_test_check_mode_valid_reject_max_clock
[17:01:49] === [PASSED] drm_atomic_helper_connector_hdmi_mode_valid ===
[17:01:49] ================= drm_managed (2 subtests) =================
[17:01:49] [PASSED] drm_test_managed_release_action
[17:01:49] [PASSED] drm_test_managed_run_action
[17:01:49] =================== [PASSED] drm_managed ===================
[17:01:49] =================== drm_mm (6 subtests) ====================
[17:01:49] [PASSED] drm_test_mm_init
[17:01:49] [PASSED] drm_test_mm_debug
[17:01:49] [PASSED] drm_test_mm_align32
[17:01:49] [PASSED] drm_test_mm_align64
[17:01:49] [PASSED] drm_test_mm_lowest
[17:01:49] [PASSED] drm_test_mm_highest
[17:01:49] ===================== [PASSED] drm_mm ======================
[17:01:49] ============= drm_modes_analog_tv (5 subtests) =============
[17:01:49] [PASSED] drm_test_modes_analog_tv_mono_576i
[17:01:49] [PASSED] drm_test_modes_analog_tv_ntsc_480i
[17:01:49] [PASSED] drm_test_modes_analog_tv_ntsc_480i_inlined
[17:01:49] [PASSED] drm_test_modes_analog_tv_pal_576i
[17:01:49] [PASSED] drm_test_modes_analog_tv_pal_576i_inlined
[17:01:49] =============== [PASSED] drm_modes_analog_tv ===============
[17:01:49] ============== drm_plane_helper (2 subtests) ===============
[17:01:49] =============== drm_test_check_plane_state  ================
[17:01:49] [PASSED] clipping_simple
[17:01:49] [PASSED] clipping_rotate_reflect
[17:01:49] [PASSED] positioning_simple
[17:01:49] [PASSED] upscaling
[17:01:49] [PASSED] downscaling
[17:01:49] [PASSED] rounding1
[17:01:49] [PASSED] rounding2
[17:01:49] [PASSED] rounding3
[17:01:49] [PASSED] rounding4
[17:01:49] =========== [PASSED] drm_test_check_plane_state ============
[17:01:49] =========== drm_test_check_invalid_plane_state  ============
[17:01:49] [PASSED] positioning_invalid
[17:01:49] [PASSED] upscaling_invalid
[17:01:49] [PASSED] downscaling_invalid
[17:01:49] ======= [PASSED] drm_test_check_invalid_plane_state ========
[17:01:49] ================ [PASSED] drm_plane_helper =================
[17:01:49] ====== drm_connector_helper_tv_get_modes (1 subtest) =======
[17:01:49] ====== drm_test_connector_helper_tv_get_modes_check  =======
[17:01:49] [PASSED] None
[17:01:49] [PASSED] PAL
[17:01:49] [PASSED] NTSC
[17:01:49] [PASSED] Both, NTSC Default
[17:01:49] [PASSED] Both, PAL Default
[17:01:49] [PASSED] Both, NTSC Default, with PAL on command-line
[17:01:49] [PASSED] Both, PAL Default, with NTSC on command-line
[17:01:49] == [PASSED] drm_test_connector_helper_tv_get_modes_check ===
[17:01:49] ======== [PASSED] drm_connector_helper_tv_get_modes ========
[17:01:49] ================== drm_rect (9 subtests) ===================
[17:01:49] [PASSED] drm_test_rect_clip_scaled_div_by_zero
[17:01:49] [PASSED] drm_test_rect_clip_scaled_not_clipped
[17:01:49] [PASSED] drm_test_rect_clip_scaled_clipped
[17:01:49] [PASSED] drm_test_rect_clip_scaled_signed_vs_unsigned
[17:01:49] ================= drm_test_rect_intersect  =================
[17:01:49] [PASSED] top-left x bottom-right: 2x2+1+1 x 2x2+0+0
[17:01:49] [PASSED] top-right x bottom-left: 2x2+0+0 x 2x2+1-1
[17:01:49] [PASSED] bottom-left x top-right: 2x2+1-1 x 2x2+0+0
[17:01:49] [PASSED] bottom-right x top-left: 2x2+0+0 x 2x2+1+1
[17:01:49] [PASSED] right x left: 2x1+0+0 x 3x1+1+0
[17:01:49] [PASSED] left x right: 3x1+1+0 x 2x1+0+0
[17:01:49] [PASSED] up x bottom: 1x2+0+0 x 1x3+0-1
[17:01:49] [PASSED] bottom x up: 1x3+0-1 x 1x2+0+0
[17:01:49] [PASSED] touching corner: 1x1+0+0 x 2x2+1+1
[17:01:49] [PASSED] touching side: 1x1+0+0 x 1x1+1+0
[17:01:49] [PASSED] equal rects: 2x2+0+0 x 2x2+0+0
[17:01:49] [PASSED] inside another: 2x2+0+0 x 1x1+1+1
[17:01:49] [PASSED] far away: 1x1+0+0 x 1x1+3+6
[17:01:49] [PASSED] points intersecting: 0x0+5+10 x 0x0+5+10
[17:01:49] [PASSED] points not intersecting: 0x0+0+0 x 0x0+5+10
[17:01:49] ============= [PASSED] drm_test_rect_intersect =============
[17:01:49] ================ drm_test_rect_calc_hscale  ================
[17:01:49] [PASSED] normal use
[17:01:49] [PASSED] out of max range
[17:01:49] [PASSED] out of min range
[17:01:49] [PASSED] zero dst
[17:01:49] [PASSED] negative src
[17:01:49] [PASSED] negative dst
[17:01:49] ============ [PASSED] drm_test_rect_calc_hscale ============
[17:01:49] ================ drm_test_rect_calc_vscale  ================
[17:01:49] [PASSED] normal use
[17:01:49] [PASSED] out of max range
[17:01:49] [PASSED] out of min range
[17:01:49] [PASSED] zero dst
[17:01:49] [PASSED] negative src
[17:01:49] [PASSED] negative dst
[17:01:49] ============ [PASSED] drm_test_rect_calc_vscale ============
[17:01:49] ================== drm_test_rect_rotate  ===================
[17:01:49] [PASSED] reflect-x
[17:01:49] [PASSED] reflect-y
[17:01:49] [PASSED] rotate-0
[17:01:49] [PASSED] rotate-90
[17:01:49] [PASSED] rotate-180
[17:01:49] [PASSED] rotate-270
[17:01:49] ============== [PASSED] drm_test_rect_rotate ===============
[17:01:49] ================ drm_test_rect_rotate_inv  =================
[17:01:49] [PASSED] reflect-x
[17:01:49] [PASSED] reflect-y
[17:01:49] [PASSED] rotate-0
[17:01:49] [PASSED] rotate-90
[17:01:49] [PASSED] rotate-180
[17:01:49] [PASSED] rotate-270
[17:01:49] ============ [PASSED] drm_test_rect_rotate_inv =============
stty: 'standard input': Inappropriate ioctl for device
[17:01:49] ==================== [PASSED] drm_rect =====================
[17:01:49] ============================================================
[17:01:49] Testing complete. Ran 608 tests: passed: 608
[17:01:49] Elapsed time: 23.226s total, 1.783s configuring, 21.276s building, 0.143s running

+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/ttm/tests/.kunitconfig
[17:01:49] Configuring KUnit Kernel ...
Regenerating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
[17:01:51] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=48
[17:01:59] Starting KUnit Kernel (1/1)...
[17:01:59] ============================================================
Running tests with:
$ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
[17:01:59] ================= ttm_device (5 subtests) ==================
[17:01:59] [PASSED] ttm_device_init_basic
[17:01:59] [PASSED] ttm_device_init_multiple
[17:01:59] [PASSED] ttm_device_fini_basic
[17:01:59] [PASSED] ttm_device_init_no_vma_man
[17:01:59] ================== ttm_device_init_pools  ==================
[17:01:59] [PASSED] No DMA allocations, no DMA32 required
[17:01:59] [PASSED] DMA allocations, DMA32 required
[17:01:59] [PASSED] No DMA allocations, DMA32 required
[17:01:59] [PASSED] DMA allocations, no DMA32 required
[17:01:59] ============== [PASSED] ttm_device_init_pools ==============
[17:01:59] =================== [PASSED] ttm_device ====================
[17:01:59] ================== ttm_pool (8 subtests) ===================
[17:01:59] ================== ttm_pool_alloc_basic  ===================
[17:01:59] [PASSED] One page
[17:01:59] [PASSED] More than one page
[17:01:59] [PASSED] Above the allocation limit
[17:01:59] [PASSED] One page, with coherent DMA mappings enabled
[17:01:59] [PASSED] Above the allocation limit, with coherent DMA mappings enabled
[17:01:59] ============== [PASSED] ttm_pool_alloc_basic ===============
[17:01:59] ============== ttm_pool_alloc_basic_dma_addr  ==============
[17:01:59] [PASSED] One page
[17:01:59] [PASSED] More than one page
[17:01:59] [PASSED] Above the allocation limit
[17:01:59] [PASSED] One page, with coherent DMA mappings enabled
[17:01:59] [PASSED] Above the allocation limit, with coherent DMA mappings enabled
[17:01:59] ========== [PASSED] ttm_pool_alloc_basic_dma_addr ==========
[17:01:59] [PASSED] ttm_pool_alloc_order_caching_match
[17:01:59] [PASSED] ttm_pool_alloc_caching_mismatch
[17:01:59] [PASSED] ttm_pool_alloc_order_mismatch
[17:01:59] [PASSED] ttm_pool_free_dma_alloc
[17:01:59] [PASSED] ttm_pool_free_no_dma_alloc
[17:01:59] [PASSED] ttm_pool_fini_basic
[17:01:59] ==================== [PASSED] ttm_pool =====================
[17:01:59] ================ ttm_resource (8 subtests) =================
[17:01:59] ================= ttm_resource_init_basic  =================
[17:01:59] [PASSED] Init resource in TTM_PL_SYSTEM
[17:01:59] [PASSED] Init resource in TTM_PL_VRAM
[17:01:59] [PASSED] Init resource in a private placement
[17:01:59] [PASSED] Init resource in TTM_PL_SYSTEM, set placement flags
[17:01:59] ============= [PASSED] ttm_resource_init_basic =============
[17:01:59] [PASSED] ttm_resource_init_pinned
[17:01:59] [PASSED] ttm_resource_fini_basic
[17:01:59] [PASSED] ttm_resource_manager_init_basic
[17:01:59] [PASSED] ttm_resource_manager_usage_basic
[17:01:59] [PASSED] ttm_resource_manager_set_used_basic
[17:01:59] [PASSED] ttm_sys_man_alloc_basic
[17:01:59] [PASSED] ttm_sys_man_free_basic
[17:01:59] ================== [PASSED] ttm_resource ===================
[17:01:59] =================== ttm_tt (15 subtests) ===================
[17:01:59] ==================== ttm_tt_init_basic  ====================
[17:01:59] [PASSED] Page-aligned size
[17:01:59] [PASSED] Extra pages requested
[17:01:59] ================ [PASSED] ttm_tt_init_basic ================
[17:01:59] [PASSED] ttm_tt_init_misaligned
[17:01:59] [PASSED] ttm_tt_fini_basic
[17:01:59] [PASSED] ttm_tt_fini_sg
[17:01:59] [PASSED] ttm_tt_fini_shmem
[17:01:59] [PASSED] ttm_tt_create_basic
[17:01:59] [PASSED] ttm_tt_create_invalid_bo_type
[17:01:59] [PASSED] ttm_tt_create_ttm_exists
[17:01:59] [PASSED] ttm_tt_create_failed
[17:01:59] [PASSED] ttm_tt_destroy_basic
[17:01:59] [PASSED] ttm_tt_populate_null_ttm
[17:01:59] [PASSED] ttm_tt_populate_populated_ttm
[17:01:59] [PASSED] ttm_tt_unpopulate_basic
[17:01:59] [PASSED] ttm_tt_unpopulate_empty_ttm
[17:01:59] [PASSED] ttm_tt_swapin_basic
[17:01:59] ===================== [PASSED] ttm_tt ======================
[17:01:59] =================== ttm_bo (14 subtests) ===================
[17:01:59] =========== ttm_bo_reserve_optimistic_no_ticket  ===========
[17:01:59] [PASSED] Cannot be interrupted and sleeps
[17:01:59] [PASSED] Cannot be interrupted, locks straight away
[17:01:59] [PASSED] Can be interrupted, sleeps
[17:01:59] ======= [PASSED] ttm_bo_reserve_optimistic_no_ticket =======
[17:01:59] [PASSED] ttm_bo_reserve_locked_no_sleep
[17:01:59] [PASSED] ttm_bo_reserve_no_wait_ticket
[17:01:59] [PASSED] ttm_bo_reserve_double_resv
[17:01:59] [PASSED] ttm_bo_reserve_interrupted
[17:01:59] [PASSED] ttm_bo_reserve_deadlock
[17:01:59] [PASSED] ttm_bo_unreserve_basic
[17:01:59] [PASSED] ttm_bo_unreserve_pinned
[17:01:59] [PASSED] ttm_bo_unreserve_bulk
[17:01:59] [PASSED] ttm_bo_put_basic
[17:01:59] [PASSED] ttm_bo_put_shared_resv
[17:01:59] [PASSED] ttm_bo_pin_basic
[17:01:59] [PASSED] ttm_bo_pin_unpin_resource
[17:01:59] [PASSED] ttm_bo_multiple_pin_one_unpin
[17:01:59] ===================== [PASSED] ttm_bo ======================
[17:01:59] ============== ttm_bo_validate (22 subtests) ===============
[17:01:59] ============== ttm_bo_init_reserved_sys_man  ===============
[17:01:59] [PASSED] Buffer object for userspace
[17:01:59] [PASSED] Kernel buffer object
[17:01:59] [PASSED] Shared buffer object
[17:01:59] ========== [PASSED] ttm_bo_init_reserved_sys_man ===========
[17:01:59] ============== ttm_bo_init_reserved_mock_man  ==============
[17:01:59] [PASSED] Buffer object for userspace
[17:01:59] [PASSED] Kernel buffer object
[17:01:59] [PASSED] Shared buffer object
[17:01:59] ========== [PASSED] ttm_bo_init_reserved_mock_man ==========
[17:01:59] [PASSED] ttm_bo_init_reserved_resv
[17:01:59] ================== ttm_bo_validate_basic  ==================
[17:01:59] [PASSED] Buffer object for userspace
[17:01:59] [PASSED] Kernel buffer object
[17:01:59] [PASSED] Shared buffer object
[17:01:59] ============== [PASSED] ttm_bo_validate_basic ==============
[17:01:59] [PASSED] ttm_bo_validate_invalid_placement
[17:01:59] ============= ttm_bo_validate_same_placement  ==============
[17:01:59] [PASSED] System manager
[17:01:59] [PASSED] VRAM manager
[17:01:59] ========= [PASSED] ttm_bo_validate_same_placement ==========
[17:01:59] [PASSED] ttm_bo_validate_failed_alloc
[17:01:59] [PASSED] ttm_bo_validate_pinned
[17:01:59] [PASSED] ttm_bo_validate_busy_placement
[17:01:59] ================ ttm_bo_validate_multihop  =================
[17:01:59] [PASSED] Buffer object for userspace
[17:01:59] [PASSED] Kernel buffer object
[17:01:59] [PASSED] Shared buffer object
[17:01:59] ============ [PASSED] ttm_bo_validate_multihop =============
[17:01:59] ========== ttm_bo_validate_no_placement_signaled  ==========
[17:01:59] [PASSED] Buffer object in system domain, no page vector
[17:01:59] [PASSED] Buffer object in system domain with an existing page vector
[17:01:59] ====== [PASSED] ttm_bo_validate_no_placement_signaled ======
[17:01:59] ======== ttm_bo_validate_no_placement_not_signaled  ========
[17:01:59] [PASSED] Buffer object for userspace
[17:01:59] [PASSED] Kernel buffer object
[17:01:59] [PASSED] Shared buffer object
[17:01:59] ==== [PASSED] ttm_bo_validate_no_placement_not_signaled ====
[17:01:59] [PASSED] ttm_bo_validate_move_fence_signaled
[17:01:59] ========= ttm_bo_validate_move_fence_not_signaled  =========
[17:01:59] [PASSED] Waits for GPU
[17:01:59] [PASSED] Tries to lock straight away
[17:01:59] ===== [PASSED] ttm_bo_validate_move_fence_not_signaled =====
[17:01:59] [PASSED] ttm_bo_validate_swapout
[17:01:59] [PASSED] ttm_bo_validate_happy_evict
[17:01:59] [PASSED] ttm_bo_validate_all_pinned_evict
[17:01:59] [PASSED] ttm_bo_validate_allowed_only_evict
[17:01:59] [PASSED] ttm_bo_validate_deleted_evict
[17:01:59] [PASSED] ttm_bo_validate_busy_domain_evict
[17:01:59] [PASSED] ttm_bo_validate_evict_gutting
[17:01:59] [PASSED] ttm_bo_validate_recrusive_evict
stty: 'standard input': Inappropriate ioctl for device
[17:01:59] ================= [PASSED] ttm_bo_validate =================
[17:01:59] ============================================================
[17:01:59] Testing complete. Ran 102 tests: passed: 102
[17:01:59] Elapsed time: 10.467s total, 1.781s configuring, 8.020s building, 0.564s running

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



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

* ✗ CI.Build: failure for Prefetch Support for svm ranges (rev6)
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (22 preceding siblings ...)
  2025-05-12 17:02 ` ✓ CI.KUnit: success " Patchwork
@ 2025-05-12 17:12 ` Patchwork
  2025-05-13  1:46 ` ✗ CI.Patch_applied: failure for Prefetch Support for svm ranges (rev7) Patchwork
                   ` (2 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Patchwork @ 2025-05-12 17:12 UTC (permalink / raw)
  To: Himal Prasad Ghimiray; +Cc: intel-xe

== Series Details ==

Series: Prefetch Support for svm ranges (rev6)
URL   : https://patchwork.freedesktop.org/series/146079/
State : failure

== Summary ==

INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/bridge/netfilter/ebt_arpreply.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/bridge/netfilter/ebt_vlan.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/bridge/netfilter/ebt_mark.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/bridge/netfilter/ebt_dnat.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/bridge/netfilter/ebt_redirect.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/bridge/netfilter/ebt_arpreply.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/bridge/netfilter/ebt_mark.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/bridge/netfilter/ebt_dnat.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/bridge/netfilter/ebt_redirect.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/bridge/netfilter/ebt_snat.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/bridge/netfilter/ebt_log.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/bridge/netfilter/ebt_nflog.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/bridge/bridge.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/bridge/netfilter/ebt_snat.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/bridge/netfilter/ebt_log.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/bridge/netfilter/ebt_nflog.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/bridge/br_netfilter.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/sunrpc/sunrpc.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/sunrpc/auth_gss/auth_rpcgss.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/sunrpc/auth_gss/rpcsec_gss_krb5.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/kcm/kcm.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/bridge/bridge.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/bridge/br_netfilter.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/l2tp/l2tp_core.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/sunrpc/auth_gss/rpcsec_gss_krb5.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/l2tp/l2tp_ip.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/sunrpc/auth_gss/auth_rpcgss.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/kcm/kcm.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/l2tp/l2tp_netlink.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/l2tp/l2tp_eth.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/l2tp/l2tp_debugfs.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/l2tp/l2tp_core.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/l2tp/l2tp_ip.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/l2tp/l2tp_ip6.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/sunrpc/sunrpc.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/l2tp/l2tp_netlink.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/l2tp/l2tp_eth.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/l2tp/l2tp_debugfs.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/dccp/dccp.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/l2tp/l2tp_ip6.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/dccp/dccp_ipv4.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/dccp/dccp_ipv6.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/dccp/dccp.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/dccp/dccp_diag.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/dccp/dccp_ipv4.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/dccp/dccp_ipv6.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/sctp/sctp.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/sctp/sctp_diag.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/rds/rds.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/dccp/dccp_diag.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/rds/rds_tcp.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/9p/9pnet.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/9p/9pnet_fd.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/sctp/sctp_diag.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/9p/9pnet_xen.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/rds/rds.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/rds/rds_tcp.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/9p/9pnet.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/sctp/sctp.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/9p/9pnet_fd.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/9p/9pnet_virtio.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/9p/9pnet_xen.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/psample/psample.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/vmw_vsock/vsock.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/vmw_vsock/vsock_diag.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/vmw_vsock/vmw_vsock_vmci_transport.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/9p/9pnet_virtio.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/psample/psample.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/vmw_vsock/vsock.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/vmw_vsock/vsock_diag.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/vmw_vsock/vmw_vsock_vmci_transport.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/vmw_vsock/vmw_vsock_virtio_transport.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/vmw_vsock/vmw_vsock_virtio_transport_common.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/vmw_vsock/hv_sock.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/vmw_vsock/vsock_loopback.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/vmw_vsock/vmw_vsock_virtio_transport.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/vmw_vsock/vmw_vsock_virtio_transport_common.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/vmw_vsock/hv_sock.ko
  INSTALL debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/virt/lib/irqbypass.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/net/vmw_vsock/vsock_loopback.ko
  STRIP   debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+/kernel/virt/lib/irqbypass.ko
  DEPMOD  debian/linux-image-6.15.0-rc6-xe+/lib/modules/6.15.0-rc6-xe+
dpkg-deb: building package 'linux-headers-6.15.0-rc6-xe+' in '../linux-headers-6.15.0-rc6-xe+_6.15.0~rc6-g2b93fd781bae-2_amd64.deb'.
dpkg-deb: building package 'linux-image-6.15.0-rc6-xe+' in '../linux-image-6.15.0-rc6-xe+_6.15.0~rc6-g2b93fd781bae-2_amd64.deb'.
dpkg-deb: building package 'linux-image-6.15.0-rc6-xe+-dbg' in '../linux-image-6.15.0-rc6-xe+-dbg_6.15.0~rc6-g2b93fd781bae-2_amd64.deb'.
 dpkg-genbuildinfo --build=binary -O../linux-upstream_6.15.0~rc6-g2b93fd781bae-2_amd64.buildinfo
 dpkg-genchanges --build=binary -O../linux-upstream_6.15.0~rc6-g2b93fd781bae-2_amd64.changes
dpkg-genchanges: info: binary-only upload (no source code included)
 dpkg-source --after-build .
dpkg-buildpackage: info: binary-only upload (no source included)
make[1]: Leaving directory '/kernel/build64-debug'
+ mkdir -p kernel-debug/ kernel-debug/deb
+ mv kernel-debug.tar.gz kernel-debug/
+ mv linux-headers-6.15.0-rc6-xe+_6.15.0~rc6-g2b93fd781bae-2_amd64.deb linux-image-6.15.0-rc6-xe+_6.15.0~rc6-g2b93fd781bae-2_amd64.deb linux-image-6.15.0-rc6-xe+-dbg_6.15.0~rc6-g2b93fd781bae-2_amd64.deb linux-libc-dev_6.15.0~rc6-g2b93fd781bae-2_amd64.deb kernel-debug/deb/
+ sync
[+] Finished building and packaging 'debug'!
+ echo '[+] Finished building and packaging '\''debug'\''!'
+ cleanup
++ stat -c %u:%g /kernel
+ chown -R 1003:1003 /kernel



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

* Re: [PATCH v7 17/20] drm/gpusvm: Introduce drm_gpusvm_find_vma_start() function
  2025-05-12 16:47 ` [PATCH v7 17/20] drm/gpusvm: Introduce drm_gpusvm_find_vma_start() function Himal Prasad Ghimiray
@ 2025-05-12 21:24   ` Matthew Brost
  0 siblings, 0 replies; 30+ messages in thread
From: Matthew Brost @ 2025-05-12 21:24 UTC (permalink / raw)
  To: Himal Prasad Ghimiray; +Cc: intel-xe, thomas.hellstrom

On Mon, May 12, 2025 at 10:17:37PM +0530, Himal Prasad Ghimiray wrote:
> The drm_gpusvm_find_vma_start() function is used to determine the starting
> address of a CPU VMA within a specified user range. If the range does not
> contain any VMA, the function returns ULONG_MAX.
> 
> v2
> - Rename function as drm_gpusvm_find_vma_start() (Matthew Brost)
> - mmget/mmput
> 
> v3
> - s/mmget/mmget_not_zero/
> 
> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>

Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> ---
>  drivers/gpu/drm/drm_gpusvm.c | 34 ++++++++++++++++++++++++++++++++++
>  include/drm/drm_gpusvm.h     |  5 +++++
>  2 files changed, 39 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_gpusvm.c b/drivers/gpu/drm/drm_gpusvm.c
> index 4b2f32889f00..7bb9eb71c9aa 100644
> --- a/drivers/gpu/drm/drm_gpusvm.c
> +++ b/drivers/gpu/drm/drm_gpusvm.c
> @@ -980,6 +980,40 @@ static void drm_gpusvm_driver_lock_held(struct drm_gpusvm *gpusvm)
>  }
>  #endif
>  
> +/**
> + * drm_gpusvm_find_vma_start() - Find start address for first VMA in range
> + * @gpusvm: Pointer to the GPU SVM structure
> + * @start: The inclusive start user address.
> + * @end: The exclusive end user address.
> + *
> + * Returns: The start address of first VMA within the provided range,
> + * ULONG_MAX otherwise. Assumes start_addr < end_addr.
> + */
> +unsigned long
> +drm_gpusvm_find_vma_start(struct drm_gpusvm *gpusvm,
> +			  unsigned long start,
> +			  unsigned long end)
> +{
> +	struct mm_struct *mm = gpusvm->mm;
> +	struct vm_area_struct *vma;
> +	unsigned long addr = ULONG_MAX;
> +
> +	if (!mmget_not_zero(mm))
> +		return addr;
> +
> +	mmap_read_lock(mm);
> +
> +	vma = find_vma_intersection(mm, start, end);
> +	if (vma)
> +		addr =  vma->vm_start;
> +
> +	mmap_read_unlock(mm);
> +	mmput(mm);
> +
> +	return addr;
> +}
> +EXPORT_SYMBOL_GPL(drm_gpusvm_find_vma_start);
> +
>  /**
>   * drm_gpusvm_range_find_or_insert() - Find or insert GPU SVM range
>   * @gpusvm: Pointer to the GPU SVM structure
> diff --git a/include/drm/drm_gpusvm.h b/include/drm/drm_gpusvm.h
> index eaf704d3d05e..6a5156476bf4 100644
> --- a/include/drm/drm_gpusvm.h
> +++ b/include/drm/drm_gpusvm.h
> @@ -327,6 +327,11 @@ void drm_gpusvm_fini(struct drm_gpusvm *gpusvm);
>  
>  void drm_gpusvm_free(struct drm_gpusvm *gpusvm);
>  
> +unsigned long
> +drm_gpusvm_find_vma_start(struct drm_gpusvm *gpusvm,
> +			  unsigned long start,
> +			  unsigned long end);
> +
>  struct drm_gpusvm_range *
>  drm_gpusvm_range_find_or_insert(struct drm_gpusvm *gpusvm,
>  				unsigned long fault_addr,
> -- 
> 2.34.1
> 

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

* Re: [PATCH v7 19/20] drm/xe/svm: Implement prefetch support for SVM ranges
  2025-05-12 16:47 ` [PATCH v7 19/20] drm/xe/svm: Implement prefetch support for SVM ranges Himal Prasad Ghimiray
@ 2025-05-12 21:32   ` Matthew Brost
  0 siblings, 0 replies; 30+ messages in thread
From: Matthew Brost @ 2025-05-12 21:32 UTC (permalink / raw)
  To: Himal Prasad Ghimiray; +Cc: intel-xe, thomas.hellstrom

On Mon, May 12, 2025 at 10:17:39PM +0530, Himal Prasad Ghimiray wrote:
> This commit adds prefetch support for SVM ranges, utilizing the
> existing ioctl vm_bind functionality to achieve this.
> 
> v2: rebase
> 
> v3:
>    - use xa_for_each() instead of manual loop
>    - check range is valid and in preferred location before adding to
>      xarray
>    - Fix naming conventions
>    - Fix return condition as -ENODATA instead of -EAGAIN (Matthew Brost)
>    - Handle sparsely populated cpu vma range (Matthew Brost)
> 
> v4:
>    - fix end address to find next cpu vma in case of -ENOENT
> 
> v5:
>    - Move find next vma logic to drm gpusvm layer
>    - Avoid mixing declaration and logic
> 
> v6:
>   - Use new function names
>   - Move eviction logic to prefetch_ranges
> 
> v7:
>   - devmem_only assigned 0
>   - nit address
> 
> Cc: Matthew Brost <matthew.brost@intel.com>
> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
> Acked-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> ---
>  drivers/gpu/drm/xe/xe_pt.c |  58 ++++++++---
>  drivers/gpu/drm/xe/xe_vm.c | 198 +++++++++++++++++++++++++++++++++++--
>  2 files changed, 235 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
> index 4d248d06bfa5..c9c41fbe125c 100644
> --- a/drivers/gpu/drm/xe/xe_pt.c
> +++ b/drivers/gpu/drm/xe/xe_pt.c
> @@ -1458,6 +1458,7 @@ static int xe_pt_svm_pre_commit(struct xe_migrate_pt_update *pt_update)
>  	struct xe_vm *vm = pt_update->vops->vm;
>  	struct xe_vma_ops *vops = pt_update->vops;
>  	struct xe_vma_op *op;
> +	unsigned long i;
>  	int err;
>  
>  	err = xe_pt_pre_commit(pt_update);
> @@ -1467,20 +1468,35 @@ static int xe_pt_svm_pre_commit(struct xe_migrate_pt_update *pt_update)
>  	xe_svm_notifier_lock(vm);
>  
>  	list_for_each_entry(op, &vops->list, link) {
> -		struct xe_svm_range *range = op->map_range.range;
> +		struct xe_svm_range *range = NULL;
>  
>  		if (op->subop == XE_VMA_SUBOP_UNMAP_RANGE)
>  			continue;
>  
> -		xe_svm_range_debug(range, "PRE-COMMIT");
> +		if (op->base.op == DRM_GPUVA_OP_PREFETCH) {
> +			xe_assert(vm->xe,
> +				  xe_vma_is_cpu_addr_mirror(gpuva_to_vma(op->base.prefetch.va)));
> +			xa_for_each(&op->prefetch_range.range, i, range) {
> +				xe_svm_range_debug(range, "PRE-COMMIT");
>  
> -		xe_assert(vm->xe, xe_vma_is_cpu_addr_mirror(op->map_range.vma));
> -		xe_assert(vm->xe, op->subop == XE_VMA_SUBOP_MAP_RANGE);
> +				if (!xe_svm_range_pages_valid(range)) {
> +					xe_svm_range_debug(range, "PRE-COMMIT - RETRY");
> +					xe_svm_notifier_unlock(vm);
> +					return -ENODATA;
> +				}
> +			}
> +		} else {
> +			xe_assert(vm->xe, xe_vma_is_cpu_addr_mirror(op->map_range.vma));
> +			xe_assert(vm->xe, op->subop == XE_VMA_SUBOP_MAP_RANGE);
> +			range = op->map_range.range;
>  
> -		if (!xe_svm_range_pages_valid(range)) {
> -			xe_svm_range_debug(range, "PRE-COMMIT - RETRY");
> -			xe_svm_notifier_unlock(vm);
> -			return -EAGAIN;
> +			xe_svm_range_debug(range, "PRE-COMMIT");
> +
> +			if (!xe_svm_range_pages_valid(range)) {
> +				xe_svm_range_debug(range, "PRE-COMMIT - RETRY");
> +				xe_svm_notifier_unlock(vm);
> +				return -EAGAIN;
> +			}
>  		}
>  	}
>  
> @@ -2065,11 +2081,20 @@ static int op_prepare(struct xe_vm *vm,
>  	{
>  		struct xe_vma *vma = gpuva_to_vma(op->base.prefetch.va);
>  
> -		if (xe_vma_is_cpu_addr_mirror(vma))
> -			break;
> +		if (xe_vma_is_cpu_addr_mirror(vma)) {
> +			struct xe_svm_range *range;
> +			unsigned long i;
>  
> -		err = bind_op_prepare(vm, tile, pt_update_ops, vma, false);
> -		pt_update_ops->wait_vm_kernel = true;
> +			xa_for_each(&op->prefetch_range.range, i, range) {
> +				err = bind_range_prepare(vm, tile, pt_update_ops,
> +							 vma, range);
> +				if (err)
> +					return err;
> +			}
> +		} else {
> +			err = bind_op_prepare(vm, tile, pt_update_ops, vma, false);
> +			pt_update_ops->wait_vm_kernel = true;
> +		}
>  		break;
>  	}
>  	case DRM_GPUVA_OP_DRIVER:
> @@ -2275,9 +2300,16 @@ static void op_commit(struct xe_vm *vm,
>  	{
>  		struct xe_vma *vma = gpuva_to_vma(op->base.prefetch.va);
>  
> -		if (!xe_vma_is_cpu_addr_mirror(vma))
> +		if (xe_vma_is_cpu_addr_mirror(vma)) {
> +			struct xe_svm_range *range = NULL;
> +			unsigned long i;
> +
> +			xa_for_each(&op->prefetch_range.range, i, range)
> +				range_present_and_invalidated_tile(vm, range, tile->id);
> +		} else {
>  			bind_op_commit(vm, tile, pt_update_ops, vma, fence,
>  				       fence2, false);
> +		}
>  		break;
>  	}
>  	case DRM_GPUVA_OP_DRIVER:
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index cb79a37d2132..5504faef4019 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -798,10 +798,33 @@ static int xe_vma_ops_alloc(struct xe_vma_ops *vops, bool array_of_binds)
>  }
>  ALLOW_ERROR_INJECTION(xe_vma_ops_alloc, ERRNO);
>  
> +static void xe_vma_svm_prefetch_op_fini(struct xe_vma_op *op)
> +{
> +	struct xe_vma *vma;
> +
> +	vma = gpuva_to_vma(op->base.prefetch.va);
> +
> +	if (op->base.op == DRM_GPUVA_OP_PREFETCH && xe_vma_is_cpu_addr_mirror(vma))
> +		xa_destroy(&op->prefetch_range.range);
> +}
> +
> +static void xe_vma_svm_prefetch_ops_fini(struct xe_vma_ops *vops)
> +{
> +	struct xe_vma_op *op;
> +
> +	if (!(vops->flags & XE_VMA_OPS_FLAG_HAS_SVM_PREFETCH))
> +		return;
> +
> +	list_for_each_entry(op, &vops->list, link)
> +		xe_vma_svm_prefetch_op_fini(op);
> +}
> +
>  static void xe_vma_ops_fini(struct xe_vma_ops *vops)
>  {
>  	int i;
>  
> +	xe_vma_svm_prefetch_ops_fini(vops);
> +
>  	for (i = 0; i < XE_MAX_TILES_PER_DEVICE; ++i)
>  		kfree(vops->pt_update_ops[i].ops);
>  }
> @@ -2248,13 +2271,25 @@ static bool __xe_vm_needs_clear_scratch_pages(struct xe_vm *vm, u32 bind_flags)
>  	return true;
>  }
>  
> +static void xe_svm_prefetch_gpuva_ops_fini(struct drm_gpuva_ops *ops)
> +{
> +	struct drm_gpuva_op *__op;
> +
> +	drm_gpuva_for_each_op(__op, ops) {
> +		struct xe_vma_op *op = gpuva_op_to_vma_op(__op);
> +
> +		xe_vma_svm_prefetch_op_fini(op);
> +	}
> +}
> +
>  /*
>   * Create operations list from IOCTL arguments, setup operations fields so parse
>   * and commit steps are decoupled from IOCTL arguments. This step can fail.
>   */
>  static struct drm_gpuva_ops *
> -vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
> -			 u64 bo_offset_or_userptr, u64 addr, u64 range,
> +vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_vma_ops *vops,
> +			 struct xe_bo *bo, u64 bo_offset_or_userptr,
> +			 u64 addr, u64 range,
>  			 u32 operation, u32 flags,
>  			 u32 prefetch_region, u16 pat_index)
>  {
> @@ -2262,6 +2297,7 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
>  	struct drm_gpuva_ops *ops;
>  	struct drm_gpuva_op *__op;
>  	struct drm_gpuvm_bo *vm_bo;
> +	u64 range_end = addr + range;
>  	int err;
>  
>  	lockdep_assert_held_write(&vm->lock);
> @@ -2323,14 +2359,77 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
>  			op->map.invalidate_on_bind =
>  				__xe_vm_needs_clear_scratch_pages(vm, flags);
>  		} else if (__op->op == DRM_GPUVA_OP_PREFETCH) {
> -			op->prefetch.region = prefetch_region;
> -		}
> +			struct xe_vma *vma = gpuva_to_vma(op->base.prefetch.va);
> +			struct xe_svm_range *svm_range;
> +			struct drm_gpusvm_ctx ctx;

Nit: In both cases to future proof do this:

struct drm_gpusvm_ctx ctx = {};

Then no need to zero out fields.

With that fixed:
Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> +			struct xe_tile *tile;
> +			u8 id, tile_mask = 0;
> +			u32 i;
> +
> +			if (!xe_vma_is_cpu_addr_mirror(vma)) {
> +				op->prefetch.region = prefetch_region;
> +				break;
> +			}
> +
> +			ctx.read_only = xe_vma_read_only(vma);
> +			ctx.devmem_possible = IS_DGFX(vm->xe) &&
> +					      IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR);
> +
> +			for_each_tile(tile, vm->xe, id)
> +				tile_mask |= 0x1 << id;
> +
> +			xa_init_flags(&op->prefetch_range.range, XA_FLAGS_ALLOC);
> +			op->prefetch_range.region = prefetch_region;
> +			op->prefetch_range.ranges_count = 0;
> +alloc_next_range:
> +			svm_range = xe_svm_range_find_or_insert(vm, addr, vma, &ctx);
> +
> +			if (PTR_ERR(svm_range) == -ENOENT) {
> +				u64 ret = xe_svm_find_vma_start(vm, addr, range_end, vma);
> +
> +				addr = ret == ULONG_MAX ? 0 : ret;
> +				if (addr)
> +					goto alloc_next_range;
> +				else
> +					goto print_op_label;
> +			}
> +
> +			if (IS_ERR(svm_range)) {
> +				err = PTR_ERR(svm_range);
> +				goto unwind_prefetch_ops;
> +			}
> +
> +			if (xe_svm_range_validate(vm, svm_range, tile_mask, !!prefetch_region))
> +				goto check_next_range;
> +
> +			err = xa_alloc(&op->prefetch_range.range,
> +				       &i, svm_range, xa_limit_32b,
> +				       GFP_KERNEL);
>  
> +			if (err)
> +				goto unwind_prefetch_ops;
> +
> +			op->prefetch_range.ranges_count++;
> +			vops->flags |= XE_VMA_OPS_FLAG_HAS_SVM_PREFETCH;
> +check_next_range:
> +			if (range_end > xe_svm_range_end(svm_range) &&
> +			    xe_svm_range_end(svm_range) < xe_vma_end(vma)) {
> +				addr = xe_svm_range_end(svm_range);
> +				goto alloc_next_range;
> +			}
> +		}
> +print_op_label:
>  		print_op(vm->xe, __op);
>  	}
>  
>  	return ops;
> +
> +unwind_prefetch_ops:
> +	xe_svm_prefetch_gpuva_ops_fini(ops);
> +	drm_gpuva_ops_free(&vm->gpuvm, ops);
> +	return ERR_PTR(err);
>  }
> +
>  ALLOW_ERROR_INJECTION(vm_bind_ioctl_ops_create, ERRNO);
>  
>  static struct xe_vma *new_vma(struct xe_vm *vm, struct drm_gpuva_op_map *op,
> @@ -2645,8 +2744,12 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct drm_gpuva_ops *ops,
>  					return err;
>  			}
>  
> -			if (!xe_vma_is_cpu_addr_mirror(vma))
> +			if (xe_vma_is_cpu_addr_mirror(vma))
> +				xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask,
> +							      op->prefetch_range.ranges_count);
> +			else
>  				xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask, 1);
> +
>  			break;
>  		default:
>  			drm_warn(&vm->xe->drm, "NOT POSSIBLE");
> @@ -2772,6 +2875,57 @@ static int check_ufence(struct xe_vma *vma)
>  	return 0;
>  }
>  
> +static int prefetch_ranges(struct xe_vm *vm, struct xe_vma_op *op)
> +{
> +	bool devmem_possible = IS_DGFX(vm->xe) && IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR);
> +	struct xe_vma *vma = gpuva_to_vma(op->base.prefetch.va);
> +	int err = 0;
> +
> +	struct xe_svm_range *svm_range;
> +	struct drm_gpusvm_ctx ctx;
> +	struct xe_tile *tile;
> +	unsigned long i;
> +	u32 region;
> +
> +	if (!xe_vma_is_cpu_addr_mirror(vma))
> +		return 0;
> +
> +	region = op->prefetch_range.region;
> +
> +	ctx.read_only = xe_vma_read_only(vma);
> +	ctx.devmem_possible = devmem_possible;
> +	ctx.check_pages_threshold = devmem_possible ? SZ_64K : 0;
> +	ctx.devmem_only = 0;
> +	ctx.timeslice_ms = 0;
> +
> +	/* TODO: Threading the migration */
> +	xa_for_each(&op->prefetch_range.range, i, svm_range) {
> +		if (!region)
> +			xe_svm_range_migrate_to_smem(vm, svm_range);
> +
> +		if (xe_svm_range_needs_migrate_to_vram(svm_range, vma, region)) {
> +			tile = &vm->xe->tiles[region_to_mem_type[region] - XE_PL_VRAM0];
> +			err = xe_svm_alloc_vram(vm, tile, svm_range, &ctx);
> +			if (err) {
> +				drm_dbg(&vm->xe->drm, "VRAM allocation failed, retry from userspace, asid=%u, gpusvm=%p, errno=%pe\n",
> +					vm->usm.asid, &vm->svm.gpusvm, ERR_PTR(err));
> +				return -ENODATA;
> +			}
> +		}
> +
> +		err = xe_svm_range_get_pages(vm, svm_range, &ctx);
> +		if (err) {
> +			if (err == -EOPNOTSUPP || err == -EFAULT || err == -EPERM)
> +				err = -ENODATA;
> +			drm_dbg(&vm->xe->drm, "Get pages failed, asid=%u, gpusvm=%p, errno=%pe\n",
> +				vm->usm.asid, &vm->svm.gpusvm, ERR_PTR(err));
> +			return err;
> +		}
> +	}
> +
> +	return err;
> +}
> +
>  static int op_lock_and_prep(struct drm_exec *exec, struct xe_vm *vm,
>  			    struct xe_vma_op *op)
>  {
> @@ -2809,7 +2963,12 @@ static int op_lock_and_prep(struct drm_exec *exec, struct xe_vm *vm,
>  	case DRM_GPUVA_OP_PREFETCH:
>  	{
>  		struct xe_vma *vma = gpuva_to_vma(op->base.prefetch.va);
> -		u32 region = op->prefetch.region;
> +		u32 region;
> +
> +		if (xe_vma_is_cpu_addr_mirror(vma))
> +			region = op->prefetch_range.region;
> +		else
> +			region = op->prefetch.region;
>  
>  		xe_assert(vm->xe, region <= ARRAY_SIZE(region_to_mem_type));
>  
> @@ -2828,6 +2987,25 @@ static int op_lock_and_prep(struct drm_exec *exec, struct xe_vm *vm,
>  	return err;
>  }
>  
> +static int vm_bind_ioctl_ops_prefetch_ranges(struct xe_vm *vm, struct xe_vma_ops *vops)
> +{
> +	struct xe_vma_op *op;
> +	int err;
> +
> +	if (!(vops->flags & XE_VMA_OPS_FLAG_HAS_SVM_PREFETCH))
> +		return 0;
> +
> +	list_for_each_entry(op, &vops->list, link) {
> +		if (op->base.op  == DRM_GPUVA_OP_PREFETCH) {
> +			err = prefetch_ranges(vm, op);
> +			if (err)
> +				return err;
> +		}
> +	}
> +
> +	return 0;
> +}
> +
>  static int vm_bind_ioctl_ops_lock_and_prep(struct drm_exec *exec,
>  					   struct xe_vm *vm,
>  					   struct xe_vma_ops *vops)
> @@ -3477,7 +3655,7 @@ int xe_vm_bind_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
>  		u32 prefetch_region = bind_ops[i].prefetch_mem_region_instance;
>  		u16 pat_index = bind_ops[i].pat_index;
>  
> -		ops[i] = vm_bind_ioctl_ops_create(vm, bos[i], obj_offset,
> +		ops[i] = vm_bind_ioctl_ops_create(vm, &vops, bos[i], obj_offset,
>  						  addr, range, op, flags,
>  						  prefetch_region, pat_index);
>  		if (IS_ERR(ops[i])) {
> @@ -3510,6 +3688,10 @@ int xe_vm_bind_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
>  	if (err)
>  		goto unwind_ops;
>  
> +	err = vm_bind_ioctl_ops_prefetch_ranges(vm, &vops);
> +	if (err)
> +		goto unwind_ops;
> +
>  	fence = vm_bind_ioctl_ops_execute(vm, &vops);
>  	if (IS_ERR(fence))
>  		err = PTR_ERR(fence);
> @@ -3579,7 +3761,7 @@ struct dma_fence *xe_vm_bind_kernel_bo(struct xe_vm *vm, struct xe_bo *bo,
>  
>  	xe_vma_ops_init(&vops, vm, q, NULL, 0);
>  
> -	ops = vm_bind_ioctl_ops_create(vm, bo, 0, addr, bo->size,
> +	ops = vm_bind_ioctl_ops_create(vm, &vops, bo, 0, addr, bo->size,
>  				       DRM_XE_VM_BIND_OP_MAP, 0, 0,
>  				       vm->xe->pat.idx[cache_lvl]);
>  	if (IS_ERR(ops)) {
> -- 
> 2.34.1
> 

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

* ✗ CI.Patch_applied: failure for Prefetch Support for svm ranges (rev7)
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (23 preceding siblings ...)
  2025-05-12 17:12 ` ✗ CI.Build: failure " Patchwork
@ 2025-05-13  1:46 ` Patchwork
  2025-05-13 12:06 ` ✗ CI.Patch_applied: failure for Prefetch Support for svm ranges (rev6) Patchwork
  2025-05-13 14:57 ` ✗ CI.Patch_applied: failure for Prefetch Support for svm ranges (rev7) Patchwork
  26 siblings, 0 replies; 30+ messages in thread
From: Patchwork @ 2025-05-13  1:46 UTC (permalink / raw)
  To: Himal Prasad Ghimiray; +Cc: intel-xe

== Series Details ==

Series: Prefetch Support for svm ranges (rev7)
URL   : https://patchwork.freedesktop.org/series/146079/
State : failure

== Summary ==

=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: ccbe266e6269 drm-tip: 2025y-05m-12d-22h-51m-08s UTC integration manifest
=== git am output follows ===
error: patch failed: include/drm/drm_gpusvm.h:286
error: include/drm/drm_gpusvm.h: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Applying: drm/gpusvm: Introduce devmem_only flag for allocation
Patch failed at 0001 drm/gpusvm: Introduce devmem_only flag for allocation
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".



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

* ✗ CI.Patch_applied: failure for Prefetch Support for svm ranges (rev6)
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (24 preceding siblings ...)
  2025-05-13  1:46 ` ✗ CI.Patch_applied: failure for Prefetch Support for svm ranges (rev7) Patchwork
@ 2025-05-13 12:06 ` Patchwork
  2025-05-13 14:57 ` ✗ CI.Patch_applied: failure for Prefetch Support for svm ranges (rev7) Patchwork
  26 siblings, 0 replies; 30+ messages in thread
From: Patchwork @ 2025-05-13 12:06 UTC (permalink / raw)
  To: Himal Prasad Ghimiray; +Cc: intel-xe

== Series Details ==

Series: Prefetch Support for svm ranges (rev6)
URL   : https://patchwork.freedesktop.org/series/146079/
State : failure

== Summary ==

=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: c9de1544553b drm-tip: 2025y-05m-13d-08h-26m-34s UTC integration manifest
=== git am output follows ===
error: patch failed: include/drm/drm_gpusvm.h:286
error: include/drm/drm_gpusvm.h: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Applying: drm/gpusvm: Introduce devmem_only flag for allocation
Patch failed at 0001 drm/gpusvm: Introduce devmem_only flag for allocation
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".



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

* ✗ CI.Patch_applied: failure for Prefetch Support for svm ranges (rev7)
  2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
                   ` (25 preceding siblings ...)
  2025-05-13 12:06 ` ✗ CI.Patch_applied: failure for Prefetch Support for svm ranges (rev6) Patchwork
@ 2025-05-13 14:57 ` Patchwork
  26 siblings, 0 replies; 30+ messages in thread
From: Patchwork @ 2025-05-13 14:57 UTC (permalink / raw)
  To: Himal Prasad Ghimiray; +Cc: intel-xe

== Series Details ==

Series: Prefetch Support for svm ranges (rev7)
URL   : https://patchwork.freedesktop.org/series/146079/
State : failure

== Summary ==

=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: d0d3c136f60c drm-tip: 2025y-05m-13d-14h-08m-27s UTC integration manifest
=== git am output follows ===
error: patch failed: include/drm/drm_gpusvm.h:286
error: include/drm/drm_gpusvm.h: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Applying: drm/gpusvm: Introduce devmem_only flag for allocation
Patch failed at 0001 drm/gpusvm: Introduce devmem_only flag for allocation
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".



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

end of thread, other threads:[~2025-05-13 14:57 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-12 16:47 [PATCH v7 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
2025-05-12 16:47 ` [PATCH v8 01/20] drm/gpusvm: Introduce devmem_only flag for allocation Himal Prasad Ghimiray
2025-05-12 16:47 ` [PATCH v8 02/20] drm/xe: Strict migration policy for atomic SVM faults Himal Prasad Ghimiray
2025-05-12 16:47 ` [PATCH v8 03/20] drm/gpusvm: Add timeslicing support to GPU SVM Himal Prasad Ghimiray
2025-05-12 16:47 ` [PATCH v8 04/20] drm/xe: Timeslice GPU on atomic SVM fault Himal Prasad Ghimiray
2025-05-12 16:47 ` [PATCH v8 05/20] drm/xe: Add atomic_svm_timeslice_ms debugfs entry Himal Prasad Ghimiray
2025-05-12 16:47 ` [PATCH v7 06/20] drm/xe: Introduce xe_vma_op_prefetch_range struct for prefetch of ranges Himal Prasad Ghimiray
2025-05-12 16:47 ` [PATCH v7 07/20] drm/xe: Make xe_svm_alloc_vram public Himal Prasad Ghimiray
2025-05-12 16:47 ` [PATCH v7 08/20] drm/xe/svm: Helper to add tile masks to svm ranges Himal Prasad Ghimiray
2025-05-12 16:47 ` [PATCH v7 09/20] drm/xe/svm: Make to_xe_range a public function Himal Prasad Ghimiray
2025-05-12 16:47 ` [PATCH v7 10/20] drm/xe/svm: Make xe_svm_range_* end/start/size public Himal Prasad Ghimiray
2025-05-12 16:47 ` [PATCH v7 11/20] drm/xe/vm: Update xe_vma_ops_incr_pt_update_ops to take an increment value Himal Prasad Ghimiray
2025-05-12 16:47 ` [PATCH v7 12/20] drm/xe/vm: Add an identifier in xe_vma_ops for svm prefetch Himal Prasad Ghimiray
2025-05-12 16:47 ` [PATCH v7 13/20] drm/xe: Rename lookup_vma function to xe_find_vma_by_addr Himal Prasad Ghimiray
2025-05-12 16:47 ` [PATCH v7 14/20] drm/xe/svm: Refactor usage of drm_gpusvm* function in xe_svm Himal Prasad Ghimiray
2025-05-12 16:47 ` [PATCH v7 15/20] drm/xe/svm: Make xe_svm_range_needs_migrate_to_vram() public Himal Prasad Ghimiray
2025-05-12 16:47 ` [PATCH v7 16/20] drm/xe/svm: Add xe_svm_range_validate() and xe_svm_range_migrate_to_smem() Himal Prasad Ghimiray
2025-05-12 16:47 ` [PATCH v7 17/20] drm/gpusvm: Introduce drm_gpusvm_find_vma_start() function Himal Prasad Ghimiray
2025-05-12 21:24   ` Matthew Brost
2025-05-12 16:47 ` [PATCH v7 18/20] drm/xe/svm: Add xe_svm_find_vma_start() helper Himal Prasad Ghimiray
2025-05-12 16:47 ` [PATCH v7 19/20] drm/xe/svm: Implement prefetch support for SVM ranges Himal Prasad Ghimiray
2025-05-12 21:32   ` Matthew Brost
2025-05-12 16:47 ` [PATCH v7 20/20] drm/xe/vm: Add debug prints for SVM range prefetch Himal Prasad Ghimiray
2025-05-12 17:00 ` ✓ CI.Patch_applied: success for Prefetch Support for svm ranges (rev6) Patchwork
2025-05-12 17:00 ` ✗ CI.checkpatch: warning " Patchwork
2025-05-12 17:02 ` ✓ CI.KUnit: success " Patchwork
2025-05-12 17:12 ` ✗ CI.Build: failure " Patchwork
2025-05-13  1:46 ` ✗ CI.Patch_applied: failure for Prefetch Support for svm ranges (rev7) Patchwork
2025-05-13 12:06 ` ✗ CI.Patch_applied: failure for Prefetch Support for svm ranges (rev6) Patchwork
2025-05-13 14:57 ` ✗ CI.Patch_applied: failure for Prefetch Support for svm ranges (rev7) Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox