From: "Piotr Piórkowski" <piotr.piorkowski@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH] drm/xe/pf: Don't advertise support to enable VFs if not ready
Date: Tue, 14 May 2024 12:50:00 +0200 [thread overview]
Message-ID: <20240514105000.ge5oyg74a56eodcw@intel.com> (raw)
In-Reply-To: <20240507165757.2835-1-michal.wajdeczko@intel.com>
Michal Wajdeczko <michal.wajdeczko@intel.com> wrote on wto [2024-maj-07 18:57:57 +0200]:
> Even if we have not enabled SR-IOV support using the platform
> specific has_sriov flag, the hardware may still report SR-IOV
> capability and the PCI layer may wrongly advertise driver support
> to enable VFs. Explicitly reset the number of supported VFs to
> zero to avoid confusion.
>
> Applications may read the /sys/bus/pci/devices/.../sriov_totalvfs
> prior to enabling VFs using the sriov_numvfs to check if such an
> operation is possible.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
> drivers/gpu/drm/xe/xe_sriov.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_sriov.c b/drivers/gpu/drm/xe/xe_sriov.c
> index 1c3fa84b6adb..a274a5fb1401 100644
> --- a/drivers/gpu/drm/xe/xe_sriov.c
> +++ b/drivers/gpu/drm/xe/xe_sriov.c
> @@ -53,6 +53,7 @@ static bool test_is_vf(struct xe_device *xe)
> */
> void xe_sriov_probe_early(struct xe_device *xe)
> {
> + struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
> enum xe_sriov_mode mode = XE_SRIOV_MODE_NONE;
> bool has_sriov = xe->info.has_sriov;
>
> @@ -61,6 +62,16 @@ void xe_sriov_probe_early(struct xe_device *xe)
> mode = XE_SRIOV_MODE_VF;
> else if (xe_sriov_pf_readiness(xe))
> mode = XE_SRIOV_MODE_PF;
> + } else if (pci_sriov_get_totalvfs(pdev)) {
> + /*
> + * Even if we have not enabled SR-IOV support using the
> + * platform specific has_sriov flag, the hardware may still
> + * report SR-IOV capability and the PCI layer may wrongly
> + * advertise driver support to enable VFs. Explicitly reset
> + * the number of supported VFs to zero to avoid confusion.
> + */
> + drm_info(&xe->drm, "Support for SR-IOV is not available\n");
> + pci_sriov_set_totalvfs(pdev, 0);
> }
LGTM:
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
>
> xe_assert(xe, !xe->sriov.__mode);
> --
> 2.43.0
>
--
next prev parent reply other threads:[~2024-05-14 10:50 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-07 16:57 [PATCH] drm/xe/pf: Don't advertise support to enable VFs if not ready Michal Wajdeczko
2024-05-07 19:39 ` ✓ CI.Patch_applied: success for " Patchwork
2024-05-07 19:39 ` ✓ CI.checkpatch: " Patchwork
2024-05-07 19:40 ` ✓ CI.KUnit: " Patchwork
2024-05-07 19:52 ` ✓ CI.Build: " Patchwork
2024-05-07 19:55 ` ✓ CI.Hooks: " Patchwork
2024-05-07 19:56 ` ✓ CI.checksparse: " Patchwork
2024-05-07 21:02 ` ✓ CI.BAT: " Patchwork
2024-05-08 6:21 ` ✗ CI.FULL: failure " Patchwork
2024-05-15 12:21 ` Michal Wajdeczko
2024-05-14 10:50 ` Piotr Piórkowski [this message]
2024-05-14 13:09 ` [PATCH] " Lucas De Marchi
2024-05-14 13:46 ` Michal Wajdeczko
2024-05-15 18:56 ` Lucas De Marchi
2024-05-14 17:00 ` ✓ CI.Patch_applied: success for drm/xe/pf: Don't advertise support to enable VFs if not ready (rev2) Patchwork
2024-05-14 17:00 ` ✓ CI.checkpatch: " Patchwork
2024-05-14 17:01 ` ✓ CI.KUnit: " Patchwork
2024-05-14 17:13 ` ✓ CI.Build: " Patchwork
2024-05-14 17:15 ` ✓ CI.Hooks: " Patchwork
2024-05-14 17:17 ` ✓ CI.checksparse: " Patchwork
2024-05-14 17:37 ` ✓ CI.BAT: " Patchwork
2024-05-14 20:12 ` ✗ CI.FULL: failure " Patchwork
2024-05-15 12:16 ` Michal Wajdeczko
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=20240514105000.ge5oyg74a56eodcw@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