Skip to contentSkip to conversation

Multi-Tile tracking in IGT

PATCH New [email protected] 1 participant 2 messages Aug 18, 2025 Library code

lore
Share & tools
lore
#0 lore raw

cover Multi-Tile tracking in IGT

From: Nishit Sharma <[email protected]>

Revision 1:
In multi-tile scenario it was assumed tile_id == gt_id which is not always the case. The patch version 1 tracks the valid tile_id and patch version 2 queries valid tile_id in order to check tile_ID returned from UAPI is in order or out of order.

v2:
- Incorporated review comments
- Moved common function calls to IGT lib

Nishit Sharma (1):
lib/xe: Track valid Tile IDs

 lib/igt_sysfs.c   | 29 +++++++++++++++------
 lib/xe/xe_query.c | 66 +++++++++++++++++++++++++----------------------
 lib/xe/xe_query.h |  1 +
 3 files changed, 57 insertions(+), 39 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/1 lib/xe: Track valid Tile IDs

From: Nishit Sharma <[email protected]>

Iterating drm_xe_gt structure to get valid tile ID instead of assuming tile_id == gt_id and finding sysfs path for GTS in multi-tile platforms. Initially it was assumed tile_id == gt_id in multi-tile platform and if gt_id = X passed, it was considered tileX.

---
 lib/igt_sysfs.c   | 29 +++++++++++++++------
 lib/xe/xe_query.c | 66 +++++++++++++++++++++++++----------------------
 lib/xe/xe_query.h |  1 +
 3 files changed, 57 insertions(+), 39 deletions(-)
lib/igt_sysfs.c +21 -8
index 96ca57ed9..c31d1477a 100644
@@ -233,9 +233,14 @@ char *xe_sysfs_gt_path(int xe_device, int gt, char *path, int pathlen)
 	if (igt_debug_on(fstat(xe_device, &st)) || igt_debug_on(!S_ISCHR(st.st_mode)))
 		return NULL;
 
-	if (IS_PONTEVECCHIO(intel_get_drm_devid(xe_device)))
+	if (IS_PONTEVECCHIO(intel_get_drm_devid(xe_device))) {
+		struct xe_device *xe_dev = xe_device_get(xe_device);
+
+		igt_assert(xe_dev);
+
 		snprintf(path, pathlen, "/sys/dev/char/%d:%d/device/tile%d/gt%d",
-			 major(st.st_rdev), minor(st.st_rdev), gt, gt);
+			 major(st.st_rdev), minor(st.st_rdev), drm_xe_get_tile(xe_dev, gt), gt);
+	}
 	else
 		snprintf(path, pathlen, "/sys/dev/char/%d:%d/device/tile0/gt%d",
 			 major(st.st_rdev), minor(st.st_rdev), gt);
@@ -306,8 +311,8 @@ bool xe_sysfs_gt_has_node(int xe_device, int gt, const char *node)
 char *
 xe_sysfs_engine_path(int xe_device, int gt, int class, char *path, int pathlen)
 {
+	int tile;
 	struct stat st;
-	int tile = IS_PONTEVECCHIO(intel_get_drm_devid(xe_device)) ? gt : 0;
 
 	if (xe_device < 0)
 		return NULL;
@@ -315,9 +320,16 @@ xe_sysfs_engine_path(int xe_device, int gt, int class, char *path, int pathlen)
 	if (igt_debug_on(fstat(xe_device, &st)) || igt_debug_on(!S_ISCHR(st.st_mode)))
 		return NULL;
 
-	snprintf(path, pathlen, "/sys/dev/char/%d:%d/device/tile%d/gt%d/engines/%s",
-		 major(st.st_rdev), minor(st.st_rdev), tile, gt,
-		 xe_engine_class_short_string(class));
+	if (IS_PONTEVECCHIO(intel_get_drm_devid(xe_device))) {
+		struct xe_device *xe_dev = xe_device_get(xe_device);
+
+		igt_assert(xe_dev);
+
+		snprintf(path, pathlen, "/sys/dev/char/%d:%d/device/tile%d/gt%d/engines/%s",
+			 major(st.st_rdev), minor(st.st_rdev), drm_xe_get_tile(xe_dev, gt), gt);
+	} else
+		snprintf(path, pathlen, "/sys/dev/char/%d:%d/device/tile%d/gt%d/engines/%s",
+			 major(st.st_rdev), minor(st.st_rdev), 0, gt, xe_engine_class_short_string(class));
 
 	if (!access(path, F_OK))
 		return path;
@@ -506,6 +518,7 @@ void igt_drm_debug_mask_reset_exit_handler(int sig)
  */
 void igt_drm_debug_mask_update(unsigned int mask_to_set)
 {
+	unsigned int new_debug_mask;
 	static bool debug_mask_read_once = true;
 	char buf[20];
 	int dir;
@@ -524,8 +537,8 @@ void igt_drm_debug_mask_update(unsigned int mask_to_set)
 		}
 	}
 
-	igt_debug("Setting DRM debug mask to %d\n", mask_to_set);
-	snprintf(buf, sizeof(buf), "%d", mask_to_set);
+	igt_debug("Setting DRM debug mask to %d\n", new_debug_mask);
+	snprintf(buf, sizeof(buf), "%d", new_debug_mask);
 	igt_assert(igt_sysfs_set(dir, "debug", buf));
 
 	close(dir);
lib/xe/xe_query.c +35 -31

105 lines not on this page · raw message

lib/xe/xe_query.h +1 -0
index cc54ec956..ca6249b0d 100644
@@ -101,6 +101,7 @@ unsigned int xe_dev_max_gt(int fd);
 uint64_t all_memory_regions(int fd);
 uint64_t system_memory(int fd);
 const struct drm_xe_gt *drm_xe_get_gt(struct xe_device *xe_dev, int gt_id);
+uint32_t drm_xe_get_tile(struct xe_device *xe_dev, int gt_id);
 uint64_t vram_memory(int fd, int gt);
 uint64_t vram_if_possible(int fd, int gt);
 struct drm_xe_engine *xe_engines(int fd);
Signature · 1 line
2.43.0