Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 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 | |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 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 | void pci_disable_ats(struct pci_dev *dev); |
| 12 | int pci_ats_queue_depth(struct pci_dev *dev); |
| 13 | int pci_ats_page_aligned(struct pci_dev *dev); |
| 14 | #else /* CONFIG_PCI_ATS */ |
| 15 | static inline bool pci_ats_supported(struct pci_dev *d) |
| 16 | { return false; } |
| 17 | static inline int pci_enable_ats(struct pci_dev *d, int ps) |
| 18 | { return -ENODEV; } |
| 19 | static inline void pci_disable_ats(struct pci_dev *d) { } |
| 20 | static inline int pci_ats_queue_depth(struct pci_dev *d) |
| 21 | { return -ENODEV; } |
| 22 | static inline int pci_ats_page_aligned(struct pci_dev *dev) |
| 23 | { return 0; } |
| 24 | #endif /* CONFIG_PCI_ATS */ |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 25 | |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 26 | #ifdef CONFIG_PCI_PRI |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 27 | int pci_enable_pri(struct pci_dev *pdev, u32 reqs); |
| 28 | void pci_disable_pri(struct pci_dev *pdev); |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 29 | int pci_reset_pri(struct pci_dev *pdev); |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 30 | int pci_prg_resp_pasid_required(struct pci_dev *pdev); |
| 31 | bool pci_pri_supported(struct pci_dev *pdev); |
| 32 | #else |
| 33 | static inline bool pci_pri_supported(struct pci_dev *pdev) |
| 34 | { return false; } |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 35 | #endif /* CONFIG_PCI_PRI */ |
| 36 | |
| 37 | #ifdef CONFIG_PCI_PASID |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 38 | int pci_enable_pasid(struct pci_dev *pdev, int features); |
| 39 | void pci_disable_pasid(struct pci_dev *pdev); |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 40 | int pci_pasid_features(struct pci_dev *pdev); |
| 41 | int pci_max_pasids(struct pci_dev *pdev); |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 42 | #else /* CONFIG_PCI_PASID */ |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 43 | static inline int pci_enable_pasid(struct pci_dev *pdev, int features) |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 44 | { return -EINVAL; } |
| 45 | static inline void pci_disable_pasid(struct pci_dev *pdev) { } |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 46 | static inline int pci_pasid_features(struct pci_dev *pdev) |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 47 | { return -EINVAL; } |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 48 | static inline int pci_max_pasids(struct pci_dev *pdev) |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 49 | { return -EINVAL; } |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 50 | #endif /* CONFIG_PCI_PASID */ |
| 51 | |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 52 | #endif /* LINUX_PCI_ATS_H */ |