xref: /linux/drivers/gpu/drm/xe/xe_configfs.h (revision c7decec2f2d2ab0366567f9e30c0e1418cece43f)
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_hw_engine_types.h>
12 
13 struct pci_dev;
14 
15 #if IS_ENABLED(CONFIG_CONFIGFS_FS)
16 int xe_configfs_init(void);
17 void xe_configfs_exit(void);
18 void xe_configfs_check_device(struct pci_dev *pdev);
19 bool xe_configfs_get_survivability_mode(struct pci_dev *pdev);
20 bool xe_configfs_primary_gt_allowed(struct pci_dev *pdev);
21 bool xe_configfs_media_gt_allowed(struct pci_dev *pdev);
22 u64 xe_configfs_get_engines_allowed(struct pci_dev *pdev);
23 bool xe_configfs_get_psmi_enabled(struct pci_dev *pdev);
24 u32 xe_configfs_get_ctx_restore_mid_bb(struct pci_dev *pdev,
25 				       enum xe_engine_class class,
26 				       const u32 **cs);
27 u32 xe_configfs_get_ctx_restore_post_bb(struct pci_dev *pdev,
28 					enum xe_engine_class class,
29 					const u32 **cs);
30 #ifdef CONFIG_PCI_IOV
31 unsigned int xe_configfs_get_max_vfs(struct pci_dev *pdev);
32 #endif
33 #else
34 static inline int xe_configfs_init(void) { return 0; }
35 static inline void xe_configfs_exit(void) { }
36 static inline void xe_configfs_check_device(struct pci_dev *pdev) { }
37 static inline bool xe_configfs_get_survivability_mode(struct pci_dev *pdev) { return false; }
38 static inline bool xe_configfs_primary_gt_allowed(struct pci_dev *pdev) { return true; }
39 static inline bool xe_configfs_media_gt_allowed(struct pci_dev *pdev) { return true; }
40 static inline u64 xe_configfs_get_engines_allowed(struct pci_dev *pdev) { return U64_MAX; }
41 static inline bool xe_configfs_get_psmi_enabled(struct pci_dev *pdev) { return false; }
42 static inline u32 xe_configfs_get_ctx_restore_mid_bb(struct pci_dev *pdev,
43 						     enum xe_engine_class class,
44 						     const u32 **cs) { return 0; }
45 static inline u32 xe_configfs_get_ctx_restore_post_bb(struct pci_dev *pdev,
46 						      enum xe_engine_class class,
47 						      const u32 **cs) { return 0; }
48 static inline unsigned int xe_configfs_get_max_vfs(struct pci_dev *pdev) { return UINT_MAX; }
49 #endif
50 
51 #endif
52