xref: /linux/drivers/gpu/drm/xe/xe_configfs.h (revision 3a2c4d55e32ad65efebdb6de44eef3bfa08bb49d)
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 bool xe_configfs_get_enable_multi_queue(struct pci_dev *pdev);
27 u32 xe_configfs_get_ctx_restore_mid_bb(struct pci_dev *pdev,
28 				       enum xe_engine_class class,
29 				       const u32 **cs);
30 u32 xe_configfs_get_ctx_restore_post_bb(struct pci_dev *pdev,
31 					enum xe_engine_class class,
32 					const u32 **cs);
33 #ifdef CONFIG_PCI_IOV
34 unsigned int xe_configfs_get_max_vfs(struct pci_dev *pdev);
35 bool xe_configfs_admin_only_pf(struct pci_dev *pdev);
36 #endif
37 #else
38 static inline int xe_configfs_init(void) { return 0; }
39 static inline void xe_configfs_exit(void) { }
40 static inline void xe_configfs_check_device(struct pci_dev *pdev) { }
41 static inline bool xe_configfs_get_survivability_mode(struct pci_dev *pdev) { return false; }
42 static inline bool xe_configfs_primary_gt_allowed(struct pci_dev *pdev) { return true; }
43 static inline bool xe_configfs_media_gt_allowed(struct pci_dev *pdev) { return true; }
44 static inline u64 xe_configfs_get_engines_allowed(struct pci_dev *pdev) { return U64_MAX; }
45 static inline bool xe_configfs_get_psmi_enabled(struct pci_dev *pdev) { return false; }
46 static inline bool xe_configfs_get_enable_multi_queue(struct pci_dev *pdev) { return true; }
47 static inline u32 xe_configfs_get_ctx_restore_mid_bb(struct pci_dev *pdev,
48 						     enum xe_engine_class class,
49 						     const u32 **cs) { return 0; }
50 static inline u32 xe_configfs_get_ctx_restore_post_bb(struct pci_dev *pdev,
51 						      enum xe_engine_class class,
52 						      const u32 **cs) { return 0; }
53 #ifdef CONFIG_PCI_IOV
54 static inline unsigned int xe_configfs_get_max_vfs(struct pci_dev *pdev)
55 {
56 	return xe_modparam.max_vfs;
57 }
58 static inline bool xe_configfs_admin_only_pf(struct pci_dev *pdev)
59 {
60 	return XE_DEFAULT_ADMIN_ONLY_PF;
61 }
62 #endif
63 #endif
64 
65 #endif
66