diff options
author | Michał Winiarski <michal.winiarski@intel.com> | 2023-12-05 02:32:57 +0100 |
---|---|---|
committer | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2023-12-21 11:45:10 -0500 |
commit | 7e4ce4518b906a960122f29e8f3426ca95ebee0a (patch) | |
tree | e1f676a043743f9f4a3e6d7679eb038207fad576 /drivers | |
parent | 4f5ee007f62a1825cec8140b14b28ef532f570f8 (diff) | |
download | linux-stable-7e4ce4518b906a960122f29e8f3426ca95ebee0a.tar.gz linux-stable-7e4ce4518b906a960122f29e8f3426ca95ebee0a.tar.bz2 linux-stable-7e4ce4518b906a960122f29e8f3426ca95ebee0a.zip |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/xe/xe_device.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/xe/xe_pci.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/xe/xe_tile.c | 32 | ||||
-rw-r--r-- | drivers/gpu/drm/xe/xe_tile.h | 2 |
4 files changed, 37 insertions, 13 deletions
diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c index 785bf2e610b7..5e1f73c8c77a 100644 --- a/drivers/gpu/drm/xe/xe_device.c +++ b/drivers/gpu/drm/xe/xe_device.c @@ -393,12 +393,6 @@ int xe_device_probe(struct xe_device *xe) if (err) return err; - for_each_tile(tile, xe, id) { - err = xe_tile_alloc(tile); - if (err) - return err; - } - err = xe_mmio_init(xe); if (err) return err; diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c index 9e35ebfb3341..87257716b93e 100644 --- a/drivers/gpu/drm/xe/xe_pci.c +++ b/drivers/gpu/drm/xe/xe_pci.c @@ -26,6 +26,7 @@ #include "xe_pm.h" #include "xe_sriov.h" #include "xe_step.h" +#include "xe_tile.h" enum toggle_d3cold { D3COLD_DISABLE, @@ -623,12 +624,11 @@ static int xe_info_init(struct xe_device *xe, xe->info.tile_count = 1 + graphics_desc->max_remote_tiles; for_each_tile(tile, xe, id) { - tile->xe = xe; - tile->id = id; + int err; - tile->primary_gt = xe_gt_alloc(tile); - if (IS_ERR(tile->primary_gt)) - return PTR_ERR(tile->primary_gt); + err = xe_tile_init_early(tile, xe, id); + if (err) + return err; gt = tile->primary_gt; gt->info.id = xe->info.gt_count++; diff --git a/drivers/gpu/drm/xe/xe_tile.c b/drivers/gpu/drm/xe/xe_tile.c index 131752a57f65..c74a4f840d84 100644 --- a/drivers/gpu/drm/xe/xe_tile.c +++ b/drivers/gpu/drm/xe/xe_tile.c @@ -7,6 +7,7 @@ #include "xe_device.h" #include "xe_ggtt.h" +#include "xe_gt.h" #include "xe_migrate.h" #include "xe_sa.h" #include "xe_tile.h" @@ -80,7 +81,7 @@ * * Returns -ENOMEM if allocations fail, otherwise 0. */ -int xe_tile_alloc(struct xe_tile *tile) +static int xe_tile_alloc(struct xe_tile *tile) { struct drm_device *drm = &tile_to_xe(tile)->drm; @@ -97,6 +98,35 @@ int xe_tile_alloc(struct xe_tile *tile) return 0; } +/** + * xe_tile_init_early - Initialize the tile and primary GT + * @tile: Tile to initialize + * @xe: Parent Xe device + * @id: Tile ID + * + * Initializes per-tile resources that don't require any interactions with the + * hardware or any knowledge about the Graphics/Media IP version. + * + * Returns: 0 on success, negative error code on error. + */ +int xe_tile_init_early(struct xe_tile *tile, struct xe_device *xe, u8 id) +{ + int err; + + tile->xe = xe; + tile->id = id; + + err = xe_tile_alloc(tile); + if (err) + return err; + + tile->primary_gt = xe_gt_alloc(tile); + if (IS_ERR(tile->primary_gt)) + return PTR_ERR(tile->primary_gt); + + return 0; +} + static int tile_ttm_mgr_init(struct xe_tile *tile) { struct xe_device *xe = tile_to_xe(tile); diff --git a/drivers/gpu/drm/xe/xe_tile.h b/drivers/gpu/drm/xe/xe_tile.h index 782c47f8bd45..1c9e42ade6b0 100644 --- a/drivers/gpu/drm/xe/xe_tile.h +++ b/drivers/gpu/drm/xe/xe_tile.h @@ -10,7 +10,7 @@ struct xe_tile; -int xe_tile_alloc(struct xe_tile *tile); +int xe_tile_init_early(struct xe_tile *tile, struct xe_device *xe, u8 id); int xe_tile_init_noalloc(struct xe_tile *tile); void xe_tile_migrate_wait(struct xe_tile *tile); |