From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 1/3] xe/xe_ioctl: Add xe_wait_ufence_abstime() helper
Date: Wed, 31 May 2023 21:30:41 +0200 [thread overview]
Message-ID: <20230531193043.558461-2-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20230531193043.558461-1-zbigniew.kempczynski@intel.com>
Xe user fences supports passing timeout in relative or absolute form.
Add helper for absolute one.
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
lib/xe/xe_ioctl.c | 20 ++++++++++++++++++++
lib/xe/xe_ioctl.h | 3 +++
2 files changed, 23 insertions(+)
diff --git a/lib/xe/xe_ioctl.c b/lib/xe/xe_ioctl.c
index 66a8393fe9..fe61b70a83 100644
--- a/lib/xe/xe_ioctl.c
+++ b/lib/xe/xe_ioctl.c
@@ -418,6 +418,26 @@ void xe_wait_ufence(int fd, uint64_t *addr, uint64_t value,
igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_WAIT_USER_FENCE, &wait), 0);
}
+long xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value,
+ struct drm_xe_engine_class_instance *eci,
+ int64_t timeout)
+{
+ struct drm_xe_wait_user_fence wait = {
+ .addr = to_user_pointer(addr),
+ .op = DRM_XE_UFENCE_WAIT_EQ,
+ .flags = !eci ? DRM_XE_UFENCE_WAIT_SOFT_OP | DRM_XE_UFENCE_WAIT_ABSTIME : 0,
+ .value = value,
+ .mask = DRM_XE_UFENCE_WAIT_U64,
+ .timeout = timeout,
+ .num_engines = eci ? 1 : 0,
+ .instances = eci ? to_user_pointer(eci) : 0,
+ };
+
+ igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_WAIT_USER_FENCE, &wait), 0);
+
+ return wait.timeout;
+}
+
void xe_force_gt_reset(int fd, int gt)
{
char reset_string[128];
diff --git a/lib/xe/xe_ioctl.h b/lib/xe/xe_ioctl.h
index 049cd183d6..9b44892fe9 100644
--- a/lib/xe/xe_ioctl.h
+++ b/lib/xe/xe_ioctl.h
@@ -82,6 +82,9 @@ void xe_exec_wait(int fd, uint32_t engine, uint64_t addr);
void xe_wait_ufence(int fd, uint64_t *addr, uint64_t value,
struct drm_xe_engine_class_instance *eci,
int64_t timeout);
+long xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value,
+ struct drm_xe_engine_class_instance *eci,
+ int64_t timeout);
void xe_force_gt_reset(int fd, int gt);
void xe_vm_madvise(int fd, uint32_t vm, uint64_t addr, uint64_t size,
uint32_t property, uint32_t value);
--
2.34.1
next prev parent reply other threads:[~2023-05-31 19:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-31 19:30 [igt-dev] [PATCH i-g-t 0/3] Add absolute user fence timeout Zbigniew Kempczyński
2023-05-31 19:30 ` Zbigniew Kempczyński [this message]
2023-06-01 17:32 ` [igt-dev] [PATCH i-g-t 1/3] xe/xe_ioctl: Add xe_wait_ufence_abstime() helper Kamil Konieczny
2023-05-31 19:30 ` [igt-dev] [PATCH i-g-t 2/3] xe/xe_ioctl: Return remaining timeout of user fence wait Zbigniew Kempczyński
2023-06-01 11:31 ` Kumar, Janga Rahul
2023-05-31 19:30 ` [igt-dev] [PATCH i-g-t 3/3] tests/xe_waitfence: Add abstime wait subtest Zbigniew Kempczyński
2023-06-01 17:38 ` Kamil Konieczny
2023-06-02 7:45 ` Zbigniew Kempczyński
2023-05-31 23:28 ` [igt-dev] ✓ Fi.CI.BAT: success for Add absolute user fence timeout Patchwork
2023-06-02 15:19 ` [igt-dev] ✓ Fi.CI.IGT: " 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=20230531193043.558461-2-zbigniew.kempczynski@intel.com \
--to=zbigniew.kempczynski@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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