Skip to contentSkip to conversation

xe_vm: Add EIO test

PATCH New Matthew Brost 2 participants 2 messages May 2, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xe_vm: Add EIO test

Let's make sure bad input to VM bind doesn't crash the driver or leak resources.

---
 lib/xe/xe_ioctl.c |  22 ++++++
 lib/xe/xe_ioctl.h |   4 +
 tests/xe/xe_vm.c  | 183 +++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 208 insertions(+), 1 deletion(-)
lib/xe/xe_ioctl.c +22 -0
index 77e6d2d13..b9bfc2e8e 100644
@@ -70,6 +70,28 @@ void xe_vm_unbind_all_async(int fd, uint32_t vm, uint32_t engine,
 			    sync, num_syncs, 0, 0);
 }
 
+int __xe_vm_bind_array(int fd, uint32_t vm, uint32_t engine,
+		       struct drm_xe_vm_bind_op *bind_ops,
+		       uint32_t num_bind, struct drm_xe_sync *sync,
+		       uint32_t num_syncs)
+{
+	struct drm_xe_vm_bind bind = {
+		.vm_id = vm,
+		.num_binds = num_bind,
+		.vector_of_binds = (uintptr_t)bind_ops,
+		.num_syncs = num_syncs,
+		.syncs = (uintptr_t)sync,
+		.engine_id = engine,
+	};
+
+	igt_assert(num_bind > 1);
+
+	if (igt_ioctl(fd, DRM_IOCTL_XE_VM_BIND, &bind))
+		return -errno;
+
+	return 0;
+}
+
 void xe_vm_bind_array(int fd, uint32_t vm, uint32_t engine,
 		      struct drm_xe_vm_bind_op *bind_ops,
 		      uint32_t num_bind, struct drm_xe_sync *sync,
lib/xe/xe_ioctl.h +4 -0
index f5d39e81c..9757aab37 100644
@@ -56,6 +56,10 @@ void xe_vm_bind_sync(int fd, uint32_t vm, uint32_t bo, uint64_t offset,
 		     uint64_t addr, uint64_t size);
 void xe_vm_unbind_sync(int fd, uint32_t vm, uint64_t offset,
 		       uint64_t addr, uint64_t size);
+int __xe_vm_bind_array(int fd, uint32_t vm, uint32_t engine,
+		       struct drm_xe_vm_bind_op *bind_ops,
+		       uint32_t num_bind, struct drm_xe_sync *sync,
+		       uint32_t num_syncs);
 void xe_vm_bind_array(int fd, uint32_t vm, uint32_t engine,
 		      struct drm_xe_vm_bind_op *bind_ops,
 		      uint32_t num_bind, struct drm_xe_sync *sync,
tests/xe/xe_vm.c +182 -1

201 lines not on this page · raw message

Signature · 1 line
2.34.1
#1 lore raw

[igt-dev] ✗ Fi.CI.BUILD: failure for xe_vm: Add EIO test

== Series Details ==

== Series Details ==

Series: xe_vm: Add EIO test
URL : https://patchwork.freedesktop.org/series/117200/
State : failure

== Summary ==

Applying: xe_vm: Add EIO test
Using index info to reconstruct a base tree...
M lib/xe/xe_ioctl.c
M lib/xe/xe_ioctl.h
M tests/xe/xe_vm.c
Falling back to patching base and 3-way merge... Auto-merging tests/xe/xe_vm.c
CONFLICT (content): Merge conflict in tests/xe/xe_vm.c Auto-merging lib/xe/xe_ioctl.h
Auto-merging lib/xe/xe_ioctl.c
Patch failed at 0001 xe_vm: Add EIO test
When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".