[Intel-xe] [PATCH 05/12] drm/xe/mmio: Move memory training check to probe vram

Matthew Brost matthew.brost at intel.com
Wed Nov 8 09:38:24 UTC 2023


On Wed, Nov 08, 2023 at 01:33:37AM +0100, Michał Winiarski wrote:
> The check doesn't have anything to do with initial MMIO setup. Move it
> to the place where it belongs.
> 
> Signed-off-by: Michał Winiarski <michal.winiarski at intel.com>

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

> ---
>  drivers/gpu/drm/xe/xe_mmio.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_mmio.c b/drivers/gpu/drm/xe/xe_mmio.c
> index 0da4f75c07bf6..f4cddf2dfa3a3 100644
> --- a/drivers/gpu/drm/xe/xe_mmio.c
> +++ b/drivers/gpu/drm/xe/xe_mmio.c
> @@ -254,6 +254,18 @@ int xe_mmio_probe_vram(struct xe_device *xe)
>  
>  	/* Get the size of the root tile's vram for later accessibility comparison */
>  	tile = xe_device_get_root_tile(xe);
> +
> +	/*
> +	 * The boot firmware initializes local memory and assesses its health.
> +	 * If memory training fails, the punit will have been instructed to
> +	 * keep the GT powered down; we won't be able to communicate with it
> +	 * and we should not continue with driver initialization.
> +	 */
> +	if (IS_DGFX(xe) && !(xe_mmio_read32(xe_root_mmio_gt(xe), GU_CNTL) & LMEM_INIT)) {
> +		drm_err(&xe->drm, "VRAM not initialized by firmware\n");
> +		return -ENODEV;
> +	}
> +
>  	err = xe_mmio_tile_vram_size(tile, &vram_size, &tile_size, &tile_offset);
>  	if (err)
>  		return err;
> @@ -384,7 +396,6 @@ static void mmio_fini(struct drm_device *drm, void *arg)
>  int xe_mmio_init(struct xe_device *xe)
>  {
>  	struct xe_tile *root_tile = xe_device_get_root_tile(xe);
> -	struct xe_gt *gt = xe_root_mmio_gt(xe);
>  	const int mmio_bar = 0;
>  	int err;
>  
> @@ -409,17 +420,6 @@ int xe_mmio_init(struct xe_device *xe)
>  	root_tile->mmio.size = xe->mmio.size;
>  	root_tile->mmio.regs = xe->mmio.regs;
>  
> -	/*
> -	 * The boot firmware initializes local memory and assesses its health.
> -	 * If memory training fails, the punit will have been instructed to
> -	 * keep the GT powered down; we won't be able to communicate with it
> -	 * and we should not continue with driver initialization.
> -	 */
> -	if (IS_DGFX(xe) && !(xe_mmio_read32(gt, GU_CNTL) & LMEM_INIT)) {
> -		drm_err(&xe->drm, "VRAM not initialized by firmware\n");
> -		return -ENODEV;
> -	}
> -
>  	err = xe_set_dma_info(xe);
>  	if (err)
>  		return err;
> -- 
> 2.42.0
> 


More information about the Intel-xe mailing list