From: Jonathan Cavitt <jonathan.cavitt@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: saurabhg.gupta@intel.com, alex.zuo@intel.com,
jonathan.cavitt@intel.com, joonas.lahtinen@linux.intel.com,
matthew.brost@intel.com, jianxun.zhang@intel.com,
stuart.summers@intel.com, shuicheng.lin@intel.com,
nishit.sharma@intel.com, matthew.auld@intel.com,
kamil.konieczny@linux.intel.com
Subject: [PATCH v9 3/4] tests/intel/xe_vm: Add DRM_IOCTL_XE_VM_GET_PROPERTY validation tests
Date: Wed, 1 Apr 2026 17:09:18 +0000 [thread overview]
Message-ID: <20260401170914.16908-9-jonathan.cavitt@intel.com> (raw)
In-Reply-To: <20260401170914.16908-6-jonathan.cavitt@intel.com>
Add tests to xe_vm that exercise the new DRM_IOCTL_XE_VM_GET_PROPERTY
ioctl. Specifically, add input validation tests that exercise the
return values for improperly formatted ioctl structures.
v2:
- Make vm creation consistent between patches (jcavitt)
v3:
- Add missing invalid extensions and pad tests (Auld)
Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Reviewed-by: Nishit Sharma <nishit.sharma@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
---
tests/intel/xe_vm.c | 109 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 109 insertions(+)
diff --git a/tests/intel/xe_vm.c b/tests/intel/xe_vm.c
index ccff8f8046..b9a6282f9a 100644
--- a/tests/intel/xe_vm.c
+++ b/tests/intel/xe_vm.c
@@ -2450,6 +2450,97 @@ static void test_oom(int fd)
}
}
+/**
+ * SUBTEST: vm-get-property-invalid-reserved
+ * Functionality: ioctl_input_validation
+ * Description: Check query with invalid reserved returns expected error code
+ *
+ * SUBTEST: vm-get-property-invalid-extensions
+ * Functionality: ioctl_input_validation
+ * Description: Check query with invalid extensions returns expected error code
+ *
+ * SUBTEST: vm-get-property-invalid-pad
+ * Functionality: ioctl_input_validation
+ * Description: Check query with invalid pad returns expected error code
+ *
+ * SUBTEST: vm-get-property-invalid-vm-id
+ * Functionality: ioctl_input_validation
+ * Description: Check query with invalid vm_id returns expected error code
+ *
+ * SUBTEST: vm-get-property-invalid-size
+ * Functionality: ioctl_input_validation
+ * Description: Check query with invalid size return expected error code
+ *
+ * SUBTEST: vm-get-property-invalid-property
+ * Functionality: ioctl_input_validation
+ * Description: Check query with invalid property returns expected error code
+ */
+static void get_property_invalid_reserved(int fd, uint32_t vm)
+{
+ struct drm_xe_vm_get_property query = {
+ .reserved[0] = 0xdeadbeef,
+ };
+
+ do_ioctl_err(fd, DRM_IOCTL_XE_VM_GET_PROPERTY, &query, EINVAL);
+}
+
+static void get_property_invalid_extensions(int fd, uint32_t vm)
+{
+ struct drm_xe_vm_get_property query = {
+ .extensions = 0xdeadbeef,
+ };
+
+ do_ioctl_err(fd, DRM_IOCTL_XE_VM_GET_PROPERTY, &query, EINVAL);
+}
+
+static void get_property_invalid_pad(int fd, uint32_t vm)
+{
+ struct drm_xe_vm_get_property query = {
+ .pad = 0xdeadbeef,
+ };
+
+ do_ioctl_err(fd, DRM_IOCTL_XE_VM_GET_PROPERTY, &query, EINVAL);
+}
+
+static void get_property_invalid_vm_id(int fd, uint32_t vm)
+{
+ struct drm_xe_vm_get_property query = {
+ .vm_id = 0xdeadbeef,
+ };
+
+ do_ioctl_err(fd, DRM_IOCTL_XE_VM_GET_PROPERTY, &query, ENOENT);
+}
+
+static void get_property_invalid_size(int fd, uint32_t vm)
+{
+ struct drm_xe_vm_get_property query = {
+ .vm_id = vm,
+ .property = DRM_XE_VM_GET_PROPERTY_FAULTS,
+ .size = -1,
+ };
+
+ do_ioctl_err(fd, DRM_IOCTL_XE_VM_GET_PROPERTY, &query, EINVAL);
+}
+
+static void get_property_invalid_property(int fd, uint32_t vm)
+{
+ struct drm_xe_vm_get_property query = {
+ .vm_id = vm,
+ .property = 0xdeadbeef,
+ };
+
+ do_ioctl_err(fd, DRM_IOCTL_XE_VM_GET_PROPERTY, &query, EINVAL);
+}
+
+static void test_get_property(int fd, void (*func)(int fd, uint32_t vm))
+{
+ uint32_t vm;
+
+ vm = xe_vm_create(fd, 0, 0);
+ func(fd, vm);
+ xe_vm_destroy(fd, vm);
+}
+
int igt_main()
{
struct drm_xe_engine_class_instance *hwe, *hwe_non_copy = NULL;
@@ -2562,6 +2653,19 @@ int igt_main()
{ }
};
+ const struct vm_get_property {
+ const char *name;
+ void (*test)(int fd, uint32_t vm);
+ } xe_vm_get_property_tests[] = {
+ { "invalid-reserved", get_property_invalid_reserved },
+ { "invalid-extensions", get_property_invalid_extensions },
+ { "invalid-pad", get_property_invalid_pad },
+ { "invalid-vm-id", get_property_invalid_vm_id },
+ { "invalid-size", get_property_invalid_size },
+ { "invalid-property", get_property_invalid_property },
+ { }
+ };
+
igt_fixture() {
fd = drm_open_driver(DRIVER_XE);
@@ -2850,6 +2954,11 @@ int igt_main()
test_oom(fd);
}
+ for (const struct vm_get_property *f = xe_vm_get_property_tests; f->name; f++) {
+ igt_subtest_f("vm-get-property-%s", f->name)
+ test_get_property(fd, f->test);
+ }
+
igt_fixture()
drm_close_driver(fd);
}
--
2.43.0
next prev parent reply other threads:[~2026-04-01 17:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 17:09 [PATCH v9 0/4] tests/intel/xe_vm: Add drm_xe_vm_get_property tests Jonathan Cavitt
2026-04-01 17:09 ` [PATCH v9 1/4] drm-uapi/xe: Declare xe_vm_get_property_ioctl Jonathan Cavitt
2026-04-01 17:09 ` [PATCH v9 2/4] lib/xe/xe_ioctl: Add xe_vm_get_property helper function Jonathan Cavitt
2026-04-01 17:09 ` Jonathan Cavitt [this message]
2026-04-01 17:09 ` [PATCH v9 4/4] tests/intel/xe_vm: Test DRM_IOCTL_XE_VM_GET_PROPERTY fault reporting Jonathan Cavitt
2026-04-01 21:15 ` ✓ Xe.CI.BAT: success for tests/intel/xe_vm: Add drm_xe_vm_get_property tests Patchwork
2026-04-01 21:47 ` ✓ i915.CI.BAT: " Patchwork
2026-04-02 4:02 ` ✓ Xe.CI.FULL: " Patchwork
2026-04-02 16:46 ` ✗ i915.CI.Full: failure " 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=20260401170914.16908-9-jonathan.cavitt@intel.com \
--to=jonathan.cavitt@intel.com \
--cc=alex.zuo@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jianxun.zhang@intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=kamil.konieczny@linux.intel.com \
--cc=matthew.auld@intel.com \
--cc=matthew.brost@intel.com \
--cc=nishit.sharma@intel.com \
--cc=saurabhg.gupta@intel.com \
--cc=shuicheng.lin@intel.com \
--cc=stuart.summers@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.