From: "Bernatowicz, Marcin" <marcin.bernatowicz@linux.intel.com>
To: "Piórkowski, Piotr" <piotr.piorkowski@intel.com>,
intel-xe@lists.freedesktop.org
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Subject: Re: [PATCH v2 2/3] drm/xe/pf: Extract VFs enabling revert helper
Date: Tue, 24 Nov 2026 16:45:07 +0100 [thread overview]
Message-ID: <22820f2a-896c-42ad-8761-e8a439edd0b3@linux.intel.com> (raw)
In-Reply-To: <20261124105009.3431301-3-piotr.piorkowski@intel.com>
On 11/24/2026 11:50 AM, Piórkowski, Piotr wrote:
> From: Michal Wajdeczko <michal.wajdeczko@intel.com>
>
> Both the error path of the pf_enable_vfs() and the pf_disable_vfs()
> are releasing the same set of resources acquired during VFs enabling:
> VF VRAM BAR size, extra runtime PM reference and the VFs enabling
> guard. Extract this common code into a helper.
>
> The PF reprovisioning and VFs unprovisioning are kept outside of the
> helper, as they depend on the provisioning mode, and during the VFs
> disabling we want to restore the PF scheduling settings before the
> potentially slow VFs reset.
>
> Note that in pf_disable_vfs() the VF VRAM BAR will now be resized
> back at the end, but since at this point the VFs are already disabled,
> this should not matter.
>
> v2:
> - keep VFs unprovisioning out of the helper (Marcin)
> - keep PF reprovisioning out of the helper
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Signed-off-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
> ---
> drivers/gpu/drm/xe/xe_pci_sriov.c | 23 +++++++++++++----------
> 1 file changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_pci_sriov.c b/drivers/gpu/drm/xe/xe_pci_sriov.c
> index 3bf995736502..d0536322dc05 100644
> --- a/drivers/gpu/drm/xe/xe_pci_sriov.c
> +++ b/drivers/gpu/drm/xe/xe_pci_sriov.c
> @@ -125,6 +125,16 @@ static void pf_finish_vfs_enabling(struct xe_device *xe)
> xe_sriov_pf_disarm_guard(xe, &xe->sriov.pf.guard_vfs_enabling, false, NULL);
> }
>
> +static void pf_enable_vfs_revert(struct xe_device *xe)
> +{
> + pf_resize_vf_vram_bar(xe, xe->sriov.pf.device_total_vfs);
> +
> + /* Release additional PM reference obtained in pf_enable_vfs() */
> + xe_pm_runtime_put(xe);
> +
> + pf_finish_vfs_enabling(xe);
> +}
> +
> static int pf_enable_vfs(struct xe_device *xe, int num_vfs)
> {
> struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
> @@ -151,7 +161,7 @@ static int pf_enable_vfs(struct xe_device *xe, int num_vfs)
> * With PF being in D0 state, all VFs will also behave as in D0 state.
> * This will also keep GuC alive with all VFs' configurations.
> *
> - * We will release this additional PM reference in pf_disable_vfs().
> + * We will release this additional PM reference in pf_enable_vfs_revert().
> */
> xe_pm_runtime_get_noresume(xe);
>
> @@ -177,11 +187,9 @@ static int pf_enable_vfs(struct xe_device *xe, int num_vfs)
> return num_vfs;
>
> failed:
> - pf_resize_vf_vram_bar(xe, xe->sriov.pf.device_total_vfs);
> xe_sriov_pf_reprovision_default(xe);
> xe_sriov_pf_unprovision_vfs(xe, num_vfs);
> - xe_pm_runtime_put(xe);
> - pf_finish_vfs_enabling(xe);
> + pf_enable_vfs_revert(xe);
> out:
> xe_sriov_notice(xe, "Failed to enable %u VF%s (%pe)\n",
> num_vfs, str_plural(num_vfs), ERR_PTR(err));
> @@ -206,18 +214,13 @@ static int pf_disable_vfs(struct xe_device *xe)
>
> pci_disable_sriov(pdev);
>
> - pf_resize_vf_vram_bar(xe, xe->sriov.pf.device_total_vfs);
> -
> xe_sriov_pf_reprovision_default(xe);
>
> pf_reset_vfs(xe, num_vfs);
>
> xe_sriov_pf_unprovision_vfs(xe, num_vfs);
>
> - /* not needed anymore - see pf_enable_vfs() */
> - xe_pm_runtime_put(xe);
> -
> - pf_finish_vfs_enabling(xe);
> + pf_enable_vfs_revert(xe);
LGTM,
Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
>
> xe_sriov_info(xe, "Disabled %u VF%s\n", num_vfs, str_plural(num_vfs));
> return 0;
next prev parent reply other threads:[~2026-11-24 15:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 10:50 [PATCH v2 0/3] Prepare VFs enabling for VGPU profiles Piórkowski, Piotr
2026-11-24 10:50 ` [PATCH v2 1/3] drm/xe/pf: Restore default PF scheduling on failed VF enable Piórkowski, Piotr
2026-11-25 8:22 ` K V P, Satyanarayana
2026-11-24 10:50 ` [PATCH v2 2/3] drm/xe/pf: Extract VFs enabling revert helper Piórkowski, Piotr
2026-11-24 15:45 ` Bernatowicz, Marcin [this message]
2026-11-24 10:50 ` [PATCH v2 3/3] drm/xe/pf: Split VFs enabling into prepare and commit steps Piórkowski, Piotr
2026-11-24 15:45 ` Bernatowicz, Marcin
2026-11-24 11:05 ` ✗ CI.KUnit: failure for Prepare VFs enabling for VGPU profiles (rev2) Patchwork
2026-11-25 9:21 ` Piotr Piórkowski
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=22820f2a-896c-42ad-8761-e8a439edd0b3@linux.intel.com \
--to=marcin.bernatowicz@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=michal.wajdeczko@intel.com \
--cc=piotr.piorkowski@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.