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 16/21] lib/intel_batchbuffer: Add dummy OP_DEBUG_DATA operation to __xe_alloc_bind_ops
Date: Mon, 12 Jan 2026 15:00:02 +0200	[thread overview]
Message-ID: <20260112130008.1649357-17-mika.kuoppala@linux.intel.com> (raw)
In-Reply-To: <20260112130008.1649357-1-mika.kuoppala@linux.intel.com>

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

xe_eudebug_online tests rely on ufence blocking/acking by the debugger
to set the breakpoint bit on a client shader instruction before
the workload is executed. Ufence events and debugger blocking/acking
is no longer present for binds that only contain 'OP_MAP' operations -
at least a single 'OP_ADD_DEBUG_DATA' has to be present to trigger this
functionality. Make it possible to inject a dummy debug data vm bind
operation to the list of bind operations during bb execution.

Signed-off-by: Christoph Manszewski <christoph.manszewski@intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 lib/intel_batchbuffer.c | 82 +++++++++++++++++++++++++----------------
 1 file changed, 51 insertions(+), 31 deletions(-)

diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index 3b25a385b7..5e5cf0b136 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -1355,42 +1355,71 @@ void intel_bb_destroy(struct intel_bb *ibb)
 #define XE_OBJ_PXP_BIT (0x100)
 #define XE_OBJ_PXP(rsvd1) ((rsvd1) & (XE_OBJ_PXP_BIT))
 
-static struct drm_xe_vm_bind_op *xe_alloc_bind_ops(struct intel_bb *ibb,
-						   uint32_t op, uint32_t flags,
-						   uint32_t prefetch_region)
+static struct drm_xe_vm_bind_op *__xe_alloc_bind_ops(struct intel_bb *ibb,
+						     uint32_t op, uint32_t flags,
+						     uint32_t prefetch_region,
+						     bool dummy_debug_data)
 {
 	struct drm_i915_gem_exec_object2 **objects = ibb->objects;
-	struct drm_xe_vm_bind_op *bind_ops, *ops;
+	struct drm_xe_vm_bind_op *bind_ops, *bind_op, *ret;
 	bool set_obj = (op & 0xffff) == DRM_XE_VM_BIND_OP_MAP;
 
-	bind_ops = calloc(ibb->num_objects, sizeof(*bind_ops));
+	ret = bind_ops = calloc(ibb->num_objects + (dummy_debug_data ? 1 : 0), sizeof(*bind_ops));
 	igt_assert(bind_ops);
 
+	if (dummy_debug_data) {
+		struct drm_xe_vm_bind_op_ext_debug_data *op_ext;
+
+		bind_op = &bind_ops[0];
+
+		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_SIP_AREA;
+		op_ext->addr = 0;
+		op_ext->range = 1;
+
+		bind_op->op = (op == DRM_XE_VM_BIND_OP_MAP ?
+			DRM_XE_VM_BIND_OP_ADD_DEBUG_DATA :
+			DRM_XE_VM_BIND_OP_REMOVE_DEBUG_DATA);
+		bind_op->extensions = to_user_pointer(op_ext);
+		bind_op->pat_index = intel_get_pat_idx_wb(ibb->fd);
+
+		bind_ops = &bind_ops[1];
+	}
+
 	igt_debug("bind_ops: %s\n", set_obj ? "MAP" : "UNMAP");
 	for (int i = 0; i < ibb->num_objects; i++) {
-		ops = &bind_ops[i];
+		bind_op = &bind_ops[i];
 
 		if (set_obj)
-			ops->obj = objects[i]->handle;
+			bind_op->obj = objects[i]->handle;
 
-		ops->op = op;
-		ops->flags = flags;
+		bind_op->op = op;
+		bind_op->flags = flags;
 
 		if (XE_OBJ_PXP(objects[i]->rsvd1))
-			ops->flags |= DRM_XE_VM_BIND_FLAG_CHECK_PXP;
-		ops->obj_offset = 0;
-		ops->addr = objects[i]->offset;
-		ops->range = XE_OBJ_SIZE(objects[i]->rsvd1);
-		ops->prefetch_mem_region_instance = prefetch_region;
+			bind_op->flags |= DRM_XE_VM_BIND_FLAG_CHECK_PXP;
+		bind_op->obj_offset = 0;
+		bind_op->addr = objects[i]->offset;
+		bind_op->range = XE_OBJ_SIZE(objects[i]->rsvd1);
+		bind_op->prefetch_mem_region_instance = prefetch_region;
 		if (set_obj)
-			ops->pat_index = XE_OBJ_PAT_IDX(objects[i]->rsvd1);
+			bind_op->pat_index = XE_OBJ_PAT_IDX(objects[i]->rsvd1);
 
 		igt_debug("  [%d]: handle: %u, offset: %llx, size: %llx pat_index: %u\n",
-			  i, ops->obj, (long long)ops->addr, (long long)ops->range,
-			  ops->pat_index);
+			  i, bind_op->obj, (long long)bind_op->addr, (long long)bind_op->range,
+			  bind_op->pat_index);
 	}
 
-	return bind_ops;
+	return ret;
+}
+
+static struct drm_xe_vm_bind_op *xe_alloc_bind_ops(struct intel_bb *ibb,
+						   uint32_t op, uint32_t flags,
+						   uint32_t prefetch_region)
+{
+	return __xe_alloc_bind_ops(ibb, op, flags, prefetch_region, false);
 }
 
 static void __unbind_xe_objects(struct intel_bb *ibb)
@@ -2633,19 +2662,10 @@ __xe_lr_bb_exec(struct intel_bb *ibb, uint64_t flags, bool sync)
 	syncs[0].addr = vm_sync_addr;
 	syncs[1].addr = exec_sync_addr;
 
-	if (ibb->num_objects > 1) {
-		bind_ops = xe_alloc_bind_ops(ibb, DRM_XE_VM_BIND_OP_MAP, 0, 0);
-		xe_vm_bind_array(ibb->fd, ibb->vm_id, 0, bind_ops,
-				 ibb->num_objects, syncs, 1);
-		free(bind_ops);
-	} else {
-		igt_debug("bind: MAP\n");
-		igt_debug("  handle: %u, offset: %llx, size: %llx\n",
-			  ibb->handle, (long long)ibb->batch_offset,
-			  (long long)ibb->size);
-		xe_vm_bind_async(ibb->fd, ibb->vm_id, 0, ibb->handle, 0,
-				 ibb->batch_offset, ibb->size, syncs, 1);
-	}
+	bind_ops = __xe_alloc_bind_ops(ibb, DRM_XE_VM_BIND_OP_MAP, 0, 0, true);
+	xe_vm_bind_array(ibb->fd, ibb->vm_id, 0, bind_ops, ibb->num_objects + 1, syncs, 1);
+	free(from_user_pointer(bind_ops[0].extensions));
+	free(bind_ops);
 
 	/* use default vm_bind_exec_queue */
 	xe_wait_ufence(ibb->fd, &sync_data->vm_sync, USER_FENCE_VALUE, 0, -1);
-- 
2.43.0


  parent reply	other threads:[~2026-01-12 13:01 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 ` [PATCH i-g-t 12/21] tests/xe_eudebug: Adapt some ufence reliant tests to new vm_bind event interface Mika Kuoppala
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 ` Mika Kuoppala [this message]
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-17-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