Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Bernatowicz, Marcin" <marcin.bernatowicz@linux.intel.com>
To: "Piórkowski, Piotr" <piotr.piorkowski@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v1 5/5] drm/xe/pf: Split the provisioning mode change function
Date: Tue, 10 Nov 2026 11:49:12 +0100	[thread overview]
Message-ID: <3dc3e65a-1d1c-429c-8e95-566e47f13b5e@linux.intel.com> (raw)
In-Reply-To: <20261027103009.1259199-6-piotr.piorkowski@intel.com>

LGTM,

Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>

On 10/27/2026 11:30 AM, Piórkowski, Piotr wrote:
> From: Michal Wajdeczko <michal.wajdeczko@intel.com>
>
> During VGPU profile provisioning we will need to change the
> provisioning mode while already holding the master mutex.
>
> Move the mode change logic into a static helper that expects the
> caller to hold the master mutex. The caller identity, used only in
> the debug message, is now passed explicitly, as the helper will be
> called from different places.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Signed-off-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
> ---
>   drivers/gpu/drm/xe/xe_sriov_pf_provision.c | 41 +++++++++++++---------
>   1 file changed, 24 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_provision.c b/drivers/gpu/drm/xe/xe_sriov_pf_provision.c
> index 6ea2a24fef6e..7357b9369522 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_pf_provision.c
> +++ b/drivers/gpu/drm/xe/xe_sriov_pf_provision.c
> @@ -154,6 +154,29 @@ int xe_sriov_pf_reprovision_default(struct xe_device *xe)
>   	return pf_reprovision_default(xe);
>   }
>   
> +static int pf_change_mode(struct xe_device *xe, enum xe_sriov_provisioning_mode mode, void *who)
> +{
> +	lockdep_assert_held(xe_sriov_pf_master_mutex(xe));
> +
> +	if (mode == xe->sriov.pf.provision.mode)
> +		return 0;
> +
> +	if (mode == XE_SRIOV_PROVISIONING_MODE_AUTO) {
> +		if (xe_sriov_pf_num_vfs(xe)) {
> +			xe_sriov_dbg(xe, "can't restore %s: VFs must be disabled!\n",
> +				     mode_to_string(mode));
> +			return -EBUSY;
> +		}
> +		pf_unprovision_all_vfs(xe);
> +	}
> +
> +	xe_sriov_dbg(xe, "mode %s changed to %s by %ps\n",
> +		     mode_to_string(xe->sriov.pf.provision.mode),
> +		     mode_to_string(mode), who);
> +	xe->sriov.pf.provision.mode = mode;
> +	return 0;
> +}
> +
>   /**
>    * xe_sriov_pf_provision_set_mode() - Change VFs provision mode.
>    * @xe: the PF &xe_device
> @@ -176,23 +199,7 @@ int xe_sriov_pf_provision_set_mode(struct xe_device *xe, enum xe_sriov_provision
>   
>   	guard(mutex)(xe_sriov_pf_master_mutex(xe));
>   
> -	if (mode == xe->sriov.pf.provision.mode)
> -		return 0;
> -
> -	if (mode == XE_SRIOV_PROVISIONING_MODE_AUTO) {
> -		if (xe_sriov_pf_num_vfs(xe)) {
> -			xe_sriov_dbg(xe, "can't restore %s: VFs must be disabled!\n",
> -				     mode_to_string(mode));
> -			return -EBUSY;
> -		}
> -		pf_unprovision_all_vfs(xe);
> -	}
> -
> -	xe_sriov_dbg(xe, "mode %s changed to %s by %ps\n",
> -		     mode_to_string(xe->sriov.pf.provision.mode),
> -		     mode_to_string(mode), __builtin_return_address(0));
> -	xe->sriov.pf.provision.mode = mode;
> -	return 0;
> +	return pf_change_mode(xe, mode, __builtin_return_address(0));
>   }
>   
>   /**

  reply	other threads:[~2026-11-10 10:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27 10:30 [PATCH v1 0/5] Prepare SR-IOV provisioning for VGPU profiles Piórkowski, Piotr
2026-10-27 10:30 ` [PATCH v1 1/5] drm/xe/pf: Split the bulk priority provisioning function Piórkowski, Piotr
2026-11-10 10:44   ` Bernatowicz, Marcin
2026-10-27 10:30 ` [PATCH v1 2/5] drm/xe/pf: Change provisioning mode under mutex Piórkowski, Piotr
2026-11-10 10:46   ` Bernatowicz, Marcin
2026-10-27 10:30 ` [PATCH v1 3/5] drm/xe/pf: Add locked variant of the fair VFs provisioning Piórkowski, Piotr
2026-11-10 10:47   ` Bernatowicz, Marcin
2026-10-27 10:30 ` [PATCH v1 4/5] drm/xe/pf: Provision VFs under mutex Piórkowski, Piotr
2026-11-10 10:48   ` Bernatowicz, Marcin
2026-10-27 10:30 ` [PATCH v1 5/5] drm/xe/pf: Split the provisioning mode change function Piórkowski, Piotr
2026-11-10 10:49   ` Bernatowicz, Marcin [this message]
2026-10-27 10:39 ` ✓ CI.KUnit: success for Prepare SR-IOV provisioning for VGPU profiles Patchwork
2026-10-27 11:15 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-27 13:07 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-11-10 12:36   ` 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=3dc3e65a-1d1c-429c-8e95-566e47f13b5e@linux.intel.com \
    --to=marcin.bernatowicz@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox