public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: christoph.manszewski@intel.com,
	dominik.karol.piatkowski@intel.com, maciej.patelczyk@intel.com,
	jan.maslak@intel.com, zbigniew.kempczynski@intel.com,
	Mika Kuoppala <mika.kuoppala@linux.intel.com>
Subject: [PATCH i-g-t 12/21] tests/xe_eudebug: Adapt some ufence reliant tests to new vm_bind event interface
Date: Mon, 12 Jan 2026 14:59:58 +0200	[thread overview]
Message-ID: <20260112130008.1649357-13-mika.kuoppala@linux.intel.com> (raw)
In-Reply-To: <20260112130008.1649357-1-mika.kuoppala@linux.intel.com>

From: Christoph Manszewski <christoph.manszewski@intel.com>

EU debug no longer relays events for VM_BIND_OP_[MAP|UNMAP] operations,
this includes ufence events for binds that perorm only these operations.
Instead it reports newly added 'VM_BIND_OP_DEBUG_DATA_[ADD|REMOVE]'
operations through the event interface and ufence events if a ufence for
these operations was provided.

Perform neccessary debug data operations to enable the following subtests:
- basic-vm-bind-ufence*
- vma-ufence*
- basic-vm-acccess*

Signed-off-by: Christoph Manszewski <christoph.manszewski@intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 tests/intel/xe_eudebug.c | 96 +++++++++++++++++++++++++---------------
 1 file changed, 60 insertions(+), 36 deletions(-)

