Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Joerg Roedel | 5cdede2 | 2011-04-04 15:55:18 +0200 | [diff] [blame] | 2 | #ifndef LINUX_PCI_ATS_H |
| 3 | #define LINUX_PCI_ATS_H |
| 4 | |
Joerg Roedel | db3c33c | 2011-09-27 15:57:13 +0200 | [diff] [blame] | 5 | #include <linux/pci.h> |
| 6 | |
Krzysztof Wilczynski | b24d5c2 | 2019-09-14 23:30:32 +0200 | [diff] [blame] | 7 | #ifdef CONFIG_PCI_ATS |
| 8 | /* Address Translation Service */ |
Jean-Philippe Brucker | 5213767 | 2020-05-20 17:22:00 +0200 | [diff] [blame] | 9 | bool pci_ats_supported(struct pci_dev *dev); |
Krzysztof Wilczynski | b24d5c2 | 2019-09-14 23:30:32 +0200 | [diff] [blame] | 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 */ |
Jean-Philippe Brucker | 5213767 | 2020-05-20 17:22:00 +0200 | [diff] [blame] | 15 | static inline bool pci_ats_supported(struct pci_dev *d) |
| 16 | { return false; } |
Krzysztof Wilczynski | b24d5c2 | 2019-09-14 23:30:32 +0200 | [diff] [blame] | 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 */ |
Joerg Roedel | c320b97 | 2011-09-27 15:57:15 +0200 | [diff] [blame] | 25 | |
Krzysztof Wilczynski | b24d5c2 | 2019-09-14 23:30:32 +0200 | [diff] [blame] | 26 | #ifdef CONFIG_PCI_PRI |
Bjorn Helgaas | f39d5b7 | 2013-04-12 12:02:59 -0600 | [diff] [blame] | 27 | int pci_enable_pri(struct pci_dev *pdev, u32 reqs); |
| 28 | void pci_disable_pri(struct pci_dev *pdev); |
Bjorn Helgaas | f39d5b7 | 2013-04-12 12:02:59 -0600 | [diff] [blame] | 29 | int pci_reset_pri(struct pci_dev *pdev); |
Bjorn Helgaas | 8cbb8a9 | 2019-10-09 14:54:01 -0500 | [diff] [blame] | 30 | int pci_prg_resp_pasid_required(struct pci_dev *pdev); |
Ashok Raj | 3f9a7a1 | 2020-07-23 15:37:29 -0700 | [diff] [blame] | 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; } |
Joerg Roedel | c320b97 | 2011-09-27 15:57:15 +0200 | [diff] [blame] | 35 | #endif /* CONFIG_PCI_PRI */ |
| 36 | |
Joerg Roedel | 086ac11 | 2011-09-27 15:57:16 +0200 | [diff] [blame] | 37 | #ifdef CONFIG_PCI_PASID |
Bjorn Helgaas | f39d5b7 | 2013-04-12 12:02:59 -0600 | [diff] [blame] | 38 | int pci_enable_pasid(struct pci_dev *pdev, int features); |
| 39 | void pci_disable_pasid(struct pci_dev *pdev); |
| 40 | int pci_pasid_features(struct pci_dev *pdev); |
| 41 | int pci_max_pasids(struct pci_dev *pdev); |
Krzysztof Wilczynski | b24d5c2 | 2019-09-14 23:30:32 +0200 | [diff] [blame] | 42 | #else /* CONFIG_PCI_PASID */ |
Jean-Philippe Brucker | 5a4549f | 2020-01-15 13:52:38 +0100 | [diff] [blame] | 43 | static inline int pci_enable_pasid(struct pci_dev *pdev, int features) |
| 44 | { return -EINVAL; } |
| 45 | static inline void pci_disable_pasid(struct pci_dev *pdev) { } |
Joerg Roedel | 086ac11 | 2011-09-27 15:57:16 +0200 | [diff] [blame] | 46 | static inline int pci_pasid_features(struct pci_dev *pdev) |
Krzysztof Wilczynski | b24d5c2 | 2019-09-14 23:30:32 +0200 | [diff] [blame] | 47 | { return -EINVAL; } |
Joerg Roedel | 086ac11 | 2011-09-27 15:57:16 +0200 | [diff] [blame] | 48 | static inline int pci_max_pasids(struct pci_dev *pdev) |
Krzysztof Wilczynski | b24d5c2 | 2019-09-14 23:30:32 +0200 | [diff] [blame] | 49 | { return -EINVAL; } |
Joerg Roedel | 086ac11 | 2011-09-27 15:57:16 +0200 | [diff] [blame] | 50 | #endif /* CONFIG_PCI_PASID */ |
| 51 | |
Krzysztof Wilczynski | b24d5c2 | 2019-09-14 23:30:32 +0200 | [diff] [blame] | 52 | #endif /* LINUX_PCI_ATS_H */ |