[Intel-xe] [PATCH 09/12] drm/xe: Introduce xe_tile_init_early and use at earlier point in probe

Matthew Brost matthew.brost at intel.com
Wed Nov 8 10:25:28 UTC 2023


On Wed, Nov 08, 2023 at 01:33:41AM +0100, Michał Winiarski wrote:
> It also merges the GT (which is part of tile) initalization happening
> at xe_info_init with allocating other per-tile data structures into a
> common helper function.
> 
> Signed-off-by: Michał Winiarski <michal.winiarski at intel.com>

Reviewed-by: Matthew Brost <matthew.brost at intel.com>

> ---
>  drivers/gpu/drm/xe/xe_device.c |  6 ------
>  drivers/gpu/drm/xe/xe_pci.c    | 10 +++++-----
>  drivers/gpu/drm/xe/xe_tile.c   | 19 +++++++++++++++++++
>  drivers/gpu/drm/xe/xe_tile.h   |  1 +
>  4 files changed, 25 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index 53be4f0424c21..696f997bd2c93 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -382,12 +382,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 2aa74eab08232..87c45c6e08aec 100644
> --- a/drivers/gpu/drm/xe/xe_pci.c
> +++ b/drivers/gpu/drm/xe/xe_pci.c
> @@ -25,6 +25,7 @@
>  #include "xe_pci_types.h"
>  #include "xe_pm.h"
>  #include "xe_step.h"
> +#include "xe_tile.h"
>  
>  enum toggle_d3cold {
>  	D3COLD_DISABLE,
> @@ -611,12 +612,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 131752a57f652..ea0cc84a0ab79 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"
> @@ -71,6 +72,24 @@
>   *  - MOCS and PAT programming
>   */
>  
> +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;
> +}
> +
>  /**
>   * xe_tile_alloc - Perform per-tile memory allocation
>   * @tile: Tile to perform allocations for
> diff --git a/drivers/gpu/drm/xe/xe_tile.h b/drivers/gpu/drm/xe/xe_tile.h
> index 782c47f8bd450..f35d943eed54c 100644
> --- a/drivers/gpu/drm/xe/xe_tile.h
> +++ b/drivers/gpu/drm/xe/xe_tile.h
> @@ -10,6 +10,7 @@
>  
>  struct xe_tile;
>  
> +int xe_tile_init_early(struct xe_tile *tile, struct xe_device *xe, u8 id);
>  int xe_tile_alloc(struct xe_tile *tile);
>  int xe_tile_init_noalloc(struct xe_tile *tile);
>  
> -- 
> 2.42.0
> 


More information about the Intel-xe mailing list