All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michał Winiarski" <michal.winiarski@intel.com>
To: "Welty, Brian" <brian.welty@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>,
	Matt Roper <matthew.d.roper@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH v4 22/22] drm/xe: Initialize GuC earlier during probe
Date: Wed, 29 Nov 2023 23:20:27 +0100	[thread overview]
Message-ID: <ctavrro7oel2zx6kq34udtrtwbndtj5yfyfydkhurdfcumyxjx@qi4ml2yk3lwh> (raw)
In-Reply-To: <ed88148e-f38d-4e8a-8066-ae9ea9b983c3@intel.com>

On Wed, Nov 29, 2023 at 01:48:50PM -0800, Welty, Brian wrote:
> 
> On 11/28/2023 5:16 PM, Michał Winiarski wrote:
> > SR-IOV VF has limited access to MMIO registers. Fortunately, it is able
> > to access a curated subset that is needed to initialize the driver by
> > communicating with SR-IOV PF using GuC CT.
> > Initialize GuC earlier in order to keep the unified probe ordering
> > between VF and PF modes.
> > 
> > Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
> > ---
> > v3 -> v4:
> > - Introduce xe_gt_init_hwconfig (Matt Brost)
> > - Init PAT before loading GuC
> > 
> >   drivers/gpu/drm/xe/xe_device.c |  6 ++++
> >   drivers/gpu/drm/xe/xe_gt.c     | 51 ++++++++++++++++++++++++----------
> >   drivers/gpu/drm/xe/xe_gt.h     |  1 +
> >   drivers/gpu/drm/xe/xe_uc.c     | 11 ++++++--
> >   4 files changed, 52 insertions(+), 17 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> > index 65e9aa5e6c31e..a236c36cdae3c 100644
> > --- a/drivers/gpu/drm/xe/xe_device.c
> > +++ b/drivers/gpu/drm/xe/xe_device.c
> > @@ -425,6 +425,12 @@ int xe_device_probe(struct xe_device *xe)
> >   			return err;
> >   	}
> > +	for_each_gt(gt, xe, id) {
> > +		err = xe_gt_init_hwconfig(gt);
> > +		if (err)
> > +			return err;
> > +	}
> > +
> >   	err = drmm_add_action_or_reset(&xe->drm, xe_driver_flr_fini, xe);
> >   	if (err)
> >   		return err;
> > diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
> > index 964e76f931a28..d2766c2c58f0f 100644
> > --- a/drivers/gpu/drm/xe/xe_gt.c
> > +++ b/drivers/gpu/drm/xe/xe_gt.c
> > @@ -297,7 +297,6 @@ int xe_gt_init_early(struct xe_gt *gt)
> >   		return err;
> >   	xe_gt_topology_init(gt);
> > -	xe_gt_mcr_init(gt);
> >   	err = xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
> >   	if (err)
> > @@ -336,22 +335,12 @@ static int gt_fw_domain_init(struct xe_gt *gt)
> >   	if (err)
> >   		goto err_hw_fence_irq;
> > -	xe_pat_init(gt);
> > -
> >   	if (!xe_gt_is_media_type(gt)) {
> >   		err = xe_ggtt_init(gt_to_tile(gt)->mem.ggtt);
> >   		if (err)
> >   			goto err_force_wake;
> >   	}
> > -	err = xe_uc_init(&gt->uc);
> > -	if (err)
> > -		goto err_force_wake;
> > -
> > -	err = xe_uc_init_hwconfig(&gt->uc);
> > -	if (err)
> > -		goto err_force_wake;
> > -
> >   	xe_gt_idle_sysfs_init(&gt->gtidle);
> >   	/* XXX: Fake that we pull the engine mask from hwconfig blob */
> >       gt->info.engine_mask = gt->info.__engine_mask;
> 
> 
> I've been wondering about the XXX above.  I added the line above that comes
> next.
> Should that move into xe_gt_init_hwconfig() as well?
> And replace it with code to read it from hwconfig blob?
> 
> I'm asking because I was looking at a change that would like to make use of
> a valid engine_mask earlier than xe_gt_init().

Yeah - makes sense, I'll move it to xe_gt_init_hwconfig().
Is that point in the codebase early enough for the change that you're
referring to?

-Michał

> 
> -Brian
> 
> 
> 
> > @@ -415,10 +404,6 @@ static int all_fw_domain_init(struct xe_gt *gt)
> >   	if (err)
> >   		goto err_force_wake;
> > -	err = xe_uc_init_post_hwconfig(&gt->uc);
> > -	if (err)
> > -		goto err_force_wake;
> > -
> >   	if (!xe_gt_is_media_type(gt)) {
> >   		/*
> >   		 * USM has its only SA pool to non-block behind user operations
> > @@ -442,6 +427,10 @@ static int all_fw_domain_init(struct xe_gt *gt)
> >   		}
> >   	}
> > +	err = xe_uc_init_post_hwconfig(&gt->uc);
> > +	if (err)
> > +		goto err_force_wake;
> > +
> >   	err = xe_uc_init_hw(&gt->uc);
> >   	if (err)
> >   		goto err_force_wake;
> > @@ -462,6 +451,38 @@ static int all_fw_domain_init(struct xe_gt *gt)
> >   	return err;
> >   }
> > +/*
> > + * Initialize enough GT to be able to load GuC in order to obtain hwconfig and enable CTB
> > + * communication.
> > + */
> > +int xe_gt_init_hwconfig(struct xe_gt *gt)
> > +{
> > +	int err;
> > +
> > +	xe_device_mem_access_get(gt_to_xe(gt));
> > +	err = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
> > +	if (err)
> > +		goto out;
> > +
> > +	xe_gt_mcr_init(gt);
> > +	xe_pat_init(gt);
> > +
> > +	err = xe_uc_init(&gt->uc);
> > +	if (err)
> > +		goto out_fw;
> > +
> > +	err = xe_uc_init_hwconfig(&gt->uc);
> > +	if (err)
> > +		goto out_fw;
> > +
> > +out_fw:
> > +	xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
> > +out:
> > +	xe_device_mem_access_put(gt_to_xe(gt));
> > +
> > +	return err;
> > +}
> > +
> >   int xe_gt_init(struct xe_gt *gt)
> >   {
> >   	int err;
> > diff --git a/drivers/gpu/drm/xe/xe_gt.h b/drivers/gpu/drm/xe/xe_gt.h
> > index caded203a8a03..e9d6aeceb56af 100644
> > --- a/drivers/gpu/drm/xe/xe_gt.h
> > +++ b/drivers/gpu/drm/xe/xe_gt.h
> > @@ -31,6 +31,7 @@ static inline bool xe_fault_inject_gt_reset(void)
> >   #endif
> >   struct xe_gt *xe_gt_alloc(struct xe_tile *tile);
> > +int xe_gt_init_hwconfig(struct xe_gt *gt);
> >   int xe_gt_init_early(struct xe_gt *gt);
> >   int xe_gt_init(struct xe_gt *gt);
> >   int xe_gt_record_default_lrcs(struct xe_gt *gt);
> > diff --git a/drivers/gpu/drm/xe/xe_uc.c b/drivers/gpu/drm/xe/xe_uc.c
> > index 13e76e6805ca1..123baafc9ec38 100644
> > --- a/drivers/gpu/drm/xe/xe_uc.c
> > +++ b/drivers/gpu/drm/xe/xe_uc.c
> > @@ -29,13 +29,15 @@ uc_to_xe(struct xe_uc *uc)
> >   /* Should be called once at driver load only */
> >   int xe_uc_init(struct xe_uc *uc)
> >   {
> > +	struct xe_device *xe = uc_to_xe(uc);
> >   	int ret;
> > +	xe_device_mem_access_get(xe);
> > +
> >   	/*
> >   	 * We call the GuC/HuC init functions even if GuC submission is off to
> >   	 * correctly move our tracking of the FW state to "disabled".
> >   	 */
> > -
> >   	ret = xe_guc_init(&uc->guc);
> >   	if (ret)
> >   		goto err;
> > @@ -45,7 +47,7 @@ int xe_uc_init(struct xe_uc *uc)
> >   		goto err;
> >   	if (!xe_device_uc_enabled(uc_to_xe(uc)))
> > -		return 0;
> > +		goto out;
> >   	ret = xe_wopcm_init(&uc->wopcm);
> >   	if (ret)
> > @@ -55,9 +57,14 @@ int xe_uc_init(struct xe_uc *uc)
> >   	if (ret)
> >   		goto err;
> > +out:
> > +	xe_device_mem_access_put(xe);
> > +
> >   	return 0;
> >   err:
> > +	xe_device_mem_access_put(xe);
> > +
> >   	return ret;
> >   }

  reply	other threads:[~2023-11-29 22:20 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29  1:16 [Intel-xe] [PATCH v4 00/22] drm/xe: Probe tweaks and reordering Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 01/22] drm/xe: Skip calling drm_dev_put on probe error Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 02/22] drm/xe: Use managed pci_enable_device Michał Winiarski
2023-11-29 16:02   ` Matt Roper
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 03/22] drm/xe/irq: Don't call pci_free_irq_vectors Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 04/22] drm/xe: Move xe_set_dma_info outside of MMIO setup Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 05/22] drm/xe: Move xe_mmio_probe_tiles " Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 06/22] drm/xe: Split xe_info_init Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 07/22] drm/xe: Introduce xe_tile_init_early and use at earlier point in probe Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 08/22] drm/xe: Map the entire BAR0 and hold onto the initial mapping Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 09/22] drm/xe/device: Introduce xe_device_probe_early Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 10/22] drm/xe: Don't "peek" into GMD_ID Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 11/22] drm/xe: Move system memory management init to earlier point in probe Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 12/22] drm/xe: Move force_wake " Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 13/22] drm/xe: Reorder GGTT " Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 14/22] drm/xe: Add a helper for DRM device-lifetime BO create Michał Winiarski
2023-11-29  9:38   ` Michal Wajdeczko
2023-11-29 20:32     ` Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 15/22] drm/xe/uc: Split xe_uc_fw_init Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 16/22] drm/xe/uc: Store firmware binary in system-memory backed BO Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 17/22] drm/xe/uc: Extract xe_uc_sanitize_reset Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 18/22] drm/xe/guc: Split GuC params used for "hwconfig" and "post-hwconfig" Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 19/22] drm/managed: Add drmm_release_action Michał Winiarski
2023-11-29  9:43   ` Michal Wajdeczko
2023-11-29 17:52     ` Rodrigo Vivi
2023-11-29 22:17       ` Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 20/22] drm/xe/guc: Allocate GuC data structures in system memory for initial load Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 21/22] drm/xe/guc: Move GuC power control init to "post-hwconfig" Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 22/22] drm/xe: Initialize GuC earlier during probe Michał Winiarski
2023-11-29 21:48   ` Welty, Brian
2023-11-29 22:20     ` Michał Winiarski [this message]
2023-11-29  4:48 ` [Intel-xe] ✗ CI.Patch_applied: failure for drm/xe: Probe tweaks and reordering (rev3) Patchwork

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=ctavrro7oel2zx6kq34udtrtwbndtj5yfyfydkhurdfcumyxjx@qi4ml2yk3lwh \
    --to=michal.winiarski@intel.com \
    --cc=brian.welty@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.