Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+10 -5
+2 -1
drivers/gpu/drm/xe/xe_configfs.c
··· 15 15 16 16 #include "instructions/xe_mi_commands.h" 17 17 #include "xe_configfs.h" 18 + #include "xe_defaults.h" 18 19 #include "xe_gt_types.h" 19 20 #include "xe_hw_engine_types.h" 20 21 #include "xe_module.h" ··· 281 280 .survivability_mode = false, 282 281 .enable_psmi = false, 283 282 .sriov = { 284 - .max_vfs = UINT_MAX, 283 + .max_vfs = XE_DEFAULT_MAX_VFS, 285 284 }, 286 285 }; 287 286
+7 -1
drivers/gpu/drm/xe/xe_configfs.h
··· 9 9 #include <linux/types.h> 10 10 11 11 #include "xe_hw_engine_types.h" 12 + #include "xe_module.h" 12 13 13 14 struct pci_dev; 14 15 ··· 42 41 const u32 **cs) { return 0; } 43 42 static inline u32 xe_configfs_get_ctx_restore_post_bb(struct pci_dev *pdev, enum xe_engine_class, 44 43 const u32 **cs) { return 0; } 45 - static inline unsigned int xe_configfs_get_max_vfs(struct pci_dev *pdev) { return UINT_MAX; } 44 + #ifdef CONFIG_PCI_IOV 45 + static inline unsigned int xe_configfs_get_max_vfs(struct pci_dev *pdev) 46 + { 47 + return xe_modparam.max_vfs; 48 + } 49 + #endif 46 50 #endif 47 51 48 52 #endif
+1 -3
drivers/gpu/drm/xe/xe_sriov_pf.c
··· 22 22 23 23 static unsigned int wanted_max_vfs(struct xe_device *xe) 24 24 { 25 - if (IS_ENABLED(CONFIG_CONFIGFS_FS)) 26 - return xe_configfs_get_max_vfs(to_pci_dev(xe->drm.dev)); 27 - return xe_modparam.max_vfs; 25 + return xe_configfs_get_max_vfs(to_pci_dev(xe->drm.dev)); 28 26 } 29 27 30 28 static int pf_reduce_totalvfs(struct xe_device *xe, int limit)