1 /* SPDX-License-Identifier: MIT */ 2 /* 3 * Copyright © 2025 Intel Corporation 4 */ 5 #ifndef _XE_CONFIGFS_H_ 6 #define _XE_CONFIGFS_H_ 7 8 #include <linux/limits.h> 9 #include <linux/types.h> 10 11 #include "xe_defaults.h" 12 #include "xe_hw_engine_types.h" 13 #include "xe_module.h" 14 15 struct pci_dev; 16 17 #if IS_ENABLED(CONFIG_CONFIGFS_FS) 18 int xe_configfs_init(void); 19 void xe_configfs_exit(void); 20 void xe_configfs_check_device(struct pci_dev *pdev); 21 bool xe_configfs_get_survivability_mode(struct pci_dev *pdev); 22 bool xe_configfs_primary_gt_allowed(struct pci_dev *pdev); 23 bool xe_configfs_media_gt_allowed(struct pci_dev *pdev); 24 u64 xe_configfs_get_engines_allowed(struct pci_dev *pdev); 25 bool xe_configfs_get_psmi_enabled(struct pci_dev *pdev); 26 u32 xe_configfs_get_ctx_restore_mid_bb(struct pci_dev *pdev, 27 enum xe_engine_class class, 28 const u32 **cs); 29 u32 xe_configfs_get_ctx_restore_post_bb(struct pci_dev *pdev, 30 enum xe_engine_class class, 31 const u32 **cs); 32 #ifdef CONFIG_PCI_IOV 33 unsigned int xe_configfs_get_max_vfs(struct pci_dev *pdev); 34 bool xe_configfs_admin_only_pf(struct pci_dev *pdev); 35 #endif 36 #else 37 static inline int xe_configfs_init(void) { return 0; } 38 static inline void xe_configfs_exit(void) { } 39 static inline void xe_configfs_check_device(struct pci_dev *pdev) { } 40 static inline bool xe_configfs_get_survivability_mode(struct pci_dev *pdev) { return false; } 41 static inline bool xe_configfs_primary_gt_allowed(struct pci_dev *pdev) { return true; } 42 static inline bool xe_configfs_media_gt_allowed(struct pci_dev *pdev) { return true; } 43 static inline u64 xe_configfs_get_engines_allowed(struct pci_dev *pdev) { return U64_MAX; } 44 static inline bool xe_configfs_get_psmi_enabled(struct pci_dev *pdev) { return false; } 45 static inline u32 xe_configfs_get_ctx_restore_mid_bb(struct pci_dev *pdev, 46 enum xe_engine_class class, 47 const u32 **cs) { return 0; } 48 static inline u32 xe_configfs_get_ctx_restore_post_bb(struct pci_dev *pdev, 49 enum xe_engine_class class, 50 const u32 **cs) { return 0; } 51 #ifdef CONFIG_PCI_IOV 52 static inline unsigned int xe_configfs_get_max_vfs(struct pci_dev *pdev) 53 { 54 return xe_modparam.max_vfs; 55 } 56 static inline bool xe_configfs_admin_only_pf(struct pci_dev *pdev) 57 { 58 return XE_DEFAULT_ADMIN_ONLY_PF; 59 } 60 #endif 61 #endif 62 63 #endif 64