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 v3 2/2] drm/xe/vf: Support PCIe FLR
Date: Fri, 27 Nov 2026 10:48:20 +0100 [thread overview]
Message-ID: <20261127094820.3luzfcm2dfzzks3h@intel.com> (raw)
In-Reply-To: <20261125080621.599255-3-lukasz.laguna@intel.com>
Lukasz Laguna <lukasz.laguna@intel.com> wrote on śro [2026-lis-25 09:06:20 +0100]:
> Allow PCIe FLR handling on VFs.
>
nit: maybe "on discrete VFs"? xe_pci_reset_skip() still skips
!IS_DGFX(), so integrated VFs remain unsupported.
> VF FLR isn't complete when the PCIe FLR finishes. The PF still has to
> sanitize the VF resources: it resets the VF GGTT entries and clears the
> VF LMEM. Once done, it notifies GuC with FLR_FINISH. Until then, GuC
> asks the VF to retry its requests.
>
> Re-initialization after FLR assumes that the FLR has already completed
> and that hardware state and VRAM contents are gone. It restores GGTT
> mappings of kernel BOs and rebuilds the migrate page tables, so if it
> started before the PF finished its cleanup, that cleanup could wipe
> the restored state.
>
> Add an SR-IOV post-FLR step to the reset handler, called before device
> re-initialization. On a VF, it resets the GuC VF state over MMIO until
> GuC accepts the request, which means the PF has completed the VF FLR
> cleanup.
>
> Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
> ---
> v2: Log an error when SR-IOV post-FLR actions fail
> Improve xe_sriov_post_flr() kernel-doc
> v3: Explain VF FLR flow ordering in commit message (Raag)
> ---
> drivers/gpu/drm/xe/xe_pci_error.c | 9 ++++++++-
> drivers/gpu/drm/xe/xe_sriov.c | 31 +++++++++++++++++++++++++++++++
> drivers/gpu/drm/xe/xe_sriov.h | 1 +
> 3 files changed, 40 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_pci_error.c b/drivers/gpu/drm/xe/xe_pci_error.c
> index fc6ff71d84a0..9b54ae2d392f 100644
> --- a/drivers/gpu/drm/xe/xe_pci_error.c
> +++ b/drivers/gpu/drm/xe/xe_pci_error.c
> @@ -16,6 +16,7 @@
> #include "xe_pm.h"
> #include "xe_printk.h"
> #include "xe_ras.h"
> +#include "xe_sriov.h"
> #include "xe_sriov_pf_helpers.h"
> #include "xe_survivability_mode.h"
> #include "xe_wa.h"
> @@ -234,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) || IS_SRIOV_VF(xe) || xe_sriov_pf_num_vfs(xe) || xe->info.probe_display;
> + return !IS_DGFX(xe) || xe_sriov_pf_num_vfs(xe) || xe->info.probe_display;
> }
>
> static void xe_pci_reset_prepare(struct pci_dev *pdev)
> @@ -293,6 +294,12 @@ static void xe_pci_reset_done(struct pci_dev *pdev)
> /* Unprepare early in case we fail */
> xe->flr_prepared = false;
>
> + err = xe_sriov_post_flr(xe);
> + if (err) {
> + xe_err(xe, "PCI reset: SR-IOV post-FLR actions failed\n");
> + goto out;
> + }
> +
> /*
> * We already have the data structures intact, so try to re-initialize the device.
> * This will be similar to system resume flow, except we'll also need to recreate
> diff --git a/drivers/gpu/drm/xe/xe_sriov.c b/drivers/gpu/drm/xe/xe_sriov.c
> index ec254b950daf..506f5a7bb335 100644
> --- a/drivers/gpu/drm/xe/xe_sriov.c
> +++ b/drivers/gpu/drm/xe/xe_sriov.c
> @@ -11,6 +11,7 @@
>
> #include "xe_assert.h"
> #include "xe_device.h"
> +#include "xe_gt_sriov_vf.h"
> #include "xe_mmio.h"
> #include "xe_sriov.h"
> #include "xe_sriov_pf.h"
> @@ -174,3 +175,33 @@ int xe_sriov_init_late(struct xe_device *xe)
>
> return 0;
> }
> +
> +/**
> + * xe_sriov_post_flr() - Perform SR-IOV specific post-FLR actions.
> + * @xe: the &xe_device
> + *
> + * This function should be called after PCIe FLR, before the device is
> + * re-initialized.
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +int xe_sriov_post_flr(struct xe_device *xe)
> +{
> + struct xe_gt *gt;
> + int err;
> + u8 id;
> +
> + if (IS_SRIOV_VF(xe)) {i
nit: an early return would save one level of indentation:
if (!IS_SRIOV_VF(xe))
return 0;
> + /*
> + * Wait for GuC to become responsive. This indicates that PF completed
> + * VF FLR cleanups and it's safe to start VF re-initialization.
> + */
> + for_each_gt(gt, xe, id) {
> + err = xe_gt_sriov_vf_reset(gt);
> + if (err)
> + return err;
> + }
> + }
> +
> + return 0;
> +}
> diff --git a/drivers/gpu/drm/xe/xe_sriov.h b/drivers/gpu/drm/xe/xe_sriov.h
> index 72e55543c30e..444d1ad74926 100644
> --- a/drivers/gpu/drm/xe/xe_sriov.h
> +++ b/drivers/gpu/drm/xe/xe_sriov.h
> @@ -19,6 +19,7 @@ void xe_sriov_probe_early(struct xe_device *xe);
> void xe_sriov_print_info(struct xe_device *xe, struct drm_printer *p);
> int xe_sriov_init(struct xe_device *xe);
> int xe_sriov_init_late(struct xe_device *xe);
> +int xe_sriov_post_flr(struct xe_device *xe);
>
> static inline enum xe_sriov_mode xe_device_sriov_mode(const struct xe_device *xe)
> {
All of the above are minor, so with or without them:
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
> --
> 2.43.0
>
--
next prev parent reply other threads:[~2026-11-27 9:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 8:06 [PATCH v3 0/2] drm/xe/vf: Support PCIe FLR Lukasz Laguna
2026-11-25 8:06 ` [PATCH v3 1/2] drm/xe/guc: Tear down exec queues on VF FLR prepare Lukasz Laguna
2026-11-27 9:47 ` Piotr Piórkowski
2026-11-25 8:06 ` [PATCH v3 2/2] drm/xe/vf: Support PCIe FLR Lukasz Laguna
2026-11-27 9:48 ` Piotr Piórkowski [this message]
2026-11-27 12:46 ` Laguna, Lukasz
2026-11-25 8:15 ` ✓ CI.KUnit: success for drm/xe/vf: Support PCIe FLR (rev3) Patchwork
2026-11-25 8:55 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-25 10:20 ` ✓ 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=20261127094820.3luzfcm2dfzzks3h@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 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.