diff --git a/tests/intel/xe_eudebug.c b/tests/intel/xe_eudebug.c
index e9efb47da8..fed9a47405 100644
--- a/tests/intel/xe_eudebug.c
+++ b/tests/intel/xe_eudebug.c
@@ -236,27 +236,40 @@ static struct bind_list *create_bind_list(int fd, uint32_t bo_placement,
 	bl->vm = vm;
 	bl->bo = vm_create_objects(fd, bo_placement, vm, bo_size, n);
 	bl->n = n;
-	bl->bind_ops = calloc(n, sizeof(*bl->bind_ops));
+	bl->bind_ops = calloc(n * 2, sizeof(*bl->bind_ops));
 	igt_assert(bl->bind_ops);
 
 	for (i = 0; i < n; i++) {
-		struct drm_xe_vm_bind_op *o = &bl->bind_ops[i];
+		struct drm_xe_vm_bind_op *om = &bl->bind_ops[i * 2], *od = &bl->bind_ops[i * 2 + 1];
+		struct drm_xe_vm_bind_op_ext_debug_data *op_ext;
 
 		if (is_userptr) {
-			o->userptr = (uintptr_t)bl->bo[i].userptr;
-			o->op = DRM_XE_VM_BIND_OP_MAP_USERPTR;
+			om->userptr = (uintptr_t)bl->bo[i].userptr;
+			om->op = DRM_XE_VM_BIND_OP_MAP_USERPTR;
 		} else {
-			o->obj = bl->bo[i].fd;
-			o->op = DRM_XE_VM_BIND_OP_MAP;
+			om->obj = bl->bo[i].fd;
+			om->op = DRM_XE_VM_BIND_OP_MAP;
 		}
 
-		o->range = bo_size;
-		o->addr = BO_ADDR + 2 * i * bo_size;
-		o->pat_index = intel_get_pat_idx_wb(fd);
+		om->range = bo_size;
+		om->addr = BO_ADDR + 2 * i * bo_size;
+		om->pat_index = intel_get_pat_idx_wb(fd);
+
+		/* debug data */
+		op_ext = calloc(1, sizeof(*op_ext));
+		op_ext->base.name = XE_VM_BIND_OP_EXTENSIONS_DEBUG_DATA;
+		op_ext->flags = DRM_XE_VM_BIND_DEBUG_DATA_FLAG_PSEUDO;
+		op_ext->pseudopath = DRM_XE_VM_BIND_DEBUG_DATA_PSEUDO_MODULE_AREA;
+		op_ext->addr = om->addr;
+		op_ext->range = om->range;
+
+		od->extensions = to_user_pointer(op_ext);
+		od->op = DRM_XE_VM_BIND_OP_ADD_DEBUG_DATA;
+		od->pat_index = intel_get_pat_idx_wb(fd);
 	}
 
 	for (i = 0; i < bl->n; i++) {
-		struct drm_xe_vm_bind_op *o = &bl->bind_ops[i];
+		struct drm_xe_vm_bind_op *o = &bl->bind_ops[i * 2];
 
 		igt_debug("bo %d: addr 0x%llx, range 0x%llx\n", i, o->addr, o->range);
 		bo_prime(fd, o);
@@ -273,9 +286,7 @@ static void do_bind_list(struct xe_eudebug_client *c,
 		.flags = DRM_XE_SYNC_FLAG_SIGNAL,
 		.timeline_value = 1337,
 	};
-	uint64_t ref_seqno = 0, op_ref_seqno = 0;
 	uint64_t *fence_data;
-	int i;
 
 	if (sync) {
 		fence_data = aligned_alloc(xe_get_default_alignment(c->fd),
@@ -285,16 +296,8 @@ static void do_bind_list(struct xe_eudebug_client *c,
 		memset(fence_data, 0, sizeof(*fence_data));
 	}
 
-	xe_vm_bind_array(c->fd, bl->vm, 0, bl->bind_ops, bl->n, &uf_sync, sync ? 1 : 0);
-	xe_eudebug_client_vm_bind_event(c, DRM_XE_EUDEBUG_EVENT_STATE_CHANGE,
-					bl->vm, 0, bl->n, &ref_seqno);
-	for (i = 0; i < bl->n; i++)
-		xe_eudebug_client_vm_bind_op_event(c, DRM_XE_EUDEBUG_EVENT_CREATE,
-						   ref_seqno,
-						   &op_ref_seqno,
-						   bl->bind_ops[i].addr,
-						   bl->bind_ops[i].range,
-						   0);
+	xe_eudebug_client_vm_bind_array(c, bl->vm, 0, bl->bind_ops, bl->n * 2, &uf_sync,
+					sync ? 1 : 0);
 
 	if (sync) {
 		xe_wait_ufence(c->fd, fence_data, uf_sync.timeline_value, 0,
@@ -308,14 +311,33 @@ static void free_bind_list(struct xe_eudebug_client *c, struct bind_list *bl)
 	unsigned int i;
 
 	for (i = 0; i < bl->n; i++) {
-		igt_debug("%d: checking 0x%llx (%lld)\n",
-			  i, bl->bind_ops[i].addr, bl->bind_ops[i].addr);
-		bo_check(c->fd, &bl->bind_ops[i]);
-		if (bl->bind_ops[i].op == DRM_XE_VM_BIND_OP_MAP_USERPTR)
+		struct drm_xe_vm_bind_op *om = &bl->bind_ops[i * 2], *od = &bl->bind_ops[i * 2 + 1];
+		struct drm_xe_vm_bind_op_ext_debug_data *op_ext;
+		igt_debug("%d: checking 0x%llx (%lld)\n", i, om->addr, om->addr);
+
+		bo_check(c->fd, om);
+
+		om->op = DRM_XE_VM_BIND_OP_UNMAP;
+		om->obj = 0;
+		od->op = DRM_XE_VM_BIND_OP_REMOVE_DEBUG_DATA;
+
+		op_ext = from_user_pointer(od->extensions);
+		op_ext->offset = 0;
+		op_ext->flags = 0;
+		memset(op_ext->pathname, 0, sizeof(op_ext->pathname));
+	}
+
+	xe_eudebug_client_vm_bind_array(c, bl->vm, 0, bl->bind_ops, bl->n * 2, NULL, 0);
+
+	for (i = 0; i < bl->n; i++) {
+		struct drm_xe_vm_bind_op *om = &bl->bind_ops[i * 2], *od = &bl->bind_ops[i * 2 + 1];
+		struct drm_xe_vm_bind_op_ext_debug_data *op_ext;
+
+		if (om->op == DRM_XE_VM_BIND_OP_MAP_USERPTR)
 			free(bl->bo[i].userptr);
-		xe_eudebug_client_vm_unbind(c, bl->vm, 0,
-					    bl->bind_ops[i].addr,
-					    bl->bind_ops[i].range);
+
+		op_ext = from_user_pointer(od->extensions);
+		free(op_ext);
 	}
 
 	free(bl->bind_ops);
@@ -1353,7 +1375,7 @@ static void vm_access_client(struct xe_eudebug_client *c)
 		do_bind_list(c, bl, true);
 
 		for (i = 0; i < bl->n; i++)
-			xe_eudebug_client_wait_stage(c, bl->bind_ops[i].addr);
+			xe_eudebug_client_wait_stage(c, bl->bind_ops[i * 2].addr);
 
 		free_bind_list(c, bl);
 	}
@@ -1734,8 +1756,9 @@ static void basic_ufence_client(struct xe_eudebug_client *c)
 	for (int i = 0; i < n; i++) {
 		struct ufence_bind *b = &binds[i];
 
-		xe_eudebug_client_vm_bind_flags(c, vm, bo, 0, b->addr, b->range, 0,
-						&b->f, 1, 0);
+		xe_eudebug_client_vm_bind_map_with_debug_data(c, vm, b->addr, b->range, bo, 0, NULL,
+							      DRM_XE_VM_BIND_DEBUG_DATA_PSEUDO_MODULE_AREA,
+							      0, &b->f, 1);
 	}
 
 	client_wait_ufences(c, binds, n);
@@ -1743,7 +1766,7 @@ static void basic_ufence_client(struct xe_eudebug_client *c)
 	for (int i = 0; i < n; i++) {
 		struct ufence_bind *b = &binds[i];
 
-		xe_eudebug_client_vm_unbind(c, vm, 0, b->addr, b->range);
+		xe_eudebug_client_vm_bind_unmap_with_debug_data(c, vm, b->addr, b->range);
 	}
 
 	destroy_binds_with_ufence(binds, n);
@@ -2231,8 +2254,9 @@ static void vma_ufence_client(struct xe_eudebug_client *c)
 	for (int i = 0; i < n; i++) {
 		struct ufence_bind *b = &binds[i];
 
-		xe_eudebug_client_vm_bind_flags(c, vm, bo[i], 0, b->addr, b->range, 0,
-						&b->f, 1, 0);
+		xe_eudebug_client_vm_bind_map_with_debug_data(c, vm, b->addr, b->range, bo[i], 0, NULL,
+							      DRM_XE_VM_BIND_DEBUG_DATA_PSEUDO_MODULE_AREA,
+							      0, &b->f, 1);
 	}
 
 	/* Wait for acks on ufences */
@@ -2256,7 +2280,7 @@ static void vma_ufence_client(struct xe_eudebug_client *c)
 	for (int i = 0; i < n; i++) {
 		struct ufence_bind *b = &binds[i];
 
-		xe_eudebug_client_vm_unbind(c, vm, 0, b->addr, b->range);
+		xe_eudebug_client_vm_bind_unmap_with_debug_data(c, vm, b->addr, b->range);
 	}
 
 	destroy_binds_with_ufence(binds, n);
-- 
2.43.0


  parent reply	other threads:[~2026-01-12 13:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-12 12:59 [PATCH i-g-t 00/21] eudebug: uapi changes on connect and metadata Mika Kuoppala
2026-01-12 12:59 ` [PATCH i-g-t 01/21] lib/xe/xe_eudebug: Dont compare if everything filtered Mika Kuoppala
2026-01-12 12:59 ` [PATCH i-g-t 02/21] lib/xe/xe_eudebug: Make sure debugger drains events Mika Kuoppala
2026-01-12 12:59 ` [PATCH i-g-t 03/21] lib/xe/xe_eudebug: Avoid matching if event is filtered Mika Kuoppala
2026-01-12 12:59 ` [PATCH i-g-t 04/21] tests/intel/xe_eudebug_sriov: Align expected return code Mika Kuoppala
2026-01-12 13:12   ` Piatkowski, Dominik Karol
2026-01-12 12:59 ` [PATCH i-g-t 05/21] eudebug: Remove metadata tests Mika Kuoppala
2026-01-12 12:59 ` [PATCH i-g-t 06/21] eudebug: Remove EVENT_OPEN and adjust tests Mika Kuoppala
2026-01-12 12:59 ` [PATCH i-g-t 07/21] tests/xe_eudebug: Adapt basic-read-event Mika Kuoppala
2026-01-12 12:59 ` [PATCH i-g-t 08/21] tests/intel/xe_eudebug: Fix connect-user test Mika Kuoppala
2026-01-12 12:59 ` [PATCH i-g-t 09/21] tests/intel/xe_eudebug: Mold ufence reconnect test to disconnect Mika Kuoppala
2026-01-12 12:59 ` [PATCH i-g-t 10/21] lib/xe_eudebug: Adapt to vm_bind debug data Mika Kuoppala
2026-01-12 12:59 ` [PATCH i-g-t 11/21] tests/xe_eudebug: Adapt basic-vm-bind and remove basic-vm-bind-extended Mika Kuoppala
2026-01-12 12:59 ` Mika Kuoppala [this message]
2026-01-12 12:59 ` [PATCH i-g-t 13/21] tests/xe_eudebug: Adapt vm-bind-clear* subtests to debug data Mika Kuoppala
2026-01-12 13:00 ` [PATCH i-g-t 14/21] lib/xe_eudebug: Remove unused xe_eudebug_client_vm_bind wrappers Mika Kuoppala
2026-01-12 13:00 ` [PATCH i-g-t 15/21] tests/xe_eudebug: Add vm-bind-debug-data-ufence subtest Mika Kuoppala
2026-01-12 13:00 ` [PATCH i-g-t 16/21] lib/intel_batchbuffer: Add dummy OP_DEBUG_DATA operation to __xe_alloc_bind_ops Mika Kuoppala
2026-01-12 13:00 ` [PATCH i-g-t 17/21] tests/xe_eudebug_online: Adapt set-breakpoint test to work with new vm bind event interface Mika Kuoppala
2026-01-12 13:00 ` [PATCH i-g-t 18/21] tests/xe_eudebug_online: Adapt several subtests " Mika Kuoppala
2026-01-12 13:00 ` [PATCH i-g-t 19/21] lib/xe/xe_eudebug: Add callback for session work Mika Kuoppala
2026-01-12 13:00 ` [PATCH i-g-t 20/21] tests/intel/xe_eudebug: Add render node testing Mika Kuoppala
2026-01-12 13:00 ` [PATCH i-g-t 21/21] eudebug: Update xe_drm_eudebug.h uapi Mika Kuoppala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260112130008.1649357-13-mika.kuoppala@linux.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=christoph.manszewski@intel.com \
    --cc=dominik.karol.piatkowski@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jan.maslak@intel.com \
    --cc=maciej.patelczyk@intel.com \
    --cc=zbigniew.kempczynski@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox