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

drm/xe: Introduce xe_tile_init_early and use at earlier point in probe

It also merges the GT (which is part of tile) initialization happening
at xe_info_init with allocating other per-tile data structures into a
common helper function.

Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

authored by

Michał Winiarski and committed by
Rodrigo Vivi
7e4ce451 4f5ee007

+37 -13
-6
drivers/gpu/drm/xe/xe_device.c
··· 393 393 if (err) 394 394 return err; 395 395 396 - for_each_tile(tile, xe, id) { 397 - err = xe_tile_alloc(tile); 398 - if (err) 399 - return err; 400 - } 401 - 402 396 err = xe_mmio_init(xe); 403 397 if (err) 404 398 return err;
+5 -5
drivers/gpu/drm/xe/xe_pci.c
··· 26 26 #include "xe_pm.h" 27 27 #include "xe_sriov.h" 28 28 #include "xe_step.h" 29 + #include "xe_tile.h" 29 30 30 31 enum toggle_d3cold { 31 32 D3COLD_DISABLE, ··· 624 623 xe->info.tile_count = 1 + graphics_desc->max_remote_tiles; 625 624 626 625 for_each_tile(tile, xe, id) { 627 - tile->xe = xe; 628 - tile->id = id; 626 + int err; 629 627 630 - tile->primary_gt = xe_gt_alloc(tile); 631 - if (IS_ERR(tile->primary_gt)) 632 - return PTR_ERR(tile->primary_gt); 628 + err = xe_tile_init_early(tile, xe, id); 629 + if (err) 630 + return err; 633 631 634 632 gt = tile->primary_gt; 635 633 gt->info.id = xe->info.gt_count++;
+31 -1
drivers/gpu/drm/xe/xe_tile.c
··· 7 7 8 8 #include "xe_device.h" 9 9 #include "xe_ggtt.h" 10 + #include "xe_gt.h" 10 11 #include "xe_migrate.h" 11 12 #include "xe_sa.h" 12 13 #include "xe_tile.h" ··· 81 80 * 82 81 * Returns -ENOMEM if allocations fail, otherwise 0. 83 82 */ 84 - int xe_tile_alloc(struct xe_tile *tile) 83 + static int xe_tile_alloc(struct xe_tile *tile) 85 84 { 86 85 struct drm_device *drm = &tile_to_xe(tile)->drm; 87 86 ··· 94 93 tile->mem.vram_mgr = drmm_kzalloc(drm, sizeof(*tile->mem.vram_mgr), GFP_KERNEL); 95 94 if (!tile->mem.vram_mgr) 96 95 return -ENOMEM; 96 + 97 + return 0; 98 + } 99 + 100 + /** 101 + * xe_tile_init_early - Initialize the tile and primary GT 102 + * @tile: Tile to initialize 103 + * @xe: Parent Xe device 104 + * @id: Tile ID 105 + * 106 + * Initializes per-tile resources that don't require any interactions with the 107 + * hardware or any knowledge about the Graphics/Media IP version. 108 + * 109 + * Returns: 0 on success, negative error code on error. 110 + */ 111 + int xe_tile_init_early(struct xe_tile *tile, struct xe_device *xe, u8 id) 112 + { 113 + int err; 114 + 115 + tile->xe = xe; 116 + tile->id = id; 117 + 118 + err = xe_tile_alloc(tile); 119 + if (err) 120 + return err; 121 + 122 + tile->primary_gt = xe_gt_alloc(tile); 123 + if (IS_ERR(tile->primary_gt)) 124 + return PTR_ERR(tile->primary_gt); 97 125 98 126 return 0; 99 127 }
+1 -1
drivers/gpu/drm/xe/xe_tile.h
··· 10 10 11 11 struct xe_tile; 12 12 13 - int xe_tile_alloc(struct xe_tile *tile); 13 + int xe_tile_init_early(struct xe_tile *tile, struct xe_device *xe, u8 id); 14 14 int xe_tile_init_noalloc(struct xe_tile *tile); 15 15 16 16 void xe_tile_migrate_wait(struct xe_tile *tile);