]> rtime.felk.cvut.cz Git - lisovros/linux_canprio.git/commitdiff
x86: Detect whether we should use Xen SWIOTLB.
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 18 Mar 2010 17:53:24 +0000 (13:53 -0400)
committerKonrad Rzeszutek Wilk <konrad@kernel.org>
Mon, 2 Aug 2010 19:18:33 +0000 (15:18 -0400)
It is paramount that we call pci_xen_swiotlb_detect before
pci_swiotlb_detect as both implementations use the 'swiotlb'
and 'swiotlb_force' flags. The pci-xen_swiotlb_detect inhibits
the swiotlb_force and swiotlb flag so that the native SWIOTLB
implementation is not enabled when running under Xen.

[since v1 changed two Cc's to Acked-by]

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Acked-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
    [http://lkml.org/lkml/2010/7/27/374]
Cc: Albert Herranz <albert_herranz@yahoo.es>
Cc: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Acked-by: "H. Peter Anvin" <hpa@zytor.com>
    [conditional http://lkml.org/lkml/2010/8/2/324]
Cc: x86@kernel.org
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
arch/x86/kernel/pci-dma.c

index 4b7e3d8b01ddfdeb5b1e49bbdfc4519e2b102ac1..9f07cfcbd3a5e60db651c952c9a66fa21dd68d87 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();