[Intel-xe] [PATCH i-g-t] tests/xe/xe_access_counter: Negative access counter test

priyanka.dandamudi at intel.com priyanka.dandamudi at intel.com
Fri Oct 20 05:06:48 UTC 2023


From: Priyanka Dandamudi <priyanka.dandamudi at intel.com>

Added a negative test related to access counter.
It tries to test GRANULARITY access counter parameter.
It should return -EINVAL parameter for invalid values.

v2: Added subtest description.

v3: Added min value -1 to check for min granularity range.(Rahul)

Cc: Janga Rahul Kumar <janga.rahul.kumar at intel.com>
Cc: Sai Gowtham Ch <sai.gowtham.ch at intel.com>
Signed-off-by: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
Reviewed-by: Janga Rahul Kumar <janga.rahul.kumar at intel.com>
---
 tests/intel/xe_access_counter.c | 81 +++++++++++++++++++++++++++++++++
 tests/meson.build               |  1 +
 2 files changed, 82 insertions(+)
 create mode 100644 tests/intel/xe_access_counter.c

diff --git a/tests/intel/xe_access_counter.c b/tests/intel/xe_access_counter.c
new file mode 100644
index 000000000..7e41abaa8
--- /dev/null
+++ b/tests/intel/xe_access_counter.c
@@ -0,0 +1,81 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+/**
+ * TEST: Basic tests for access counter functionality
+ * Category: Software building block
+ * Run type: FULL
+ * Sub-category: access counter
+ * Functionality: access counter
+ * Test category: functionality test
+ * SUBTEST: invalid-param
+ * Description: Giving invalid granularity size parameter and checks for invalid error.
+ */
+
+#include "igt.h"
+#include "lib/igt_syncobj.h"
+#include "lib/intel_reg.h"
+#include "xe_drm.h"
+
+#include "xe/xe_ioctl.h"
+#include "xe/xe_query.h"
+#include <string.h>
+
+#define SZ_64M  3
+igt_main
+{
+	int fd;
+
+	igt_fixture {
+		uint16_t devid;
+
+		fd = drm_open_driver(DRIVER_XE);
+		devid = intel_get_drm_devid(fd);
+		igt_require(xe_supports_faults(fd));
+		igt_require(IS_PONTEVECCHIO(devid));
+	}
+
+	igt_subtest("invalid-param") {
+		struct drm_xe_engine_class_instance instance = {
+			 .engine_class = DRM_XE_ENGINE_CLASS_VM_BIND_SYNC,
+		 };
+
+		int ret;
+		const int expected = -EINVAL;
+
+		struct drm_xe_ext_set_property ext = {
+			.base.next_extension = 0,
+			.base.name = XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY,
+			.property = XE_EXEC_QUEUE_SET_PROPERTY_ACC_GRANULARITY,
+			.value = SZ_64M + 1,
+		};
+
+		struct drm_xe_exec_queue_create create = {
+			.extensions = to_user_pointer(&ext),
+			.vm_id = xe_vm_create(fd, 0, 0),
+			.width = 1,
+			.num_placements = 1,
+			.instances = to_user_pointer(&instance),
+		};
+
+		if (igt_ioctl(fd, DRM_IOCTL_XE_EXEC_QUEUE_CREATE, &create)) {
+			ret = -errno;
+			errno = 0;
+		}
+
+		igt_assert_eq(ret, expected);
+		ext.value = -1;
+
+		if (igt_ioctl(fd, DRM_IOCTL_XE_EXEC_QUEUE_CREATE, &create)) {
+			ret = -errno;
+			errno = 0;
+		}
+
+		igt_assert_eq(ret, expected);
+	}
+
+	igt_fixture
+		drm_close_driver(fd);
+}
diff --git a/tests/meson.build b/tests/meson.build
index 5afcd8cbb..de91b4418 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -272,6 +272,7 @@ intel_kms_progs = [
 ]
 
 intel_xe_progs = [
+	'xe_access_counter',
 	'xe_ccs',
 	'xe_create',
 	'xe_compute',
-- 
2.25.1



More information about the Intel-xe mailing list