From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Subject: [PATCH 3/5] drm/xe/configfs: Always return consistent max_vfs value
Date: Wed, 21 Jan 2026 22:42:14 +0100 [thread overview]
Message-ID: <20260121214218.2817-4-michal.wajdeczko@intel.com> (raw)
In-Reply-To: <20260121214218.2817-1-michal.wajdeczko@intel.com>
The max_vfs parameter used by the Xe driver has its default value
definition, but it could be altered by the module parameter or by
the device specific configfs attribute.
To avoid mistakes or code duplication, always rely on the configfs
helper (or stub), which will provide necessary fallback if needed.
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
---
drivers/gpu/drm/xe/xe_configfs.c | 3 ++-
drivers/gpu/drm/xe/xe_configfs.h | 8 +++++++-
drivers/gpu/drm/xe/xe_sriov_pf.c | 4 +---
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_configfs.c
index 9f6251b1008b..a823b0bd4ebb 100644
--- a/drivers/gpu/drm/xe/xe_configfs.c
+++ b/drivers/gpu/drm/xe/xe_configfs.c
@@ -15,6 +15,7 @@
#include "instructions/xe_mi_commands.h"
#include "xe_configfs.h"
+#include "xe_defaults.h"
#include "xe_gt_types.h"
#include "xe_hw_engine_types.h"
#include "xe_module.h"
@@ -280,7 +281,7 @@ static const struct xe_config_device device_defaults = {
.survivability_mode = false,
.enable_psmi = false,
.sriov = {
- .max_vfs = UINT_MAX,
+ .max_vfs = XE_DEFAULT_MAX_VFS,
},
};
diff --git a/drivers/gpu/drm/xe/xe_configfs.h b/drivers/gpu/drm/xe/xe_configfs.h
index 510888354a7c..e0a555b871b3 100644
--- a/drivers/gpu/drm/xe/xe_configfs.h
+++ b/drivers/gpu/drm/xe/xe_configfs.h
@@ -9,6 +9,7 @@
#include <linux/types.h>
#include "xe_hw_engine_types.h"
+#include "xe_module.h"
struct pci_dev;
@@ -41,7 +42,12 @@ static inline u32 xe_configfs_get_ctx_restore_mid_bb(struct pci_dev *pdev, enum
const u32 **cs) { return 0; }
static inline u32 xe_configfs_get_ctx_restore_post_bb(struct pci_dev *pdev, enum xe_engine_class,
const u32 **cs) { return 0; }
-static inline unsigned int xe_configfs_get_max_vfs(struct pci_dev *pdev) { return UINT_MAX; }
+#ifdef CONFIG_PCI_IOV
+static inline unsigned int xe_configfs_get_max_vfs(struct pci_dev *pdev)
+{
+ return xe_modparam.max_vfs;
+}
+#endif
#endif
#endif
diff --git a/drivers/gpu/drm/xe/xe_sriov_pf.c b/drivers/gpu/drm/xe/xe_sriov_pf.c
index 6ce3c58e003c..33bd754d138f 100644
--- a/drivers/gpu/drm/xe/xe_sriov_pf.c
+++ b/drivers/gpu/drm/xe/xe_sriov_pf.c
@@ -22,9 +22,7 @@
static unsigned int wanted_max_vfs(struct xe_device *xe)
{
- if (IS_ENABLED(CONFIG_CONFIGFS_FS))
- return xe_configfs_get_max_vfs(to_pci_dev(xe->drm.dev));
- return xe_modparam.max_vfs;
+ return xe_configfs_get_max_vfs(to_pci_dev(xe->drm.dev));
}
static int pf_reduce_totalvfs(struct xe_device *xe, int limit)
--
2.47.1
next prev parent reply other threads:[~2026-01-21 21:42 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-21 21:42 [PATCH 0/5] drm/xe/configfs: Add sriov.admin_only_pf attribute Michal Wajdeczko
2026-01-21 21:42 ` [PATCH 1/5] drm/xe: Keep all defaults in single header Michal Wajdeczko
2026-01-23 10:29 ` Piotr Piórkowski
2026-02-03 0:11 ` Rodrigo Vivi
2026-02-03 11:13 ` Jani Nikula
2026-02-03 14:58 ` Michal Wajdeczko
2026-01-21 21:42 ` [PATCH 2/5] drm/xe/configfs: Use proper notation for local include Michal Wajdeczko
2026-01-23 10:29 ` Piotr Piórkowski
2026-01-21 21:42 ` Michal Wajdeczko [this message]
2026-01-28 15:51 ` [PATCH 3/5] drm/xe/configfs: Always return consistent max_vfs value Piotr Piórkowski
2026-01-21 21:42 ` [PATCH 4/5] drm/xe/pf: Define admin_only as real flag Michal Wajdeczko
2026-01-27 21:05 ` [PATCH v2 " Michal Wajdeczko
2026-01-28 15:56 ` Piotr Piórkowski
2026-01-21 21:42 ` [PATCH 5/5] drm/xe/configfs: Add sriov.admin_only_pf attribute Michal Wajdeczko
2026-01-28 16:35 ` Piotr Piórkowski
2026-01-28 23:42 ` Michal Wajdeczko
2026-01-21 22:25 ` ✗ CI.checkpatch: warning for " Patchwork
2026-01-21 22:26 ` ✗ CI.KUnit: failure " Patchwork
2026-01-27 21:34 ` ✗ CI.checkpatch: warning for drm/xe/configfs: Add sriov.admin_only_pf attribute (rev2) Patchwork
2026-01-27 21:35 ` ✓ CI.KUnit: success " Patchwork
2026-01-27 22:33 ` ✓ Xe.CI.BAT: " Patchwork
2026-01-28 6:46 ` ✓ Xe.CI.Full: " 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=20260121214218.2817-4-michal.wajdeczko@intel.com \
--to=michal.wajdeczko@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/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