Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Manszewski <christoph.manszewski@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH 1/1] tests/intel/xe_vm: Add 'partial-unbinds' subtest
Date: Tue, 31 Oct 2023 16:01:40 +0100	[thread overview]
Message-ID: <20231031150140.374123-2-christoph.manszewski@intel.com> (raw)
In-Reply-To: <20231031150140.374123-1-christoph.manszewski@intel.com>

Xe supports partial unbind operations in asynchronous mode. Add basic
coverage for this feature.

Signed-off-by: Christoph Manszewski <christoph.manszewski@intel.com>
---
 tests/intel/xe_vm.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/tests/intel/xe_vm.c b/tests/intel/xe_vm.c
index dd3302337..eeb49122a 100644
--- a/tests/intel/xe_vm.c
+++ b/tests/intel/xe_vm.c
@@ -256,6 +256,46 @@ test_bind_one_bo_many_times_many_vm(int fd)
 	__test_bind_one_bo(fd, 0, addrs_size, addrs);
 }
 
+/**
+ * SUBTEST: partial-unbinds
+ * Description: Test partial unbinds
+ * Functionality: unbind
+ * Test category: functionality test
+ */
+
+static void test_partial_unbinds(int fd)
+{
+	uint32_t vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+	size_t bo_size = 3 * xe_get_default_alignment(fd);
+	uint32_t bo = xe_bo_create(fd, 0, vm, bo_size);
+	uint64_t unbind_size = bo_size / 3;
+	uint64_t addr = 0x1a0000;
+
+	struct drm_xe_sync sync = {
+	    .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL,
+	    .handle = syncobj_create(fd, 0),
+	};
+
+	xe_vm_bind_async(fd, vm, 0, bo, 0, addr, bo_size, &sync, 1);
+	igt_assert(syncobj_wait(fd, &sync.handle, 1, INT64_MAX, 0, NULL));
+
+	syncobj_reset(fd, &sync.handle, 1);
+	xe_vm_unbind_async(fd, vm, 0, 0, addr + unbind_size, unbind_size, &sync, 1);
+	igt_assert(syncobj_wait(fd, &sync.handle, 1, INT64_MAX, 0, NULL));
+
+	syncobj_reset(fd, &sync.handle, 1);
+	xe_vm_unbind_async(fd, vm, 0, 0, addr, unbind_size, &sync, 1);
+	igt_assert(syncobj_wait(fd, &sync.handle, 1, INT64_MAX, 0, NULL));
+
+	syncobj_reset(fd, &sync.handle, 1);
+	xe_vm_unbind_async(fd, vm, 0, 0, addr + 2 * unbind_size, unbind_size, &sync, 1);
+	igt_assert(syncobj_wait(fd, &sync.handle, 1, INT64_MAX, 0, NULL));
+
+	syncobj_destroy(fd, sync.handle);
+	gem_close(fd, bo);
+	xe_vm_destroy(fd, vm);
+}
+
 /**
  * SUBTEST: unbind-all-%d-vmas
  * Description: Test unbind all with %arg[1] VMAs
@@ -1827,6 +1867,9 @@ igt_main
 	igt_subtest("scratch")
 		test_scratch(fd);
 
+	igt_subtest("partial-unbinds")
+		test_partial_unbinds(fd);
+
 	igt_subtest("unbind-all-2-vmas")
 		unbind_all(fd, 2);
 
-- 
2.40.1

  reply	other threads:[~2023-10-31 15:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-31 15:01 [igt-dev] [PATCH 0/1] tests/intel/xe_vm: Add 'partial-unbinds' subtest Christoph Manszewski
2023-10-31 15:01 ` Christoph Manszewski [this message]
2023-10-31 17:57   ` [igt-dev] [PATCH 1/1] " Matthew Brost
2023-10-31 18:59 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
2023-10-31 20:19 ` [igt-dev] ✓ CI.xeBAT: success " 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=20231031150140.374123-2-christoph.manszewski@intel.com \
    --to=christoph.manszewski@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