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 v1 1/2] drm/xe/pf: Extract VFs enabling revert helper
Date: Mon, 23 Nov 2026 11:48:21 +0100 [thread overview]
Message-ID: <95f6d4ec-aaac-4f5c-87d0-4f609e495ae9@linux.intel.com> (raw)
In-Reply-To: <20261123094607.3300722-2-piotr.piorkowski@intel.com>
On 11/23/2026 10:46 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, VFs provisioning, extra runtime PM reference and
> the VFs enabling guard. Extract this common code into a helper.
>
> Note that in pf_disable_vfs() the VF VRAM BAR will now be resized
> back after the PF reprovisioning and VFs reset, but since at this
> point the VFs are already disabled, this should not matter.
>
> 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 | 28 +++++++++++++++-------------
> 1 file changed, 15 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_pci_sriov.c b/drivers/gpu/drm/xe/xe_pci_sriov.c
> index 31abcee55211..6c839eff0db8 100644
> --- a/drivers/gpu/drm/xe/xe_pci_sriov.c
> +++ b/drivers/gpu/drm/xe/xe_pci_sriov.c
> @@ -125,6 +125,18 @@ 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, int num_vfs)
> +{
> + pf_resize_vf_vram_bar(xe, xe->sriov.pf.device_total_vfs);
> +
> + xe_sriov_pf_unprovision_vfs(xe, num_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 +163,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,10 +189,7 @@ 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_unprovision_vfs(xe, num_vfs);
> - xe_pm_runtime_put(xe);
> - pf_finish_vfs_enabling(xe);
> + pf_enable_vfs_revert(xe, num_vfs);
> out:
> xe_sriov_notice(xe, "Failed to enable %u VF%s (%pe)\n",
> num_vfs, str_plural(num_vfs), ERR_PTR(err));
> @@ -205,18 +214,11 @@ 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);
I assume xe_sriov_pf_reprovision_default() is intentionally kept out of
pf_enable_vfs_revert() so the PF is restored before the potentially slow
pf_reset_vfs() (as per 24ac010a97b6)? If so, the error path would need
it explicitly too (see link in the cover letter reply).
--
marcin
>
> - 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, num_vfs);
>
> 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-23 10:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 9:46 [PATCH v1 0/2] Prepare VFs enabling for VGPU profiles Piórkowski, Piotr
2026-11-23 9:46 ` [PATCH v1 1/2] drm/xe/pf: Extract VFs enabling revert helper Piórkowski, Piotr
2026-11-23 10:42 ` K V P, Satyanarayana
2026-11-23 11:10 ` Bernatowicz, Marcin
2026-11-23 10:48 ` Bernatowicz, Marcin [this message]
2026-11-23 9:46 ` [PATCH v1 2/2] drm/xe/pf: Split VFs enabling into prepare and commit steps Piórkowski, Piotr
2026-11-23 10:54 ` Bernatowicz, Marcin
2026-11-23 10:43 ` [PATCH v1 0/2] Prepare VFs enabling for VGPU profiles Bernatowicz, Marcin
2026-11-23 14:25 ` ✗ CI.KUnit: failure for " 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=95f6d4ec-aaac-4f5c-87d0-4f609e495ae9@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.