From: Soham Purkait <soham.purkait@intel.com>
To: igt-dev@lists.freedesktop.org, riana.tauro@intel.com,
badal.nilawar@intel.com, kamil.konieczny@intel.com
Cc: anshuman.gupta@intel.com, soham.purkait@intel.com,
umesh.nerlige.ramappa@intel.com
Subject: [PATCH i-g-t v4 1/3] lib/xe/xe_spin: Introduce xe_spin_reset
Date: Tue, 6 Jan 2026 22:17:59 +0530 [thread overview]
Message-ID: <20260106164801.46353-2-soham.purkait@intel.com> (raw)
In-Reply-To: <20260106164801.46353-1-soham.purkait@intel.com>
Create new function xe_spin_reset()
This function resets the state of spin, allowing
its reuse for engine activity accuracy test.
v1:
- Add simple commit message and mention test where it is going to be
used. (kamil)
v2:
- Add fd description for xe_spin_reset. (Kamil)
Signed-off-by: Soham Purkait <soham.purkait@intel.com>
Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
lib/xe/xe_spin.c | 29 +++++++++++++++++++++++++++++
lib/xe/xe_spin.h | 1 +
2 files changed, 30 insertions(+)
diff --git a/lib/xe/xe_spin.c b/lib/xe/xe_spin.c
index ff19128b6..ad55293f5 100644
--- a/lib/xe/xe_spin.c
+++ b/lib/xe/xe_spin.c
@@ -205,6 +205,35 @@ void xe_spin_init(struct xe_spin *spin, struct xe_spin_opts *opts)
igt_assert(b <= ARRAY_SIZE(spin->batch));
}
+/**
+ * xe_spin_reset:
+ * @fd: xe device file descriptor
+ * @spin: spin state from xe_spin_new()
+ *
+ * Reset the state of spin, allowing its reuse.
+ */
+void xe_spin_reset(int fd, igt_spin_t *spin)
+{
+ struct drm_xe_sync sync = {
+ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+ .flags = DRM_XE_SYNC_FLAG_SIGNAL,
+ .handle = spin->syncobj,
+ };
+ struct drm_xe_exec exec = {
+ .num_batch_buffer = 1,
+ .num_syncs = 1,
+ .syncs = to_user_pointer(&sync),
+ .exec_queue_id = spin->engine,
+ .address = spin->address,
+ };
+
+ xe_spin_init_opts((struct xe_spin *)spin->xe_spin,
+ .addr = spin->address,
+ .preempt = !(spin->opts.flags & IGT_SPIN_NO_PREEMPTION));
+ igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_EXEC, &exec), 0);
+ xe_spin_wait_started((struct xe_spin *)spin->xe_spin);
+}
+
/**
* xe_spin_started:
* @spin: pointer to spinner mapped bo
diff --git a/lib/xe/xe_spin.h b/lib/xe/xe_spin.h
index 5c7566423..5dfe05cb5 100644
--- a/lib/xe/xe_spin.h
+++ b/lib/xe/xe_spin.h
@@ -77,6 +77,7 @@ uint32_t xe_spin_nsec_to_ticks(int fd, int gt_id, uint64_t nsec);
void xe_spin_init(struct xe_spin *spin, struct xe_spin_opts *opts);
#define xe_spin_init_opts(fd, ...) \
xe_spin_init(fd, &((struct xe_spin_opts){__VA_ARGS__}))
+void xe_spin_reset(int fd, igt_spin_t *spin);
bool xe_spin_started(struct xe_spin *spin);
void xe_spin_wait_started(struct xe_spin *spin);
void xe_spin_end(struct xe_spin *spin);
--
2.34.1
next prev parent reply other threads:[~2026-01-06 16:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-06 16:47 [PATCH i-g-t v4 0/3] Improve engine activity accuracy test with spinner reuse Soham Purkait
2026-01-06 16:47 ` Soham Purkait [this message]
2026-01-06 16:48 ` [PATCH i-g-t v4 2/3] lib/xe/xe_spin: Export xe_spin_sync_wait Soham Purkait
2026-01-06 16:48 ` [PATCH i-g-t v4 3/3] tests/intel/xe_pmu: Refine engine activity accuracy test Soham Purkait
2026-01-07 8:45 ` Riana Tauro
2026-01-06 17:44 ` ✓ Xe.CI.BAT: success for Improve engine activity accuracy test with spinner reuse (rev6) Patchwork
2026-01-06 18:02 ` ✓ i915.CI.BAT: " Patchwork
2026-01-06 18:59 ` ✓ Xe.CI.Full: " Patchwork
2026-01-06 22:15 ` ✓ i915.CI.Full: " Patchwork
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=20260106164801.46353-2-soham.purkait@intel.com \
--to=soham.purkait@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=badal.nilawar@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@intel.com \
--cc=riana.tauro@intel.com \
--cc=umesh.nerlige.ramappa@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