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: Add sriov.admin_only_pf attribute

Instead of relying on fixed relation to the display probe flag,
add configfs attribute to allow an administrator to configure
desired PF operation mode in a more flexible way.

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-6-michal.wajdeczko@intel.com

+69 -1
+61
drivers/gpu/drm/xe/xe_configfs.c
··· 264 264 bool enable_psmi; 265 265 struct { 266 266 unsigned int max_vfs; 267 + bool admin_only_pf; 267 268 } sriov; 268 269 } config; 269 270 ··· 283 282 .enable_psmi = false, 284 283 .sriov = { 285 284 .max_vfs = XE_DEFAULT_MAX_VFS, 285 + .admin_only_pf = XE_DEFAULT_ADMIN_ONLY_PF, 286 286 }, 287 287 }; 288 288 ··· 899 897 return len; 900 898 } 901 899 900 + static ssize_t sriov_admin_only_pf_show(struct config_item *item, char *page) 901 + { 902 + struct xe_config_group_device *dev = to_xe_config_group_device(item->ci_parent); 903 + 904 + guard(mutex)(&dev->lock); 905 + 906 + return sprintf(page, "%s\n", str_yes_no(dev->config.sriov.admin_only_pf)); 907 + } 908 + 909 + static ssize_t sriov_admin_only_pf_store(struct config_item *item, const char *page, size_t len) 910 + { 911 + struct xe_config_group_device *dev = to_xe_config_group_device(item->ci_parent); 912 + bool admin_only_pf; 913 + int ret; 914 + 915 + guard(mutex)(&dev->lock); 916 + 917 + if (is_bound(dev)) 918 + return -EBUSY; 919 + 920 + ret = kstrtobool(page, &admin_only_pf); 921 + if (ret) 922 + return ret; 923 + 924 + dev->config.sriov.admin_only_pf = admin_only_pf; 925 + return len; 926 + } 927 + 902 928 CONFIGFS_ATTR(sriov_, max_vfs); 929 + CONFIGFS_ATTR(sriov_, admin_only_pf); 903 930 904 931 static struct configfs_attribute *xe_config_sriov_attrs[] = { 905 932 &sriov_attr_max_vfs, 933 + &sriov_attr_admin_only_pf, 906 934 NULL, 907 935 }; 908 936 ··· 942 910 struct xe_config_group_device *dev = to_xe_config_group_device(item->ci_parent); 943 911 944 912 if (attr == &sriov_attr_max_vfs && dev->mode != XE_SRIOV_MODE_PF) 913 + return false; 914 + if (attr == &sriov_attr_admin_only_pf && dev->mode != XE_SRIOV_MODE_PF) 945 915 return false; 946 916 947 917 return true; ··· 1098 1064 PRI_CUSTOM_ATTR("%llx", engines_allowed); 1099 1065 PRI_CUSTOM_ATTR("%d", enable_psmi); 1100 1066 PRI_CUSTOM_ATTR("%d", survivability_mode); 1067 + PRI_CUSTOM_ATTR("%u", sriov.admin_only_pf); 1101 1068 1102 1069 #undef PRI_CUSTOM_ATTR 1103 1070 } ··· 1277 1242 } 1278 1243 1279 1244 #ifdef CONFIG_PCI_IOV 1245 + /** 1246 + * xe_configfs_admin_only_pf() - Get PF's operational mode. 1247 + * @pdev: the &pci_dev device 1248 + * 1249 + * Find the configfs group that belongs to the PCI device and return a flag 1250 + * whether the PF driver should be dedicated for VFs management only. 1251 + * 1252 + * If configfs group is not present, use driver's default value. 1253 + * 1254 + * Return: true if PF driver is dedicated for VFs administration only. 1255 + */ 1256 + bool xe_configfs_admin_only_pf(struct pci_dev *pdev) 1257 + { 1258 + struct xe_config_group_device *dev = find_xe_config_group_device(pdev); 1259 + bool admin_only_pf; 1260 + 1261 + if (!dev) 1262 + return XE_DEFAULT_ADMIN_ONLY_PF; 1263 + 1264 + scoped_guard(mutex, &dev->lock) 1265 + admin_only_pf = dev->config.sriov.admin_only_pf; 1266 + 1267 + config_group_put(&dev->group); 1268 + 1269 + return admin_only_pf; 1270 + } 1280 1271 /** 1281 1272 * xe_configfs_get_max_vfs() - Get number of VFs that could be managed 1282 1273 * @pdev: the &pci_dev device
+6
drivers/gpu/drm/xe/xe_configfs.h
··· 8 8 #include <linux/limits.h> 9 9 #include <linux/types.h> 10 10 11 + #include "xe_defaults.h" 11 12 #include "xe_hw_engine_types.h" 12 13 #include "xe_module.h" 13 14 ··· 29 28 const u32 **cs); 30 29 #ifdef CONFIG_PCI_IOV 31 30 unsigned int xe_configfs_get_max_vfs(struct pci_dev *pdev); 31 + bool xe_configfs_admin_only_pf(struct pci_dev *pdev); 32 32 #endif 33 33 #else 34 34 static inline int xe_configfs_init(void) { return 0; } ··· 48 46 static inline unsigned int xe_configfs_get_max_vfs(struct pci_dev *pdev) 49 47 { 50 48 return xe_modparam.max_vfs; 49 + } 50 + static inline bool xe_configfs_admin_only_pf(struct pci_dev *pdev) 51 + { 52 + return XE_DEFAULT_ADMIN_ONLY_PF; 51 53 } 52 54 #endif 53 55 #endif
+1
drivers/gpu/drm/xe/xe_defaults.h
··· 18 18 #define XE_DEFAULT_FORCE_PROBE CONFIG_DRM_XE_FORCE_PROBE 19 19 #define XE_DEFAULT_MAX_VFS ~0 20 20 #define XE_DEFAULT_MAX_VFS_STR "unlimited" 21 + #define XE_DEFAULT_ADMIN_ONLY_PF false 21 22 #define XE_DEFAULT_WEDGED_MODE XE_WEDGED_MODE_UPON_CRITICAL_ERROR 22 23 #define XE_DEFAULT_WEDGED_MODE_STR "upon-critical-error" 23 24 #define XE_DEFAULT_SVM_NOTIFIER_SIZE 512
+1 -1
drivers/gpu/drm/xe/xe_sriov_pf.c
··· 22 22 23 23 static bool wanted_admin_only(struct xe_device *xe) 24 24 { 25 - return !xe->info.probe_display; 25 + return xe_configfs_admin_only_pf(to_pci_dev(xe->drm.dev)); 26 26 } 27 27 28 28 static unsigned int wanted_max_vfs(struct xe_device *xe)