x86: Detect whether we should use Xen SWIOTLB.
[platform/adaptation/renesas_rcar/renesas_kernel.git] / arch / x86 / kernel / pci-dma.c
index 4b7e3d8..9f07cfc 100644 (file)
@@ -13,6 +13,7 @@
 #include <asm/calgary.h>
 #include <asm/amd_iommu.h>
 #include <asm/x86_init.h>
+#include <asm/xen/swiotlb-xen.h>
 
 static int forbid_dac __read_mostly;
 
@@ -132,7 +133,7 @@ void __init pci_iommu_alloc(void)
        /* free the range so iommu could get some range less than 4G */
        dma32_free_bootmem();
 
-       if (pci_swiotlb_detect())
+       if (pci_xen_swiotlb_detect() || pci_swiotlb_detect())
                goto out;
 
        gart_iommu_hole_init();
@@ -144,6 +145,8 @@ void __init pci_iommu_alloc(void)
        /* needs to be called after gart_iommu_hole_init */
        amd_iommu_detect();
 out:
+       pci_xen_swiotlb_init();
+
        pci_swiotlb_init();
 }
 
@@ -296,7 +299,7 @@ static int __init pci_iommu_init(void)
 #endif
        x86_init.iommu.iommu_init();
 
-       if (swiotlb) {
+       if (swiotlb || xen_swiotlb) {
                printk(KERN_INFO "PCI-DMA: "
                       "Using software bounce buffering for IO (SWIOTLB)\n");
                swiotlb_print_info();