Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Maarten Lankhorst <dev@lankhorst.se>,
	Matt Roper <matthew.d.roper@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 09/11] drm/xe: Make it possible to read instance0 MCR registers after xe_gt_mcr_init_early
Date: Thu, 12 Dec 2024 09:35:37 -0500	[thread overview]
Message-ID: <Z1r0uUIBK4sNpC0j@intel.com> (raw)
In-Reply-To: <20241210083111.230484-10-dev@lankhorst.se>

On Tue, Dec 10, 2024 at 09:31:09AM +0100, Maarten Lankhorst wrote:
> After mcr_init_early, we need to be able to do VRAM and CCS probing
> without hwconfig probe. Fortunately the relevant registers are all
> instance 0, which fortunately means no dependencies on further initialisation
> is required.
> 

Cc: Matt Roper <matthew.d.roper@intel.com>

> Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
> ---
>  drivers/gpu/drm/xe/xe_gt_mcr.c   | 47 ++++++++++++++++++--------------
>  drivers/gpu/drm/xe/xe_gt_types.h |  2 ++
>  2 files changed, 29 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_gt_mcr.c b/drivers/gpu/drm/xe/xe_gt_mcr.c
> index 5013d674e17da..4b23c96290046 100644
> --- a/drivers/gpu/drm/xe/xe_gt_mcr.c
> +++ b/drivers/gpu/drm/xe/xe_gt_mcr.c
> @@ -413,12 +413,6 @@ static void init_steering_sqidi_psmi(struct xe_gt *gt)
>  	gt->steering[SQIDI_PSMI].instance_target = select & 0x1;
>  }
>  
> -static void init_steering_inst0(struct xe_gt *gt)
> -{
> -	gt->steering[INSTANCE0].group_target = 0;	/* unused */
> -	gt->steering[INSTANCE0].instance_target = 0;	/* unused */
> -}
> -
>  static const struct {
>  	const char *name;
>  	void (*init)(struct xe_gt *gt);
> @@ -429,7 +423,7 @@ static const struct {
>  	[DSS] =		{ "DSS",	init_steering_dss },
>  	[OADDRM] =	{ "OADDRM / GPMXMT", init_steering_oaddrm },
>  	[SQIDI_PSMI] =  { "SQIDI_PSMI", init_steering_sqidi_psmi },
> -	[INSTANCE0] =	{ "INSTANCE 0",	init_steering_inst0 },
> +	[INSTANCE0] =	{ "INSTANCE 0",	NULL },
>  	[IMPLICIT_STEERING] = { "IMPLICIT", NULL },
>  };
>  
> @@ -439,25 +433,17 @@ static const struct {
>   *
>   * Perform early software only initialization of the MCR lock to allow
>   * the synchronization on accessing the STEER_SEMAPHORE register and
> - * use the xe_gt_mcr_multicast_write() function.
> + * use the xe_gt_mcr_multicast_write() function, plus the minimum
> + * safe MCR registers required for VRAM/CCS probing.
>   */
>  void xe_gt_mcr_init_early(struct xe_gt *gt)
>  {
> +	struct xe_device *xe = gt_to_xe(gt);
> +
>  	BUILD_BUG_ON(IMPLICIT_STEERING + 1 != NUM_STEERING_TYPES);
>  	BUILD_BUG_ON(ARRAY_SIZE(xe_steering_types) != NUM_STEERING_TYPES);
>  
>  	spin_lock_init(&gt->mcr_lock);
> -}
> -
> -/**
> - * xe_gt_mcr_init - Normal initialization of the MCR support
> - * @gt: GT structure
> - *
> - * Perform normal initialization of the MCR for all usages.
> - */
> -void xe_gt_mcr_init(struct xe_gt *gt)
> -{
> -	struct xe_device *xe = gt_to_xe(gt);
>  
>  	if (IS_SRIOV_VF(xe))
>  		return;
> @@ -498,10 +484,27 @@ void xe_gt_mcr_init(struct xe_gt *gt)
>  		}
>  	}
>  
> +	/* Mark instance 0 as initialised, we need this early for VRAM and CCS probe. */
> +	gt->steering[INSTANCE0].initialised = true;
> +}
> +
> +/**
> + * xe_gt_mcr_init - Normal initialization of the MCR support
> + * @gt: GT structure
> + *
> + * Perform normal initialization of the MCR for all usages.
> + */
> +void xe_gt_mcr_init(struct xe_gt *gt)
> +{
> +	if (IS_SRIOV_VF(gt_to_xe(gt)))
> +		return;
> +
>  	/* Select non-terminated steering target for each type */
> -	for (int i = 0; i < NUM_STEERING_TYPES; i++)
> +	for (int i = 0; i < NUM_STEERING_TYPES; i++) {
> +		gt->steering[i].initialised = true;
>  		if (gt->steering[i].ranges && xe_steering_types[i].init)
>  			xe_steering_types[i].init(gt);
> +	}
>  }
>  
>  /**
> @@ -563,6 +566,10 @@ static bool xe_gt_mcr_get_nonterminated_steering(struct xe_gt *gt,
>  
>  		for (int i = 0; gt->steering[type].ranges[i].end > 0; i++) {
>  			if (xe_mmio_in_range(&gt->mmio, &gt->steering[type].ranges[i], reg)) {
> +				drm_WARN(&gt_to_xe(gt)->drm, !gt->steering[type].initialised,
> +					 "Uninitialised usage of MCR register %s/%#x\n",
> +					 xe_steering_types[type].name, reg.addr);
> +
>  				*group = gt->steering[type].group_target;
>  				*instance = gt->steering[type].instance_target;
>  				return true;
> diff --git a/drivers/gpu/drm/xe/xe_gt_types.h b/drivers/gpu/drm/xe/xe_gt_types.h
> index 6e66bf0e8b3f7..07c332ff7aa80 100644
> --- a/drivers/gpu/drm/xe/xe_gt_types.h
> +++ b/drivers/gpu/drm/xe/xe_gt_types.h
> @@ -375,6 +375,8 @@ struct xe_gt {
>  		u16 group_target;
>  		/** @steering.instance_target: instance to steer accesses to */
>  		u16 instance_target;
> +		/** @steering.initialised: Whether this steering range is initialised */
> +		bool initialised;
>  	} steering[NUM_STEERING_TYPES];
>  
>  	/**
> -- 
> 2.45.2
> 

  reply	other threads:[~2024-12-12 14:36 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-10  8:31 [PATCH 00/11] GuC changes for flicker-free boot Maarten Lankhorst
2024-12-10  8:31 ` [PATCH 01/11] drm/xe/display: Add intel_plane_initial_vblank_wait Maarten Lankhorst
2024-12-12 14:33   ` Rodrigo Vivi
2024-12-10  8:31 ` [PATCH 02/11] drm/xe: Remove double pageflip Maarten Lankhorst
2024-12-10  8:31 ` [PATCH 03/11] drm/xe: Move suballocator init to after display init Maarten Lankhorst
2024-12-10  8:31 ` [PATCH 04/11] drm/xe: Defer irq init until after xe_display_init_noaccel Maarten Lankhorst
2024-12-10 18:06   ` Levi, Ilia
2024-12-10  8:31 ` [PATCH 05/11] drm/xe/display: Use a single early init call for display Maarten Lankhorst
2024-12-10  8:31 ` [PATCH 06/11] drm/xe: Defer memirq init until needed Maarten Lankhorst
2024-12-10 14:30   ` Lucas De Marchi
2024-12-10 18:02     ` Levi, Ilia
2024-12-10  8:31 ` [PATCH 07/11] drm/xe/sriov: Move VF bootstrap and query_config to vf_guc_init Maarten Lankhorst
2024-12-12 14:34   ` Rodrigo Vivi
2024-12-10  8:31 ` [PATCH 08/11] drm/xe: Simplify GuC early initialisation Maarten Lankhorst
2024-12-10 15:18   ` Lucas De Marchi
2024-12-10  8:31 ` [PATCH 09/11] drm/xe: Make it possible to read instance0 MCR registers after xe_gt_mcr_init_early Maarten Lankhorst
2024-12-12 14:35   ` Rodrigo Vivi [this message]
2024-12-12 22:12     ` Matt Roper
2024-12-10  8:31 ` [PATCH 10/11] drm/xe: Split init of xe_gt_init_hwconfig to xe_gt_init and *_early Maarten Lankhorst
2024-12-10 15:25   ` Lucas De Marchi
2024-12-11 18:52     ` Maarten Lankhorst
2024-12-13  0:36       ` Lucas De Marchi
2024-12-10  8:31 ` [PATCH 11/11] drm/xe: Do not attempt to bootstrap VF in execlists mode Maarten Lankhorst
2024-12-10 15:27   ` Lucas De Marchi
2024-12-10  8:37 ` ✓ CI.Patch_applied: success for GuC changes for flicker-free boot Patchwork
2024-12-10  8:38 ` ✗ CI.checkpatch: warning " Patchwork
2024-12-10  8:39 ` ✓ CI.KUnit: success " Patchwork
2024-12-10  8:57 ` ✓ CI.Build: " Patchwork
2024-12-10  8:59 ` ✓ CI.Hooks: " Patchwork
2024-12-10  9:01 ` ✓ CI.checksparse: " Patchwork
2024-12-10  9:27 ` ✓ Xe.CI.BAT: " Patchwork
2024-12-10 10:20 ` ✗ Xe.CI.Full: failure " Patchwork
2025-01-21 12:10 ` [PATCH 00/11] " Jani Nikula
2025-01-21 12:53   ` Maarten Lankhorst

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z1r0uUIBK4sNpC0j@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=dev@lankhorst.se \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.d.roper@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox