@@ -62,7 +62,13 @@ void intel_gt_common_init_early(struct intel_gt *gt)
/* Preliminary initialization of Tile 0 */
int intel_root_gt_init_early(struct drm_i915_private *i915)
{
- struct intel_gt *gt = to_gt(i915);
+ struct intel_gt *gt;
+
+ gt = drmm_kzalloc(&i915->drm, sizeof(*gt), GFP_KERNEL);
+ if (!gt)
+ return -ENOMEM;
+
+ i915->gt0 = gt;
gt->i915 = i915;
gt->uncore = &i915->uncore;
@@ -318,10 +318,10 @@ struct drm_i915_private {
struct i915_hwmon *hwmon;
/* Abstract the submission mechanism (legacy ringbuffer or execlists) away */
- struct intel_gt gt0;
+ struct intel_gt *gt0;
/*
- * i915->gt[0] == &i915->gt0
+ * i915->gt[0] == i915->gt0
*/
struct intel_gt *gt[I915_MAX_GT];
@@ -382,9 +382,9 @@ static inline struct drm_i915_private *pdev_to_i915(struct pci_dev *pdev)
return pci_get_drvdata(pdev);
}
-static inline struct intel_gt *to_gt(struct drm_i915_private *i915)
+static inline struct intel_gt *to_gt(const struct drm_i915_private *i915)
{
- return &i915->gt0;
+ return i915->gt0;
}
/* Simple iterator over all initialised engines */
Convert i915->gt0 to a pointer, and allocate it dynamically. Signed-off-by: Jani Nikula <jani.nikula@intel.com> --- drivers/gpu/drm/i915/gt/intel_gt.c | 8 +++++++- drivers/gpu/drm/i915/i915_drv.h | 8 ++++---- 2 files changed, 11 insertions(+), 5 deletions(-)