return &xe->tiles[0];
}
+#define XE_MAX_GT_PER_TILE 2
+
+static inline struct xe_gt *xe_tile_get_gt(struct xe_tile *tile, u8 gt_id)
+{
+ if (drm_WARN_ON(&tile_to_xe(tile)->drm, gt_id > XE_MAX_GT_PER_TILE))
+ gt_id = 0;
+
+ return gt_id ? tile->media_gt : tile->primary_gt;
+}
+
static inline struct xe_gt *xe_device_get_gt(struct xe_device *xe, u8 gt_id)
{
+ struct xe_tile *root_tile = xe_device_get_root_tile(xe);
struct xe_gt *gt;
- XE_BUG_ON(gt_id > XE_MAX_TILES_PER_DEVICE);
-
- gt = xe->tiles[gt_id].primary_gt;
- if (drm_WARN_ON(&xe->drm, !gt))
+ /*
+ * FIXME: This only works for now because multi-tile and standalone
+ * media are mutually exclusive on the platforms we have today.
+ *
+ * id => GT mapping may change once we settle on how we want to handle
+ * our UAPI.
+ */
+ if (MEDIA_VER(xe) >= 13) {
+ gt = xe_tile_get_gt(root_tile, gt_id);
+ } else {
+ if (drm_WARN_ON(&xe->drm, gt_id > XE_MAX_TILES_PER_DEVICE))
+ gt_id = 0;
+
+ gt = xe->tiles[gt_id].primary_gt;
+ }
+
+ if (!gt)
return NULL;
- XE_BUG_ON(gt->info.id != gt_id);
- XE_BUG_ON(gt->info.type == XE_GT_TYPE_UNINITIALIZED);
+ drm_WARN_ON(&xe->drm, gt->info.id != gt_id);
+ drm_WARN_ON(&xe->drm, gt->info.type == XE_GT_TYPE_UNINITIALIZED);
return gt;
}
for ((id__) = 0; (id__) < (xe__)->info.tile_count; (id__)++) \
for_each_if ((tile__) = &(xe__)->tiles[(id__)])
+/*
+ * FIXME: This only works for now since multi-tile and standalone media
+ * happen to be mutually exclusive. Future platforms may change this...
+ */
#define for_each_gt(gt__, xe__, id__) \
- for ((id__) = 0; (id__) < (xe__)->info.tile_count; (id__++)) \
+ for ((id__) = 0; (id__) < (xe__)->info.gt_count; (id__)++) \
for_each_if ((gt__) = xe_device_get_gt((xe__), (id__)))
static inline struct xe_force_wake * gt_to_fw(struct xe_gt *gt)
return PTR_ERR(tile->primary_gt);
gt = tile->primary_gt;
- gt->info.id = id; /* FIXME: Determine sensible numbering */
+ /*
+ * FIXME: GT numbering scheme may change depending on UAPI
+ * decisions.
+ */
+ gt->info.id = xe->info.gt_count++;
gt->info.type = XE_GT_TYPE_MAIN;
gt->info.__engine_mask = graphics_desc->hw_engine_mask;
if (MEDIA_VER(xe) < 13 && media_desc)