diff options
| author | Michal Wajdeczko <michal.wajdeczko@intel.com> | 2026-01-22 00:42:14 +0300 |
|---|---|---|
| committer | Michal Wajdeczko <michal.wajdeczko@intel.com> | 2026-02-03 14:02:05 +0300 |
| commit | 0dfc7306b9600127afce5dbcb53389ca72237031 (patch) | |
| tree | 9b8721a8802770c4b0fc2e4e24085fd11eb75746 | |
| parent | 56dfa9fc39f0d03ca165f84382d088825f5e5404 (diff) | |
| download | linux-0dfc7306b9600127afce5dbcb53389ca72237031.tar.xz | |
drm/xe/configfs: Always return consistent max_vfs value
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>
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patch.msgid.link/20260121214218.2817-4-michal.wajdeczko@intel.com
| -rw-r--r-- | drivers/gpu/drm/xe/xe_configfs.c | 3 | ||||
| -rw-r--r-- | drivers/gpu/drm/xe/xe_configfs.h | 8 | ||||
| -rw-r--r-- | 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 82edd0466005..5a54ca67d3dc 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) |
