PCI: Move ATS declarations to linux/pci.h
PATCH 1/1 PCI: Move ATS declarations to linux/pci.h
Move ATS function prototypes from include/linux/pci-ats.h to include/linux/pci.h so users only need to include <linux/pci.h>:
Realted to PRI capability:
pci_enable_pri()
pci_disable_pri()
pci_restore_pri_state()
pci_reset_pri()
Related to PASID capability:
pci_enable_pasid()
pci_disable_pasid()
pci_restore_pasid_state()
pci_pasid_features()
pci_max_pasids()
pci_prg_resp_pasid_required()
No functional changes intended.
--- drivers/iommu/amd_iommu.c | 1 - drivers/iommu/arm-smmu-v3.c | 1 - drivers/iommu/intel-iommu.c | 1 - drivers/iommu/intel-pasid.c | 1 - drivers/iommu/intel-svm.c | 1 - drivers/pci/ats.c | 1 - drivers/pci/pci.c | 1 - include/linux/pci-ats.h | 77 ------------------------------------- include/linux/pci.h | 34 ++++++++++++++++ 9 files changed, 34 insertions(+), 84 deletions(-) delete mode 100644 include/linux/pci-ats.h
drivers/iommu/amd_iommu.c +0 -1
@@ -13,7 +13,6 @@#include <linux/acpi.h> #include <linux/amba/bus.h> #include <linux/platform_device.h> -#include <linux/pci-ats.h> #include <linux/bitmap.h> #include <linux/slab.h> #include <linux/debugfs.h>
drivers/iommu/arm-smmu-v3.c +0 -1
@@ -29,7 +29,6 @@#include <linux/of_iommu.h> #include <linux/of_platform.h> #include <linux/pci.h> -#include <linux/pci-ats.h> #include <linux/platform_device.h> #include <linux/amba/bus.h>
drivers/iommu/intel-iommu.c +0 -1
@@ -35,7 +35,6 @@#include <linux/syscore_ops.h> #include <linux/tboot.h> #include <linux/dmi.h> -#include <linux/pci-ats.h> #include <linux/memblock.h> #include <linux/dma-contiguous.h> #include <linux/dma-direct.h>
drivers/iommu/intel-pasid.c +0 -1
@@ -16,7 +16,6 @@#include <linux/iommu.h> #include <linux/memory.h> #include <linux/pci.h> -#include <linux/pci-ats.h> #include <linux/spinlock.h> #include "intel-pasid.h"
drivers/iommu/intel-svm.c +0 -1
@@ -13,7 +13,6 @@#include <linux/intel-svm.h> #include <linux/rculist.h> #include <linux/pci.h> -#include <linux/pci-ats.h> #include <linux/dmar.h> #include <linux/interrupt.h> #include <linux/mm_types.h>
drivers/pci/ats.c +0 -1
@@ -10,7 +10,6 @@*/ #include <linux/export.h> -#include <linux/pci-ats.h> #include <linux/pci.h> #include <linux/slab.h>
drivers/pci/pci.c +0 -1
@@ -29,7 +29,6 @@#include <linux/pm_runtime.h> #include <linux/pci_hotplug.h> #include <linux/vmalloc.h> -#include <linux/pci-ats.h> #include <asm/setup.h> #include <asm/dma.h> #include <linux/aer.h>
include/linux/pci-ats.h deleted +0 -77
77 lines not on this page · raw message
include/linux/pci.h +34 -0
@@ -2349,6 +2349,40 @@ static inline bool pci_is_thunderbolt_attached(struct pci_dev *pdev)void pci_uevent_ers (struct pci_dev *pdev,enum pci_ers_result err_type);#endif +#ifdef CONFIG_PCI_PRI +int pci_enable_pri (struct pci_dev *pdev,u32 reqs); +void pci_disable_pri (struct pci_dev *pdev); +void pci_restore_pri_state (struct pci_dev *pdev); +int pci_reset_pri (struct pci_dev *pdev); +#else /* CONFIG_PCI_PRI */ +static inline int pci_enable_pri (struct pci_dev *pdev,u32 reqs) +{return -ENODEV ; } +static inline void pci_disable_pri (struct pci_dev *pdev) { } +static inline void pci_restore_pri_state (struct pci_dev *pdev) { } +static inline int pci_reset_pri (struct pci_dev *pdev) +{return -ENODEV ; } +#endif /* CONFIG_PCI_PRI */ + +#ifdef CONFIG_PCI_PASID +int pci_enable_pasid (struct pci_dev *pdev,int features); +void pci_disable_pasid (struct pci_dev *pdev); +void pci_restore_pasid_state (struct pci_dev *pdev); +int pci_pasid_features (struct pci_dev *pdev); +int pci_max_pasids (struct pci_dev *pdev); +int pci_prg_resp_pasid_required (struct pci_dev *pdev); +#else /* CONFIG_PCI_PASID */ +static inline int pci_enable_pasid (struct pci_dev *pdev,int features) +{return -EINVAL ; } +static inline void pci_disable_pasid (struct pci_dev *pdev) { } +static inline void pci_restore_pasid_state (struct pci_dev *pdev) { } +static inline int pci_pasid_features (struct pci_dev *pdev) +{return -EINVAL ; } +static inline int pci_max_pasids (struct pci_dev *pdev) +{return -EINVAL ; } +static inline int pci_prg_resp_pasid_required (struct pci_dev *pdev) +{return 0 ; } +#endif /* CONFIG_PCI_PASID */ +/* Provide the legacy pci_dma_* API */ #include <linux/pci-dma-compat.h>
Signature · 1 line
2.22.1
Quoted 2 lines · Krzysztof Wilczynski
Move ATS function prototypes from
include/linux/pci-ats.htoinclude/linux/pci.hso users only need to include <linux/pci.h>:
Why is that so important? Very few PCI(e) device drivers use ATS, so keeping it out of everyones include hell doesn't seem all bad.
Robin Murphy
reviewerQuoted 6 lines · Christoph Hellwig
Quoted 2 lines · Krzysztof Wilczynski
Move ATS function prototypes from
include/linux/pci-ats.htoinclude/linux/pci.hso users only need to include <linux/pci.h>:Why is that so important? Very few PCI(e) device drivers use ATS, so keeping it out of everyones include hell doesn't seem all bad.
Although to be fair it seems that all the actual ATS stuff already moved out 4 years ago, so at the very least maybe it would warrant renaming to pci-pri-pasid.h :)
Robin.
Quoted 6 lines · Christoph Hellwig
Quoted 2 lines · Krzysztof Wilczynski
Move ATS function prototypes from
include/linux/pci-ats.htoinclude/linux/pci.hso users only need to include <linux/pci.h>:Why is that so important? Very few PCI(e) device drivers use ATS, so keeping it out of everyones include hell doesn't seem all bad.
This was my idea, and it wasn't a good one, sorry.
The ATS, PRI, and PASID interfaces are all sort of related and are used only by the IOMMU drivers, so it probably makes sense to put them all together. Right now the ATS stuff is in linux/pci.h and PRI/PASID stuff is in linux/pci-ats.h. Maybe the right thing would be to move the ATS stuff to pci-ats.h.
I previously moved it from pci-ats.h to pci.h with ff9bee895c4d ("PCI:
Move ATS declarations to linux/pci.h so they're all together") with the excuse of putting the external ATS interfaces next to pci_ats_init(). But that really looks like it was a mistake because pci_ats_init() is a PCI-internal thing and its declaration should probably be in drivers/pci/pci.h instead.
There's also a useless "struct pci_ats" forward declaration in linux/pci.h that I should have removed with d544d75ac96a ("PCI: Embed ATS info directly into struct pci_dev").
Bjorn
[+cc Kelsey]
Quoted 16 lines · Bjorn Helgaas
Quoted 6 lines · Christoph Hellwig
Quoted 2 lines · Krzysztof Wilczynski
Move ATS function prototypes from
include/linux/pci-ats.htoinclude/linux/pci.hso users only need to include <linux/pci.h>:Why is that so important? Very few PCI(e) device drivers use ATS, so keeping it out of everyones include hell doesn't seem all bad.
This was my idea, and it wasn't a good one, sorry.
The ATS, PRI, and PASID interfaces are all sort of related and are used only by the IOMMU drivers, so it probably makes sense to put them all together. Right now the ATS stuff is in
linux/pci.hand PRI/PASID stuff is inlinux/pci-ats.h. Maybe the right thing would be to move the ATS stuff topci-ats.h.
Quoted 6 lines
I previously moved it from
pci-ats.htopci.hwithff9bee895c4d("PCI:
Move ATS declarations tolinux/pci.hso they're all together") with the excuse of putting the external ATS interfaces next topci_ats_init(). But that really looks like it was a mistake becausepci_ats_init()is a PCI-internal thing and its declaration should probably be indrivers/pci/pci.hinstead.
Never mind the pci_ats_init() part; Kelsey has already moved that:
https://git.kernel.org/cgit/linux/kernel/git/helgaas/pci.git/commit/?id=b92b512a435d
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu