Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xe: Move primary GT allocation from xe_tile_init_early to xe_tile_init

During the early days of the Xe driver, there were cases where we
accessed some fields in the primary GT's xe_gt structure before the GT
itself was formally initialized; this required that the structure itself
be allocated during xe_tile_init_early(). A lot of refactoring of the
device probe has happened since that time and there's no longer a need
to allocate the primary GT early. Move the allocation into
xe_info_init() where GT initialization happens and where we're doing the
allocation of the media GT.

v2:
- Only make this change after a separate patch to perform VF GMD_ID
lookup with a dummy GT instead of xe_root_mmio_gt().

Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://lore.kernel.org/r/20251013200944.2499947-33-matthew.d.roper@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>

+4 -4
+4
drivers/gpu/drm/xe/xe_pci.c
··· 774 774 for_each_tile(tile, xe, id) { 775 775 int err; 776 776 777 + tile->primary_gt = xe_gt_alloc(tile); 778 + if (IS_ERR(tile->primary_gt)) 779 + return PTR_ERR(tile->primary_gt); 780 + 777 781 gt = tile->primary_gt; 778 782 gt->info.type = XE_GT_TYPE_MAIN; 779 783 gt->info.id = tile->id * xe->info.max_gt_per_tile;
-4
drivers/gpu/drm/xe/xe_tile.c
··· 157 157 if (err) 158 158 return err; 159 159 160 - tile->primary_gt = xe_gt_alloc(tile); 161 - if (IS_ERR(tile->primary_gt)) 162 - return PTR_ERR(tile->primary_gt); 163 - 164 160 xe_pcode_init(tile); 165 161 166 162 return 0;