summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/xe/xe_gt_types.h
diff options
context:
space:
mode:
authorMatt Roper <matthew.d.roper@intel.com>2023-06-02 00:52:16 +0300
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-20 02:34:11 +0300
commitf79ee3013ad57021f4557cd3aa964a14b5c94bd4 (patch)
tree63bdc71803b05d47c8bed874e41ae0f67dc25bcd /drivers/gpu/drm/xe/xe_gt_types.h
parenta5edc7cdb3875115d1798f4d2057569cf257e7d2 (diff)
downloadlinux-f79ee3013ad57021f4557cd3aa964a14b5c94bd4.tar.xz
drm/xe: Add backpointer from gt to tile
Rather than a backpointer to the xe_device, a GT should have a backpointer to its tile (which can then be used to lookup the device if necessary). The gt_to_xe() helper macro (which moves from xe_gt.h to xe_gt_types.h) can and should still be used to jump directly from an xe_gt to xe_device. v2: - Fix kunit test build - Move a couple changes to the previous patch. (Lucas) Reviewed-by: Matt Atwood <matthew.s.atwood@intel.com> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> Link: https://lore.kernel.org/r/20230601215244.678611-4-matthew.d.roper@intel.com Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/xe/xe_gt_types.h')
-rw-r--r--drivers/gpu/drm/xe/xe_gt_types.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/gpu/drm/xe/xe_gt_types.h b/drivers/gpu/drm/xe/xe_gt_types.h
index 456e3e447a2e..11605a99ad66 100644
--- a/drivers/gpu/drm/xe/xe_gt_types.h
+++ b/drivers/gpu/drm/xe/xe_gt_types.h
@@ -76,6 +76,16 @@ enum xe_steering_type {
NUM_STEERING_TYPES
};
+#define gt_to_tile(gt__) \
+ _Generic(gt__, \
+ const struct xe_gt *: (const struct xe_tile *)((gt__)->tile), \
+ struct xe_gt *: (gt__)->tile)
+
+#define gt_to_xe(gt__) \
+ _Generic(gt__, \
+ const struct xe_gt *: (const struct xe_device *)(gt_to_tile(gt__)->xe), \
+ struct xe_gt *: gt_to_tile(gt__)->xe)
+
/**
* struct xe_gt - A "Graphics Technology" unit of the GPU
*
@@ -90,8 +100,8 @@ enum xe_steering_type {
* separate GTs within a tile.
*/
struct xe_gt {
- /** @xe: backpointer to XE device */
- struct xe_device *xe;
+ /** @tile: Backpointer to GT's tile */
+ struct xe_tile *tile;
/** @info: GT info */
struct {