mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 00:22:00 +02:00
drm/xe: Break GT setup out of xe_info_init()
xe_info_init() is getting a bit long and hard to follow. Break the allocation and basic initialization of the xe_gt structures out to their own functions. v2: - Rename new functions from init_* to alloc_*. (Gustavo) - Move early NULL return of media GT before allocation. (Gustavo) Cc: Gustavo Sousa <gustavo.sousa@intel.com> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com> Link: https://lore.kernel.org/r/20251013200944.2499947-46-matthew.d.roper@intel.com Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
This commit is contained in:
parent
ad0084f3f8
commit
6675c9e209
|
|
@ -689,6 +689,53 @@ static void xe_info_probe_tile_count(struct xe_device *xe)
|
|||
}
|
||||
}
|
||||
|
||||
static struct xe_gt *alloc_primary_gt(struct xe_tile *tile,
|
||||
const struct xe_graphics_desc *graphics_desc,
|
||||
const struct xe_media_desc *media_desc)
|
||||
{
|
||||
struct xe_device *xe = tile_to_xe(tile);
|
||||
struct xe_gt *gt;
|
||||
|
||||
gt = xe_gt_alloc(tile);
|
||||
if (IS_ERR(gt))
|
||||
return gt;
|
||||
|
||||
gt->info.type = XE_GT_TYPE_MAIN;
|
||||
gt->info.id = tile->id * xe->info.max_gt_per_tile;
|
||||
gt->info.has_indirect_ring_state = graphics_desc->has_indirect_ring_state;
|
||||
gt->info.engine_mask = graphics_desc->hw_engine_mask;
|
||||
|
||||
/*
|
||||
* Before media version 13, the media IP was part of the primary GT
|
||||
* so we need to add the media engines to the primary GT's engine list.
|
||||
*/
|
||||
if (MEDIA_VER(xe) < 13 && media_desc)
|
||||
gt->info.engine_mask |= media_desc->hw_engine_mask;
|
||||
|
||||
return gt;
|
||||
}
|
||||
|
||||
static struct xe_gt *alloc_media_gt(struct xe_tile *tile,
|
||||
const struct xe_media_desc *media_desc)
|
||||
{
|
||||
struct xe_device *xe = tile_to_xe(tile);
|
||||
struct xe_gt *gt;
|
||||
|
||||
if (MEDIA_VER(xe) < 13 || !media_desc)
|
||||
return NULL;
|
||||
|
||||
gt = xe_gt_alloc(tile);
|
||||
if (IS_ERR(gt))
|
||||
return gt;
|
||||
|
||||
gt->info.type = XE_GT_TYPE_MEDIA;
|
||||
gt->info.id = tile->id * xe->info.max_gt_per_tile + 1;
|
||||
gt->info.has_indirect_ring_state = media_desc->has_indirect_ring_state;
|
||||
gt->info.engine_mask = media_desc->hw_engine_mask;
|
||||
|
||||
return gt;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize device info content that does require knowledge about
|
||||
* graphics / media IP version.
|
||||
|
|
@ -771,48 +818,21 @@ static int xe_info_init(struct xe_device *xe,
|
|||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
* All platforms have at least one primary GT. Any platform with media
|
||||
* version 13 or higher has an additional dedicated media GT. And
|
||||
* depending on the graphics IP there may be additional "remote tiles."
|
||||
* All of these together determine the overall GT count.
|
||||
*/
|
||||
/* Allocate any GT and VRAM structures necessary for the platform. */
|
||||
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;
|
||||
gt->info.has_indirect_ring_state = graphics_desc->has_indirect_ring_state;
|
||||
gt->info.engine_mask = graphics_desc->hw_engine_mask;
|
||||
|
||||
err = xe_tile_alloc_vram(tile);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (MEDIA_VER(xe) < 13 && media_desc)
|
||||
gt->info.engine_mask |= media_desc->hw_engine_mask;
|
||||
tile->primary_gt = alloc_primary_gt(tile, graphics_desc, media_desc);
|
||||
if (IS_ERR(tile->primary_gt))
|
||||
return PTR_ERR(tile->primary_gt);
|
||||
|
||||
if (MEDIA_VER(xe) < 13 || !media_desc)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Allocate and setup media GT for platforms with standalone
|
||||
* media.
|
||||
*/
|
||||
tile->media_gt = xe_gt_alloc(tile);
|
||||
tile->media_gt = alloc_media_gt(tile, media_desc);
|
||||
if (IS_ERR(tile->media_gt))
|
||||
return PTR_ERR(tile->media_gt);
|
||||
|
||||
gt = tile->media_gt;
|
||||
gt->info.type = XE_GT_TYPE_MEDIA;
|
||||
gt->info.id = tile->id * xe->info.max_gt_per_tile + 1;
|
||||
gt->info.has_indirect_ring_state = media_desc->has_indirect_ring_state;
|
||||
gt->info.engine_mask = media_desc->hw_engine_mask;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user