From: "Piotr Piórkowski" <piotr.piorkowski@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 2/4] drm/xe/pf: Automatically provision VFs only in auto-mode
Date: Wed, 15 Oct 2025 18:30:25 +0200 [thread overview]
Message-ID: <20251015163025.ld5k7ymigxmq5zad@intel.com> (raw)
In-Reply-To: <20251015091211.592-3-michal.wajdeczko@intel.com>
Michal Wajdeczko <michal.wajdeczko@intel.com> wrote on śro [2025-paź-15 11:12:07 +0200]:
> We shouldn't attempt to auto-provision VFs once we allow other
> provisioning methods. Make the code aware of the new condition.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
> drivers/gpu/drm/xe/xe_sriov_pf_provision.c | 16 +++++++++-
> .../gpu/drm/xe/xe_sriov_pf_provision_types.h | 32 +++++++++++++++++++
> drivers/gpu/drm/xe/xe_sriov_pf_types.h | 4 +++
> 3 files changed, 51 insertions(+), 1 deletion(-)
> create mode 100644 drivers/gpu/drm/xe/xe_sriov_pf_provision_types.h
>
> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_provision.c b/drivers/gpu/drm/xe/xe_sriov_pf_provision.c
> index c24803312231..de7d925a110d 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_pf_provision.c
> +++ b/drivers/gpu/drm/xe/xe_sriov_pf_provision.c
> @@ -9,6 +9,14 @@
> #include "xe_sriov.h"
> #include "xe_sriov_pf_helpers.h"
> #include "xe_sriov_pf_provision.h"
> +#include "xe_sriov_pf_provision_types.h"
> +
> +static bool pf_auto_provisioning_mode(struct xe_device *xe)
> +{
> + xe_assert(xe, IS_SRIOV_PF(xe));
> +
> + return xe->sriov.pf.provision.mode == XE_SRIOV_PROVISIONING_MODE_AUTO;
> +}
>
> static int pf_needs_provisioning(struct xe_gt *gt, unsigned int num_vfs)
> {
> @@ -30,7 +38,7 @@ static int pf_provision_vfs(struct xe_device *xe, unsigned int num_vfs)
>
> for_each_gt(gt, xe, id) {
> if (!pf_needs_provisioning(gt, num_vfs))
> - continue;
> + return -EUCLEAN;
> err = xe_gt_sriov_pf_config_set_fair(gt, VFID(1), num_vfs);
> result = result ?: err;
> }
> @@ -62,6 +70,9 @@ int xe_sriov_pf_provision_vfs(struct xe_device *xe, unsigned int num_vfs)
> {
> xe_assert(xe, IS_SRIOV_PF(xe));
>
> + if (!pf_auto_provisioning_mode(xe))
> + return 0;
> +
> return pf_provision_vfs(xe, num_vfs);
> }
>
> @@ -78,6 +89,9 @@ int xe_sriov_pf_unprovision_vfs(struct xe_device *xe, unsigned int num_vfs)
> {
> xe_assert(xe, IS_SRIOV_PF(xe));
>
> + if (!pf_auto_provisioning_mode(xe))
> + return 0;
> +
> pf_unprovision_vfs(xe, num_vfs);
> return 0;
> }
> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_provision_types.h b/drivers/gpu/drm/xe/xe_sriov_pf_provision_types.h
> new file mode 100644
> index 000000000000..f72bc5db3a60
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/xe_sriov_pf_provision_types.h
> @@ -0,0 +1,32 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2025 Intel Corporation
> + */
> +
> +#ifndef _XE_SRIOV_PF_PROVISION_TYPES_H_
> +#define _XE_SRIOV_PF_PROVISION_TYPES_H_
> +
> +#include <linux/build_bug.h>
> +
> +/**
> + * enum xe_sriov_provisioning_mode - SR-IOV provisioning mode.
> + *
> + * @XE_SRIOV_PROVISIONING_MODE_AUTO: VFs are provisioned during VFs enabling.
> + * Any allocated resources to the VFs will be
> + * automatically released when disabling VFs.
> + * This is a default mode.
> + */
> +enum xe_sriov_provisioning_mode {
> + XE_SRIOV_PROVISIONING_MODE_AUTO,
> +};
> +static_assert(XE_SRIOV_PROVISIONING_MODE_AUTO == 0);
> +
> +/**
> + * struct xe_sriov_pf_provision - Data used by the PF provisioning.
> + */
> +struct xe_sriov_pf_provision {
> + /** @mode: selected provisioning mode. */
> + enum xe_sriov_provisioning_mode mode;
> +};
> +
> +#endif
> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_types.h b/drivers/gpu/drm/xe/xe_sriov_pf_types.h
> index 956a88f9f213..c753cd59aed2 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_pf_types.h
> +++ b/drivers/gpu/drm/xe/xe_sriov_pf_types.h
> @@ -9,6 +9,7 @@
> #include <linux/mutex.h>
> #include <linux/types.h>
>
> +#include "xe_sriov_pf_provision_types.h"
> #include "xe_sriov_pf_service_types.h"
>
> /**
> @@ -35,6 +36,9 @@ struct xe_device_pf {
> /** @master_lock: protects all VFs configurations across GTs */
> struct mutex master_lock;
>
> + /** @provision: device level provisioning data. */
> + struct xe_sriov_pf_provision provision;
> +
> /** @service: device level service data. */
> struct xe_sriov_pf_service service;
LGTM:
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
>
> --
> 2.47.1
>
--
next prev parent reply other threads:[~2025-10-15 16:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-15 9:12 [PATCH 0/4] PF: Update auto-provisioning Michal Wajdeczko
2025-10-15 9:12 ` [PATCH 1/4] drm/xe/pf: Promote VFs provisioning helpers Michal Wajdeczko
2025-10-15 13:00 ` Piotr Piórkowski
2025-10-16 11:33 ` Michal Wajdeczko
2025-10-15 9:12 ` [PATCH 2/4] drm/xe/pf: Automatically provision VFs only in auto-mode Michal Wajdeczko
2025-10-15 16:30 ` Piotr Piórkowski [this message]
2025-10-15 9:12 ` [PATCH 3/4] drm/xe/pf: Disable auto-provisioning if changed using debugfs Michal Wajdeczko
2025-10-16 15:26 ` Piotr Piórkowski
2025-10-15 9:12 ` [PATCH 4/4] drm/xe/pf: Allow to restore auto-provisioning mode Michal Wajdeczko
2025-10-16 15:46 ` Piotr Piórkowski
2025-10-15 12:10 ` ✗ CI.checkpatch: warning for PF: Update auto-provisioning Patchwork
2025-10-15 12:11 ` ✓ CI.KUnit: success " Patchwork
2025-10-15 13:07 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-15 22:12 ` ✗ Xe.CI.Full: failure " Patchwork
2025-10-16 10:55 ` Michal Wajdeczko
2025-10-20 9:49 ` Bernatowicz, Marcin
2025-10-20 11:08 ` Bernatowicz, Marcin
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=20251015163025.ld5k7ymigxmq5zad@intel.com \
--to=piotr.piorkowski@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=michal.wajdeczko@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