Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Piotr Piórkowski" <piotr.piorkowski@intel.com>
To: Lukasz Laguna <lukasz.laguna@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <satyanarayana.k.v.p@intel.com>,
	<tomasz.lis@intel.com>, <raag.jadav@intel.com>
Subject: Re: [PATCH 5/5] drm/xe/pf: Support PCIe FLR when VFs are enabled
Date: Wed, 2 Dec 2026 11:44:33 +0100	[thread overview]
Message-ID: <20261202104433.j6mbsajeg7ct5cro@intel.com> (raw)
In-Reply-To: <20261130150315.1954064-6-lukasz.laguna@intel.com>

Lukasz Laguna <lukasz.laguna@intel.com> wrote on pon [2026-lis-30 16:03:15 +0100]:
> Allow PCIe FLR handling on PF when VFs are enabled.
> 
> The VF configurations are pushed to GuC by the PF restart workers.
> Wait for these workers before unwedging the PF, so that the VFs can be
> used once the reset completes.
> 
> Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_device.c    |  3 +++
>  drivers/gpu/drm/xe/xe_pci_error.c |  2 +-
>  drivers/gpu/drm/xe/xe_sriov_pf.c  | 27 +++++++++++++++++++--------
>  drivers/gpu/drm/xe/xe_sriov_pf.h  |  2 ++
>  4 files changed, 25 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index a9e1b8782551..1cf4e1471ce2 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -1543,6 +1543,9 @@ int xe_device_resume(struct xe_device *xe, bool flr)
>  	if (flr) {
>  		if (err)
>  			return err;
> +
> +		if (IS_SRIOV_PF(xe))
> +			xe_sriov_pf_wait_restart(xe);
>  	} else {
>  		/*
>  		 * Try to bring up display before bailing from GT resume failure,
> diff --git a/drivers/gpu/drm/xe/xe_pci_error.c b/drivers/gpu/drm/xe/xe_pci_error.c
> index ed3060071708..57e6685281ae 100644
> --- a/drivers/gpu/drm/xe/xe_pci_error.c
> +++ b/drivers/gpu/drm/xe/xe_pci_error.c
> @@ -235,7 +235,7 @@ static void xe_pci_error_resume(struct pci_dev *pdev)
>  
>  static inline bool xe_pci_reset_skip(struct xe_device *xe)
>  {
> -	return !IS_DGFX(xe) || xe_sriov_pf_num_vfs(xe) || xe->info.probe_display;
> +	return !IS_DGFX(xe) || xe->info.probe_display;
>  }
>  
>  static void xe_pci_reset_prepare(struct pci_dev *pdev)
> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf.c b/drivers/gpu/drm/xe/xe_sriov_pf.c
> index a6c70fe4ae03..8bbca88beee0 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_pf.c
> +++ b/drivers/gpu/drm/xe/xe_sriov_pf.c
> @@ -146,22 +146,17 @@ int xe_sriov_pf_init_late(struct xe_device *xe)
>  }
>  
>  /**
> - * xe_sriov_pf_wait_ready() - Wait until PF is ready to operate.
> - * @xe: the &xe_device to test
> - *
> - * This function can only be called on PF.
> + * xe_sriov_pf_wait_restart() - Wait for PF restart workers.
> + * @xe: the PF &xe_device
>   *
>   * Return: 0 on success or a negative error code on failure.
>   */
> -int xe_sriov_pf_wait_ready(struct xe_device *xe)
> +int xe_sriov_pf_wait_restart(struct xe_device *xe)
>  {
>  	struct xe_gt *gt;
>  	unsigned int id;
>  	int err;
>  
> -	if (xe_wedged(xe))
> -		return -ECANCELED;
> -
>  	for_each_gt(gt, xe, id) {
>  		err = xe_gt_sriov_pf_wait_ready(gt);
>  		if (err)
> @@ -171,6 +166,22 @@ int xe_sriov_pf_wait_ready(struct xe_device *xe)
>  	return 0;
>  }
>  
> +/**
> + * xe_sriov_pf_wait_ready() - Wait until PF is ready to operate.
> + * @xe: the &xe_device to test
> + *
> + * This function can only be called on PF.
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +int xe_sriov_pf_wait_ready(struct xe_device *xe)
> +{
> +	if (xe_wedged(xe))
> +		return -ECANCELED;
> +
> +	return xe_sriov_pf_wait_restart(xe);
> +}
> +
>  /**
>   * xe_sriov_pf_recover_vfs() - Recover provisioned VFs after PF FLR.
>   * @xe: the PF &xe_device
> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf.h b/drivers/gpu/drm/xe/xe_sriov_pf.h
> index 0c6a404878c2..93a4a73d2bf1 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_pf.h
> +++ b/drivers/gpu/drm/xe/xe_sriov_pf.h
> @@ -16,6 +16,7 @@ struct xe_device;
>  bool xe_sriov_pf_readiness(struct xe_device *xe);
>  int xe_sriov_pf_init_early(struct xe_device *xe);
>  int xe_sriov_pf_init_late(struct xe_device *xe);
> +int xe_sriov_pf_wait_restart(struct xe_device *xe);
>  int xe_sriov_pf_wait_ready(struct xe_device *xe);
>  int xe_sriov_pf_recover_vfs(struct xe_device *xe);
>  int xe_sriov_pf_lockdown(struct xe_device *xe);
> @@ -25,6 +26,7 @@ void xe_sriov_pf_print_vfs_summary(struct xe_device *xe, struct drm_printer *p);
>  static inline bool xe_sriov_pf_readiness(struct xe_device *xe) { return false; }
>  static inline int xe_sriov_pf_init_early(struct xe_device *xe) { return 0; }
>  static inline int xe_sriov_pf_init_late(struct xe_device *xe) { return 0; }
> +static inline int xe_sriov_pf_wait_restart(struct xe_device *xe) { return 0; }
>  static inline int xe_sriov_pf_recover_vfs(struct xe_device *xe) { return 0; }
>  static inline int xe_sriov_pf_lockdown(struct xe_device *xe) { return 0; }
>  static inline void xe_sriov_pf_end_lockdown(struct xe_device *xe) { }
> -- 
> 2.43.0
> 

I think the SR-IOV PF workers may need to be stopped before FLR. In gt_reset_worker() we call
xe_gt_sriov_pf_stop_prepare() to cancel the restart worker. xe_gt_flr_prepare() doesn't do this,
so with VFs enabled a restart worker could still run while the device goes through FLR.

Maybe something like this in xe_gt_flr_prepare()?


	if (IS_SRIOV_PF(gt_to_xe(gt)))
		xe_gt_sriov_pf_stop_prepare(gt);

I'm also not sure about the control worker. If a VF FLR is being handled at the same time, 
it may use tile->migrate (LMEM sanitize) while xe_migrate_flr_prepare() tears it down.
Did you check this case?

Thanks
Piotr


-- 

  reply	other threads:[~2026-12-02 10:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 15:03 [PATCH 0/5] drm/xe/pf: Support PCIe FLR when VFs are enabled Lukasz Laguna
2026-11-30 15:03 ` [PATCH 1/5] drm/xe/pf: Add helper to rewrite VF LMTT page table tree Lukasz Laguna
2026-12-02  9:37   ` Piotr Piórkowski
2026-11-30 15:03 ` [PATCH 2/5] drm/xe/pf: Extract VF LMTT pages population into helper Lukasz Laguna
2026-12-02  9:40   ` Piotr Piórkowski
2026-11-30 15:03 ` [PATCH 3/5] drm/xe/pf: Recover VF state after PF FLR Lukasz Laguna
2026-12-02  9:59   ` Piotr Piórkowski
2026-11-30 15:03 ` [PATCH 4/5] drm/xe/pf: Preserve VF PCI config space across " Lukasz Laguna
2026-12-02 10:38   ` Piotr Piórkowski
2026-11-30 15:03 ` [PATCH 5/5] drm/xe/pf: Support PCIe FLR when VFs are enabled Lukasz Laguna
2026-12-02 10:44   ` Piotr Piórkowski [this message]
2026-11-30 17:23 ` ✓ CI.KUnit: success for " Patchwork
2026-11-30 18:13 ` ✓ Xe.CI.BAT: " Patchwork
2026-12-01  2:30 ` ✓ Xe.CI.FULL: " 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=20261202104433.j6mbsajeg7ct5cro@intel.com \
    --to=piotr.piorkowski@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lukasz.laguna@intel.com \
    --cc=raag.jadav@intel.com \
    --cc=satyanarayana.k.v.p@intel.com \
    --cc=tomasz.lis@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