blob: df54cd5b15db09c1c02163d5f7d5493d184addb2 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Joerg Roedel5cdede22011-04-04 15:55:18 +02002#ifndef LINUX_PCI_ATS_H
3#define LINUX_PCI_ATS_H
4
Joerg Roedeldb3c33c2011-09-27 15:57:13 +02005#include <linux/pci.h>
6
Krzysztof Wilczynskib24d5c22019-09-14 23:30:32 +02007#ifdef CONFIG_PCI_ATS
8/* Address Translation Service */
Jean-Philippe Brucker52137672020-05-20 17:22:00 +02009bool pci_ats_supported(struct pci_dev *dev);
Krzysztof Wilczynskib24d5c22019-09-14 23:30:32 +020010int pci_enable_ats(struct pci_dev *dev, int ps);
11void pci_disable_ats(struct pci_dev *dev);
12int pci_ats_queue_depth(struct pci_dev *dev);
13int pci_ats_page_aligned(struct pci_dev *dev);
14#else /* CONFIG_PCI_ATS */
Jean-Philippe Brucker52137672020-05-20 17:22:00 +020015static inline bool pci_ats_supported(struct pci_dev *d)
16{ return false; }
Krzysztof Wilczynskib24d5c22019-09-14 23:30:32 +020017static inline int pci_enable_ats(struct pci_dev *d, int ps)
18{ return -ENODEV; }
19static inline void pci_disable_ats(struct pci_dev *d) { }
20static inline int pci_ats_queue_depth(struct pci_dev *d)
21{ return -ENODEV; }
22static inline int pci_ats_page_aligned(struct pci_dev *dev)
23{ return 0; }
24#endif /* CONFIG_PCI_ATS */
Joerg Roedelc320b972011-09-27 15:57:15 +020025
Krzysztof Wilczynskib24d5c22019-09-14 23:30:32 +020026#ifdef CONFIG_PCI_PRI
Bjorn Helgaasf39d5b72013-04-12 12:02:59 -060027int pci_enable_pri(struct pci_dev *pdev, u32 reqs);
28void pci_disable_pri(struct pci_dev *pdev);
Bjorn Helgaasf39d5b72013-04-12 12:02:59 -060029int pci_reset_pri(struct pci_dev *pdev);
Bjorn Helgaas8cbb8a92019-10-09 14:54:01 -050030int pci_prg_resp_pasid_required(struct pci_dev *pdev);
Ashok Raj3f9a7a12020-07-23 15:37:29 -070031bool pci_pri_supported(struct pci_dev *pdev);
32#else
33static inline bool pci_pri_supported(struct pci_dev *pdev)
34{ return false; }
Joerg Roedelc320b972011-09-27 15:57:15 +020035#endif /* CONFIG_PCI_PRI */
36
Joerg Roedel086ac112011-09-27 15:57:16 +020037#ifdef CONFIG_PCI_PASID
Bjorn Helgaasf39d5b72013-04-12 12:02:59 -060038int pci_enable_pasid(struct pci_dev *pdev, int features);
39void pci_disable_pasid(struct pci_dev *pdev);
40int pci_pasid_features(struct pci_dev *pdev);
41int pci_max_pasids(struct pci_dev *pdev);
Krzysztof Wilczynskib24d5c22019-09-14 23:30:32 +020042#else /* CONFIG_PCI_PASID */
Jean-Philippe Brucker5a4549f2020-01-15 13:52:38 +010043static inline int pci_enable_pasid(struct pci_dev *pdev, int features)
44{ return -EINVAL; }
45static inline void pci_disable_pasid(struct pci_dev *pdev) { }
Joerg Roedel086ac112011-09-27 15:57:16 +020046static inline int pci_pasid_features(struct pci_dev *pdev)
Krzysztof Wilczynskib24d5c22019-09-14 23:30:32 +020047{ return -EINVAL; }
Joerg Roedel086ac112011-09-27 15:57:16 +020048static inline int pci_max_pasids(struct pci_dev *pdev)
Krzysztof Wilczynskib24d5c22019-09-14 23:30:32 +020049{ return -EINVAL; }
Joerg Roedel086ac112011-09-27 15:57:16 +020050#endif /* CONFIG_PCI_PASID */
51
Krzysztof Wilczynskib24d5c22019-09-14 23:30:32 +020052#endif /* LINUX_PCI_ATS_H */