From: Konrad Rzeszutek Wilk on
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.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk(a)>
Acked-by: Jeremy Fitzhardinge <jeremy.fitzhardinge(a)>
Cc: FUJITA Tomonori <fujita.tomonori(a)>
Cc: Albert Herranz <albert_herranz(a)>
Cc: Ian Campbell <Ian.Campbell(a)>
Cc: Thomas Gleixner <tglx(a)>
Cc: "H. Peter Anvin" <hpa(a)>
Cc: x86(a)
Cc: Jesse Barnes <jbarnes(a)>
arch/x86/kernel/pci-dma.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 4b7e3d8..9f07cfc 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -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 */

- if (pci_swiotlb_detect())
+ if (pci_xen_swiotlb_detect() || pci_swiotlb_detect())
goto out;

@@ -144,6 +145,8 @@ void __init pci_iommu_alloc(void)
/* needs to be called after gart_iommu_hole_init */
+ pci_xen_swiotlb_init();

@@ -296,7 +299,7 @@ static int __init pci_iommu_init(void)

- if (swiotlb) {
+ if (swiotlb || xen_swiotlb) {
printk(KERN_INFO "PCI-DMA: "
"Using software bounce buffering for IO (SWIOTLB)\n");

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)
More majordomo info at
Please read the FAQ at