blob: df54cd5b15db09c1c02163d5f7d5493d184addb2 [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001/* 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 Deprez157378f2022-04-04 15:47:50 +02007#ifdef CONFIG_PCI_ATS
8/* Address Translation Service */
9bool pci_ats_supported(struct pci_dev *dev);
10int 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 */
15static inline bool pci_ats_supported(struct pci_dev *d)
16{ return false; }
17static 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 */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000025
Olivier Deprez157378f2022-04-04 15:47:50 +020026#ifdef CONFIG_PCI_PRI
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000027int pci_enable_pri(struct pci_dev *pdev, u32 reqs);
28void pci_disable_pri(struct pci_dev *pdev);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000029int pci_reset_pri(struct pci_dev *pdev);
Olivier Deprez157378f2022-04-04 15:47:50 +020030int pci_prg_resp_pasid_required(struct pci_dev *pdev);
31bool pci_pri_supported(struct pci_dev *pdev);
32#else
33static inline bool pci_pri_supported(struct pci_dev *pdev)
34{ return false; }
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000035#endif /* CONFIG_PCI_PRI */
36
37#ifdef CONFIG_PCI_PASID
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000038int pci_enable_pasid(struct pci_dev *pdev, int features);
39void pci_disable_pasid(struct pci_dev *pdev);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000040int pci_pasid_features(struct pci_dev *pdev);
41int pci_max_pasids(struct pci_dev *pdev);
Olivier Deprez157378f2022-04-04 15:47:50 +020042#else /* CONFIG_PCI_PASID */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000043static inline int pci_enable_pasid(struct pci_dev *pdev, int features)
Olivier Deprez157378f2022-04-04 15:47:50 +020044{ return -EINVAL; }
45static inline void pci_disable_pasid(struct pci_dev *pdev) { }
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000046static inline int pci_pasid_features(struct pci_dev *pdev)
Olivier Deprez157378f2022-04-04 15:47:50 +020047{ return -EINVAL; }
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000048static inline int pci_max_pasids(struct pci_dev *pdev)
Olivier Deprez157378f2022-04-04 15:47:50 +020049{ return -EINVAL; }
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000050#endif /* CONFIG_PCI_PASID */
51
Olivier Deprez157378f2022-04-04 15:47:50 +020052#endif /* LINUX_PCI_ATS_H */