diff options
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/xen/swiotlb-xen.h | 2 | ||||
-rw-r--r-- | arch/x86/xen/pci-swiotlb-xen.c | 24 |
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 @@ | |||
5 | extern int xen_swiotlb; | 5 | extern int xen_swiotlb; |
6 | extern int __init pci_xen_swiotlb_detect(void); | 6 | extern int __init pci_xen_swiotlb_detect(void); |
7 | extern void __init pci_xen_swiotlb_init(void); | 7 | extern void __init pci_xen_swiotlb_init(void); |
8 | extern int pci_xen_swiotlb_init_late(void); | ||
8 | #else | 9 | #else |
9 | #define xen_swiotlb (0) | 10 | #define xen_swiotlb (0) |
10 | static inline int __init pci_xen_swiotlb_detect(void) { return 0; } | 11 | static inline int __init pci_xen_swiotlb_detect(void) { return 0; } |
11 | static inline void __init pci_xen_swiotlb_init(void) { } | 12 | static inline void __init pci_xen_swiotlb_init(void) { } |
13 | static 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> | |
16 | int xen_swiotlb __read_mostly; | 16 | int xen_swiotlb __read_mostly; |
17 | 17 | ||
18 | static struct dma_map_ops xen_swiotlb_dma_ops = { | 18 | static struct dma_map_ops xen_swiotlb_dma_ops = { |
@@ -69,13 +69,33 @@ int __init pci_xen_swiotlb_detect(void) | |||
69 | void __init pci_xen_swiotlb_init(void) | 69 | void __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 | |||
80 | int 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 | } | ||
97 | EXPORT_SYMBOL_GPL(pci_xen_swiotlb_init_late); | ||
98 | |||
79 | IOMMU_INIT_FINISH(pci_xen_swiotlb_detect, | 99 | IOMMU_INIT_FINISH(pci_xen_swiotlb_detect, |
80 | 0, | 100 | 0, |
81 | pci_xen_swiotlb_init, | 101 | pci_xen_swiotlb_init, |