PCI ATS functionality is not enabled and tested for ARM architecture but it is enabled for x86 and referenced in common passthrough/pci.c code.
Therefore introducing the new flag to enable the ATS functionality for x86 only to avoid issues for ARM architecture. No functional change. Signed-off-by: Rahul Singh <rahul.si...@arm.com> --- Changes in v2: - Fixed return value of PCI ATS related functions when PCI_ATS is not enabled. - Make PCI_ATS user selectable kconfig option. --- xen/drivers/passthrough/ats.h | 26 ++++++++++++++++++++++++++ xen/drivers/passthrough/x86/Makefile | 2 +- xen/drivers/pci/Kconfig | 9 +++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/xen/drivers/passthrough/ats.h b/xen/drivers/passthrough/ats.h index 22ae209b37..3a71fedcb4 100644 --- a/xen/drivers/passthrough/ats.h +++ b/xen/drivers/passthrough/ats.h @@ -17,6 +17,8 @@ #include <xen/pci_regs.h> +#ifdef CONFIG_PCI_ATS + #define ATS_REG_CAP 4 #define ATS_REG_CTL 6 #define ATS_QUEUE_DEPTH_MASK 0x1f @@ -48,5 +50,29 @@ static inline int pci_ats_device(int seg, int bus, int devfn) return pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS); } +#else + +#define ats_enabled (false) + +static inline int enable_ats_device(struct pci_dev *pdev, + struct list_head *ats_list) +{ + return -EOPNOTSUPP; +} + +static inline void disable_ats_device(struct pci_dev *pdev) { } + +static inline int pci_ats_enabled(int seg, int bus, int devfn) +{ + return 0; +} + +static inline int pci_ats_device(int seg, int bus, int devfn) +{ + return 0; +} + +#endif /* CONFIG_PCI_ATS */ + #endif /* _ATS_H_ */ diff --git a/xen/drivers/passthrough/x86/Makefile b/xen/drivers/passthrough/x86/Makefile index a70cf9460d..aa515c680d 100644 --- a/xen/drivers/passthrough/x86/Makefile +++ b/xen/drivers/passthrough/x86/Makefile @@ -1,2 +1,2 @@ -obj-y += ats.o +obj-$(CONFIG_PCI_ATS) += ats.o obj-y += iommu.o diff --git a/xen/drivers/pci/Kconfig b/xen/drivers/pci/Kconfig index 7da03fa13b..3cb79ea954 100644 --- a/xen/drivers/pci/Kconfig +++ b/xen/drivers/pci/Kconfig @@ -1,3 +1,12 @@ config HAS_PCI bool + +config PCI_ATS + bool "PCI ATS support" + default y + depends on X86 && HAS_PCI + ---help--- + Enable PCI Address Translation Services. + + If unsure, say Y. -- 2.17.1