aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/xen/pci-swiotlb-xen.c
diff options
context:
space:
mode:
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2012-08-23 14:36:15 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2012-09-17 12:58:16 -0400
commitb82776005369899c1c7ca2e4b2414bb64b538d2c (patch)
treeb07bb5fc8cd2b335f46a43791f0fc7505a57d4ac /arch/x86/xen/pci-swiotlb-xen.c
parent5bab7864b1167f9a72d375f6854027db436a1cc1 (diff)
xen/swiotlb: Use the swiotlb_late_init_with_tbl to init Xen-SWIOTLB late when PV PCI is used.
With this patch we provide the functionality to initialize the Xen-SWIOTLB late in the bootup cycle - specifically for Xen PCI-frontend. We still will work if the user had supplied 'iommu=soft' on the Linux command line. Note: We cannot depend on after_bootmem to automatically determine whether this is early or not. This is because when PCI IOMMUs are initialized it is after after_bootmem but before a lot of "other" subsystems are initialized. CC: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [v1: Fix smatch warnings] [v2: Added check for xen_swiotlb] [v3: Rebased with new xen-swiotlb changes] [v4: squashed xen/swiotlb: Depending on after_bootmem is not correct in] Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'arch/x86/xen/pci-swiotlb-xen.c')
-rw-r--r--arch/x86/xen/pci-swiotlb-xen.c24
1 files changed, 22 insertions, 2 deletions
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,