[igt-dev] [PATCH i-g-t v3 1/3] lib/xe: Add __xe_exec_queue_create()
Niranjana Vishwanathapura
niranjana.vishwanathapura at intel.com
Mon Dec 4 05:36:36 UTC 2023
Add __xe_exec_queue_create() which does not assert upon error.
Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura at intel.com>
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
lib/xe/xe_ioctl.c | 29 ++++++++++++++++++++++++-----
lib/xe/xe_ioctl.h | 3 +++
tests/intel/xe_create.c | 26 --------------------------
3 files changed, 27 insertions(+), 31 deletions(-)
diff --git a/lib/xe/xe_ioctl.c b/lib/xe/xe_ioctl.c
index a5fe7dd79..c3cb363e8 100644
--- a/lib/xe/xe_ioctl.c
+++ b/lib/xe/xe_ioctl.c
@@ -324,9 +324,9 @@ uint32_t xe_bind_exec_queue_create(int fd, uint32_t vm, uint64_t ext, bool async
return create.exec_queue_id;
}
-uint32_t xe_exec_queue_create(int fd, uint32_t vm,
- struct drm_xe_engine_class_instance *instance,
- uint64_t ext)
+uint32_t __xe_exec_queue_create(int fd, uint32_t vm,
+ struct drm_xe_engine_class_instance *instance,
+ uint64_t ext, uint32_t *exec_queue_id)
{
struct drm_xe_exec_queue_create create = {
.extensions = ext,
@@ -335,10 +335,29 @@ uint32_t xe_exec_queue_create(int fd, uint32_t vm,
.num_placements = 1,
.instances = to_user_pointer(instance),
};
+ int err;
- igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_EXEC_QUEUE_CREATE, &create), 0);
+ err = igt_ioctl(fd, DRM_IOCTL_XE_EXEC_QUEUE_CREATE, &create);
+ if (err) {
+ err = -errno;
+ igt_assume(err);
+ errno = 0;
+ return err;
+ }
- return create.exec_queue_id;
+ *exec_queue_id = create.exec_queue_id;
+ return 0;
+}
+
+uint32_t xe_exec_queue_create(int fd, uint32_t vm,
+ struct drm_xe_engine_class_instance *instance,
+ uint64_t ext)
+{
+ uint32_t exec_queue_id;
+
+ igt_assert_eq(__xe_exec_queue_create(fd, vm, instance, ext, &exec_queue_id), 0);
+
+ return exec_queue_id;
}
uint32_t xe_exec_queue_create_class(int fd, uint32_t vm, uint16_t class)
diff --git a/lib/xe/xe_ioctl.h b/lib/xe/xe_ioctl.h
index 6d91d3e8e..fc2a327b4 100644
--- a/lib/xe/xe_ioctl.h
+++ b/lib/xe/xe_ioctl.h
@@ -73,6 +73,9 @@ uint32_t xe_bo_create_caching(int fd, uint32_t vm, uint64_t size, uint32_t flags
uint16_t cpu_caching);
uint16_t __xe_default_cpu_caching_from_flags(int fd, uint32_t flags);
uint32_t xe_bo_create(int fd, int gt, uint32_t vm, uint64_t size);
+uint32_t __xe_exec_queue_create(int fd, uint32_t vm,
+ struct drm_xe_engine_class_instance *instance,
+ uint64_t ext, uint32_t *exec_queue_id);
uint32_t xe_exec_queue_create(int fd, uint32_t vm,
struct drm_xe_engine_class_instance *instance,
uint64_t ext);
diff --git a/tests/intel/xe_create.c b/tests/intel/xe_create.c
index bb55a15e1..7d3c647a1 100644
--- a/tests/intel/xe_create.c
+++ b/tests/intel/xe_create.c
@@ -93,32 +93,6 @@ enum exec_queue_destroy {
LEAK
};
-static uint32_t __xe_exec_queue_create(int fd, uint32_t vm,
- struct drm_xe_engine_class_instance *instance,
- uint64_t ext,
- uint32_t *exec_queuep)
-{
- struct drm_xe_exec_queue_create create = {
- .extensions = ext,
- .vm_id = vm,
- .width = 1,
- .num_placements = 1,
- .instances = to_user_pointer(instance),
- };
- int err = 0;
-
- if (igt_ioctl(fd, DRM_IOCTL_XE_EXEC_QUEUE_CREATE, &create) == 0) {
- *exec_queuep = create.exec_queue_id;
- } else {
- igt_warn("Can't create exec_queue, errno: %d\n", errno);
- err = -errno;
- igt_assume(err);
- }
- errno = 0;
-
- return err;
-}
-
#define MAXEXECQUEUES 2048
#define MAXTIME 5
--
2.21.0.rc0.32.g243a4c7e27
More information about the igt-dev
mailing list