[PATCH i-g-t] tests/intel/xe_create: Add test for low latency hint support

Tejas Upadhyay tejas.upadhyay at intel.com
Thu Feb 27 12:21:17 UTC 2025


KMD introduced low latency hint support for GT frequency
to guc. Lets add test to validate the feature support.

KMD patch:https://patchwork.freedesktop.org/patch/639677/

Signed-off-by: Tejas Upadhyay <tejas.upadhyay at intel.com>
---
 .../drm-uapi-experimental/intel_drm_local.h   |  3 ++
 tests/intel/xe_create.c                       | 32 +++++++++++++++++++
 tests/intel/xe_query.c                        |  3 ++
 3 files changed, 38 insertions(+)

diff --git a/include/drm-uapi-experimental/intel_drm_local.h b/include/drm-uapi-experimental/intel_drm_local.h
index 40e8dcc43..3aaf1eeb9 100644
--- a/include/drm-uapi-experimental/intel_drm_local.h
+++ b/include/drm-uapi-experimental/intel_drm_local.h
@@ -22,6 +22,9 @@ extern "C" {
 
 #define DRM_XE_MMAP_OFFSET_FLAG_PCI_BARRIER	(1 << 0)
 
+#define DRM_XE_EXEC_QUEUE_LOW_LATENCY_HINT      (1 << 0)
+#define DRM_XE_QUERY_CONFIG_FLAG_HAS_LOW_LATENCY        (1 << 1)
+
 #if defined(__cplusplus)
 }
 #endif
diff --git a/tests/intel/xe_create.c b/tests/intel/xe_create.c
index e3ebb9fd4..b22084c84 100644
--- a/tests/intel/xe_create.c
+++ b/tests/intel/xe_create.c
@@ -59,6 +59,35 @@ static int __create_bo(int fd, uint32_t vm, uint64_t size, uint32_t placement,
 	return ret;
 }
 
+/**
+ * SUBTEST: valid-flag
+ * Functionality: ioctl_input_validation
+ * Description: Check ioctl with valid flag returns expected pass if supported
+ */
+static void valid_flag(int fd)
+{
+	uint32_t vm;
+	struct drm_xe_query_config *config = xe_config(fd);
+	struct drm_xe_exec_queue_create create = {
+		.flags = DRM_XE_EXEC_QUEUE_LOW_LATENCY_HINT,
+		.extensions = 0,
+		.vm_id = 0,
+		.width = 1,
+		.num_placements = 1,
+		.instances = to_user_pointer(&xe_engine(fd, 0)->instance),
+	};
+
+	igt_assert_neq(config->info[DRM_XE_QUERY_CONFIG_FLAGS] &
+			DRM_XE_QUERY_CONFIG_FLAG_HAS_LOW_LATENCY, 0);
+
+	vm = xe_vm_create(fd, 0, 0);
+	create.vm_id = vm;
+
+	do_ioctl(fd, DRM_IOCTL_XE_EXEC_QUEUE_CREATE, &create);
+	xe_exec_queue_destroy(fd, create.exec_queue_id);
+	xe_vm_destroy(fd, vm);
+}
+
 /**
  * SUBTEST: invalid-flag
  * Functionality: ioctl_input_validation
@@ -503,6 +532,9 @@ igt_main_args("Q:p:", NULL, help_str, opt_handler, NULL)
 	igt_fixture
 		xe = drm_open_driver(DRIVER_XE);
 
+	igt_subtest("valid-flag")
+		valid_flag(xe);
+
 	igt_subtest("invalid-flag")
 		invalid_flag(xe);
 
diff --git a/tests/intel/xe_query.c b/tests/intel/xe_query.c
index 1566680e7..e93988c49 100644
--- a/tests/intel/xe_query.c
+++ b/tests/intel/xe_query.c
@@ -533,6 +533,9 @@ test_query_config(int fd)
 	igt_info("  DRM_XE_QUERY_CONFIG_FLAG_HAS_VRAM\t%s\n",
 		config->info[DRM_XE_QUERY_CONFIG_FLAGS] &
 		DRM_XE_QUERY_CONFIG_FLAG_HAS_VRAM ? "ON":"OFF");
+	igt_info("  DRM_XE_QUERY_CONFIG_FLAG_HAS_LOW_LATENCY\t%s\n",
+		 config->info[DRM_XE_QUERY_CONFIG_FLAGS] &
+		 DRM_XE_QUERY_CONFIG_FLAG_HAS_LOW_LATENCY ? "ON":"OFF");
 	igt_info("DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT\t\t%#llx\n",
 		config->info[DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT]);
 	igt_info("DRM_XE_QUERY_CONFIG_VA_BITS\t\t\t%llu\n",
-- 
2.34.1



More information about the igt-dev mailing list