aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/include/asm/xen/swiotlb-xen.h2
-rw-r--r--arch/x86/xen/pci-swiotlb-xen.c24
2 files changed, 24 insertions, 2 deletions
diff --git a/arch/x86/include/asm/xen/swiotlb-xen.h b/arch/x86/include/asm/xen/swiotlb-xen.h
index 1be1ab7d6a41..ee52fcac6f72 100644
--- a/arch/x86/include/asm/xen/swiotlb-xen.h
+++ b/arch/x86/include/asm/xen/swiotlb-xen.h
@@ -5,10 +5,12 @@
5extern int xen_swiotlb; 5extern int xen_swiotlb;
6extern int __init pci_xen_swiotlb_detect(void); 6extern int __init pci_xen_swiotlb_detect(void);
7extern void __init pci_xen_swiotlb_init(void); 7extern void __init pci_xen_swiotlb_init(void);
8extern int pci_xen_swiotlb_init_late(void);
8#else 9#else
9#define xen_swiotlb (0) 10#define xen_swiotlb (0)
10static inline int __init pci_xen_swiotlb_detect(void) { return 0; } 11static inline int __init pci_xen_swiotlb_detect(void) { return 0; }
11static inline void __init pci_xen_swiotlb_init(void) { } 12static inline void __init pci_xen_swiotlb_init(void) { }
13static inline int pci_xen_swiotlb_init_late(void) { return -ENXIO; }
12#endif 14#endif
13 15
14#endif /* _ASM_X86_SWIOTLB_XEN_H */ 16#endif /* _ASM_X86_SWIOTLB_XEN_H */
diff --git a/arch/x86/xen/pci-swiotlb-xen.c b/arch/x86/xen/pci-swiotlb-xen.c
index 1c1722761eec..b152640d8388 100644
--- a/arch/x86/xen/pci-swiotlb-xen.c
+++ b/arch/x86/xen/pci-swiotlb-xen.c
@@ -12,7 +12,7 @@
12#include <asm/iommu.h> 12#include <asm/iommu.h>
13#include <asm/dma.h> 13#include <asm/dma.h>
14#endif 14#endif
15 15#include <linux/export.h>
16int xen_swiotlb __read_mostly; 16int xen_swiotlb __read_mostly;
17 17
18static struct dma_map_ops xen_swiotlb_dma_ops = { 18static struct dma_map_ops xen_swiotlb_dma_ops = {
@@ -69,13 +69,33 @@ int __init pci_xen_swiotlb_detect(void)
69void __init pci_xen_swiotlb_init(void) 69void __init pci_xen_swiotlb_init(void)
70{ 70{
71 if (xen_swiotlb) { 71 if (xen_swiotlb) {
72 xen_swiotlb_init(1); 72 xen_swiotlb_init(1, true /* early */);
73 dma_ops = &xen_swiotlb_dma_ops; 73 dma_ops = &xen_swiotlb_dma_ops;
74 74
75 /* Make sure ACS will be enabled */ 75 /* Make sure ACS will be enabled */
76 pci_request_acs(); 76 pci_request_acs();
77 } 77 }
78} 78}
79
80int pci_xen_swiotlb_init_late(void)
81{
82 int rc;
83
84 if (xen_swiotlb)
85 return 0;
86
87 rc = xen_swiotlb_init(1, false /* late */);
88 if (rc)
89 return rc;
90
91 dma_ops = &xen_swiotlb_dma_ops;
92 /* Make sure ACS will be enabled */
93 pci_request_acs();
94
95 return 0;
96}
97EXPORT_SYMBOL_GPL(pci_xen_swiotlb_init_late);
98
79IOMMU_INIT_FINISH(pci_xen_swiotlb_detect, 99IOMMU_INIT_FINISH(pci_xen_swiotlb_detect,
80 0, 100 0,
81 pci_xen_swiotlb_init, 101 pci_xen_swiotlb_init,