]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe: Move primary GT allocation from xe_tile_init_early to xe_tile_init
authorMatt Roper <matthew.d.roper@intel.com>
Mon, 13 Oct 2025 20:09:51 +0000 (13:09 -0700)
committerMatt Roper <matthew.d.roper@intel.com>
Tue, 14 Oct 2025 14:44:57 +0000 (07:44 -0700)
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>
drivers/gpu/drm/xe/xe_pci.c
drivers/gpu/drm/xe/xe_tile.c

index f54b7963b9baa4ba965bf57e55b3f905cd86a832..0fea2ddb3c99971d02ae63374cde48ceaed5b3b9 100644 (file)
@@ -774,6 +774,10 @@ static int xe_info_init(struct xe_device *xe,
        for_each_tile(tile, xe, id) {
                int err;
 
+               tile->primary_gt = xe_gt_alloc(tile);
+               if (IS_ERR(tile->primary_gt))
+                       return PTR_ERR(tile->primary_gt);
+
                gt = tile->primary_gt;
                gt->info.type = XE_GT_TYPE_MAIN;
                gt->info.id = tile->id * xe->info.max_gt_per_tile;
index 8fd6ee990d14fb27ffd62e2cba8b084fbc570d8f..4f4f9a5c43af65a3a515005ae9731aab237682e4 100644 (file)
@@ -157,10 +157,6 @@ int xe_tile_init_early(struct xe_tile *tile, struct xe_device *xe, u8 id)
        if (err)
                return err;
 
-       tile->primary_gt = xe_gt_alloc(tile);
-       if (IS_ERR(tile->primary_gt))
-               return PTR_ERR(tile->primary_gt);
-
        xe_pcode_init(tile);
 
        return 0;