Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: janga.rahul.kumar@intel.com
To: igt-dev@lists.freedesktop.org, ramadevi.gandi@intel.com,
	janga.rahul.kumar@intel.com
Subject: [igt-dev] [PATCH i-g-t 1/2] tests/xe_vm.c: Add VM bind error capture test
Date: Wed,  7 Jun 2023 13:33:51 +0530	[thread overview]
Message-ID: <20230607080352.950226-2-janga.rahul.kumar@intel.com> (raw)
In-Reply-To: <20230607080352.950226-1-janga.rahul.kumar@intel.com>

From: Janga Rahul Kumar <janga.rahul.kumar@intel.com>

Test injects error during vm bind and check the captured
bind address.

Signed-off-by: Janga Rahul Kumar <janga.rahul.kumar@intel.com>
---
 tests/xe/xe_vm.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/tests/xe/xe_vm.c b/tests/xe/xe_vm.c
index 861822b4..0da6c847 100644
--- a/tests/xe/xe_vm.c
+++ b/tests/xe/xe_vm.c
@@ -1589,6 +1589,56 @@ try_again_after_invalidate:
 	xe_vm_destroy(fd, vm);
 }
 
+/**
+ * SUBTEST: vm-error-capture-address
+ * Description: Test to check vm error capture
+ * Functionality: error capture
+ * Run type: FULL
+ * TODO: change ``'Run type' == FULL`` to a better category
+ *
+ */
+static void
+vm_error_capture_address(int fd)
+{
+	struct drm_xe_vm_bind_op_error_capture capture = {};
+	struct drm_xe_ext_vm_set_property ext = {
+		.base.next_extension = 0,
+		.base.name = XE_VM_EXTENSION_SET_PROPERTY,
+		.property = XE_VM_PROPERTY_BIND_OP_ERROR_CAPTURE_ADDRESS,
+		.value = to_user_pointer(&capture),
+	};
+
+	uint32_t vm, bo;
+	uint64_t addr = 0x1a0000;
+	size_t bo_size;
+
+	struct drm_xe_sync sync = {
+		.flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL,
+	};
+
+	sync.handle = syncobj_create(fd, 0);
+	bo_size = 0x1000 * 32;
+
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_BIND_OPS,
+				to_user_pointer(&ext));
+
+	bo = xe_bo_create(fd, 0, vm, bo_size);
+#define INJECT_ERROR	(0x1 << 31)
+	__xe_vm_bind_assert(fd, vm, 0, bo, 0, addr, bo_size,
+			XE_VM_BIND_OP_MAP | XE_VM_BIND_FLAG_ASYNC |
+			INJECT_ERROR, &sync, 1, 0, 0);
+
+	igt_assert_eq(addr, capture.addr);
+
+	syncobj_destroy(fd, sync.handle);
+
+	if (bo)
+		gem_close(fd, bo);
+
+	xe_vm_destroy(fd, vm);
+}
+
+
 igt_main
 {
 	struct drm_xe_engine_class_instance *hwe, *hwe_non_copy = NULL;
@@ -1871,6 +1921,9 @@ igt_main
 		}
 	}
 
+	igt_subtest("vm-error-capture-address")
+		vm_error_capture_address(fd);
+
 	igt_fixture {
 		xe_device_put(fd);
 		close(fd);
-- 
2.25.1

  reply	other threads:[~2023-06-07  8:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07  8:03 [igt-dev] [PATCH i-g-t 0/2] Add VM error capture tests janga.rahul.kumar
2023-06-07  8:03 ` janga.rahul.kumar [this message]
2023-06-07  8:03 ` [igt-dev] [PATCH i-g-t 2/2] tests/xe_vm.c: Add Negative test to VM error capture janga.rahul.kumar
2023-06-09  5:44   ` Dandamudi, Priyanka
2023-06-09 12:59     ` Kamil Konieczny
2023-06-07  8:26 ` [igt-dev] ✗ GitLab.Pipeline: warning for Add VM error capture tests Patchwork
2023-06-07  8:40 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-06-07 19:58 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-06-08 14:11 ` [igt-dev] [PATCH i-g-t 0/2] " Matthew Brost

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=20230607080352.950226-2-janga.rahul.kumar@intel.com \
    --to=janga.rahul.kumar@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=ramadevi.gandi@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