xref: /linux/include/linux/pci-ats.h (revision eec91e22fe9f05846a7410beab671f26bef7ba7b)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef LINUX_PCI_ATS_H
3 #define LINUX_PCI_ATS_H
4 
5 #include <linux/pci.h>
6 
7 #ifdef CONFIG_PCI_ATS
8 /* Address Translation Service */
9 bool pci_ats_supported(struct pci_dev *dev);
10 int pci_enable_ats(struct pci_dev *dev, int ps);
11 int pci_prepare_ats(struct pci_dev *dev, int ps);
12 void pci_disable_ats(struct pci_dev *dev);
13 int pci_ats_queue_depth(struct pci_dev *dev);
14 int pci_ats_page_aligned(struct pci_dev *dev);
15 #else /* CONFIG_PCI_ATS */
16 static inline bool pci_ats_supported(struct pci_dev *d)
17 { return false; }
18 static inline int pci_enable_ats(struct pci_dev *d, int ps)
19 { return -ENODEV; }
20 static inline int pci_prepare_ats(struct pci_dev *dev, int ps)
21 { return -ENODEV; }
22 static inline void pci_disable_ats(struct pci_dev *d) { }
23 static inline int pci_ats_queue_depth(struct pci_dev *d)
24 { return -ENODEV; }
25 static inline int pci_ats_page_aligned(struct pci_dev *dev)
26 { return 0; }
27 #endif /* CONFIG_PCI_ATS */
28 
29 #ifdef CONFIG_PCI_PRI
30 int pci_enable_pri(struct pci_dev *pdev, u32 reqs);
31 void pci_disable_pri(struct pci_dev *pdev);
32 int pci_reset_pri(struct pci_dev *pdev);
33 int pci_prg_resp_pasid_required(struct pci_dev *pdev);
34 bool pci_pri_supported(struct pci_dev *pdev);
35 #else
36 static inline bool pci_pri_supported(struct pci_dev *pdev)
37 { return false; }
38 #endif /* CONFIG_PCI_PRI */
39 
40 #ifdef CONFIG_PCI_PASID
41 int pci_enable_pasid(struct pci_dev *pdev, int features);
42 void pci_disable_pasid(struct pci_dev *pdev);
43 int pci_pasid_features(struct pci_dev *pdev);
44 int pci_max_pasids(struct pci_dev *pdev);
45 #else /* CONFIG_PCI_PASID */
46 static inline int pci_enable_pasid(struct pci_dev *pdev, int features)
47 { return -EINVAL; }
48 static inline void pci_disable_pasid(struct pci_dev *pdev) { }
49 static inline int pci_pasid_features(struct pci_dev *pdev)
50 { return -EINVAL; }
51 static inline int pci_max_pasids(struct pci_dev *pdev)
52 { return -EINVAL; }
53 #endif /* CONFIG_PCI_PASID */
54 
55 #endif /* LINUX_PCI_ATS_H */
56