[PATCH i-g-t] tests/intel/xe_query: Sanity check EU width

Lucas De Marchi lucas.demarchi at intel.com
Wed Jul 10 05:43:16 UTC 2024


Add a sanity check for kernel returning the expected EU width in the
topology query.

Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---

This depends on patch series to be submitted to the kernel. The local
defines are done to be able to test, but should be replaced by an update
to the uapi headers.

 tests/intel/xe_query.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tests/intel/xe_query.c b/tests/intel/xe_query.c
index 92f82f6ee..818ce7a9c 100644
--- a/tests/intel/xe_query.c
+++ b/tests/intel/xe_query.c
@@ -20,6 +20,10 @@
 #include "xe/xe_query.h"
 #include "intel_hwconfig_types.h"
 
+#define LOCAL_DRM_XE_TOPO_EU_WIDTH		5
+#define LOCAL_DRM_XE_TOPO_EU_WIDTH_SIMD16	1
+#define LOCAL_DRM_XE_TOPO_EU_WIDTH_SIMD8	0
+
 void dump_hex(void *buffer, int len);
 void dump_hex_debug(void *buffer, int len);
 const char *get_hwconfig_name(int param);
@@ -168,6 +172,7 @@ const char *get_topo_name(int value)
 	case DRM_XE_TOPO_DSS_COMPUTE: return "DSS_COMPUTE";
 	case DRM_XE_TOPO_EU_PER_DSS: return "EU_PER_DSS";
 	case DRM_XE_TOPO_L3_BANK: return "L3_BANK";
+	case LOCAL_DRM_XE_TOPO_EU_WIDTH: return "EU_WIDTH";
 	}
 	return "??";
 }
@@ -354,6 +359,7 @@ test_query_gt_list(int fd)
 static void
 test_query_gt_topology(int fd)
 {
+	uint16_t dev_id = intel_get_drm_devid(fd);
 	struct drm_xe_query_topology_mask *topology;
 	int pos = 0;
 	struct drm_xe_device_query query = {
@@ -378,10 +384,23 @@ test_query_gt_topology(int fd)
 	while (query.size >= sizeof(struct drm_xe_query_topology_mask)) {
 		struct drm_xe_query_topology_mask *topo = (struct drm_xe_query_topology_mask*)((unsigned char*)topology + pos);
 		int sz = sizeof(struct drm_xe_query_topology_mask) + topo->num_bytes;
+
 		igt_info(" gt_id: %2d type: %-12s (%d) n:%d [%d] ", topo->gt_id,
 			 get_topo_name(topo->type), topo->type, topo->num_bytes, sz);
+
+		/* sanity check EU width */
+		if (topo->type == LOCAL_DRM_XE_TOPO_EU_WIDTH) {
+			igt_assert_eq(topo->num_bytes, 1);
+
+			if (IS_PONTEVECCHIO(dev_id) || AT_LEAST_GEN(dev_id, 20))
+				igt_assert_eq(topo->mask[0], LOCAL_DRM_XE_TOPO_EU_WIDTH_SIMD16);
+			else
+				igt_assert_eq(topo->mask[0], LOCAL_DRM_XE_TOPO_EU_WIDTH_SIMD8);
+		}
+
 		for (int j=0; j< topo->num_bytes; j++)
 			igt_info(" %02x", topo->mask[j]);
+
 		igt_info("\n");
 		query.size -= sz;
 		pos += sz;
-- 
2.43.0



More information about the igt-dev mailing list