From: Ian Campbell Date: Mon, 9 Feb 2009 20:05:53 +0000 (-0800) Subject: xen: enable swiotlb for xen domain 0. X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e1635c08b96f888c5f77af7d69ecbc449a27c9c8;p=people%2Fssmith%2Fnetchannel2-pvops.git xen: enable swiotlb for xen domain 0. Enable swiotlb when running as a Xen dom0 domain. [ Impact: enable swiotlb under Xen ] Signed-off-by: Ian Campbell Signed-off-by: Jeremy Fitzhardinge Acked-by: FUJITA Tomonori Acked-by: Joerg Roedel --- diff --git a/arch/x86/kernel/pci-swiotlb.c b/arch/x86/kernel/pci-swiotlb.c index 9640e17c69c..726737600ca 100644 --- a/arch/x86/kernel/pci-swiotlb.c +++ b/arch/x86/kernel/pci-swiotlb.c @@ -11,6 +11,8 @@ #include #include +#include + int swiotlb __read_mostly; static void *x86_swiotlb_alloc_coherent(struct device *hwdev, size_t size, @@ -49,6 +51,9 @@ void __init pci_swiotlb_init(void) if (!iommu_detected && !no_iommu && max_pfn > MAX_DMA32_PFN) swiotlb = 1; #endif + if (xen_wants_swiotlb()) + swiotlb = 1; + if (swiotlb_force) swiotlb = 1; if (swiotlb) { diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig index 298170e18bb..c3ae47473f7 100644 --- a/arch/x86/xen/Kconfig +++ b/arch/x86/xen/Kconfig @@ -6,6 +6,7 @@ config XEN bool "Xen guest support" select PARAVIRT select PARAVIRT_CLOCK + select SWIOTLB depends on X86_64 || (X86_32 && X86_PAE && !X86_VISWS) depends on X86_CMPXCHG && X86_TSC help diff --git a/drivers/pci/xen-iommu.c b/drivers/pci/xen-iommu.c index be50f0f1590..678a0e5d395 100644 --- a/drivers/pci/xen-iommu.c +++ b/drivers/pci/xen-iommu.c @@ -60,6 +60,11 @@ void xen_swiotlb_fixup(void *buf, size_t size, unsigned long nslabs) } } +int xen_wants_swiotlb(void) +{ + return xen_initial_domain(); +} + dma_addr_t xen_phys_to_bus(phys_addr_t paddr) { return phys_to_machine(XPADDR(paddr)).maddr; diff --git a/include/xen/swiotlb.h b/include/xen/swiotlb.h index 8b51ff74855..f35183b1bc1 100644 --- a/include/xen/swiotlb.h +++ b/include/xen/swiotlb.h @@ -5,5 +5,6 @@ extern void xen_swiotlb_fixup(void *buf, size_t size, unsigned long nslabs); extern phys_addr_t xen_bus_to_phys(dma_addr_t daddr); extern dma_addr_t xen_phys_to_bus(phys_addr_t paddr); extern int xen_range_needs_mapping(phys_addr_t phys, size_t size); +extern int xen_wants_swiotlb(void); #endif /* _XEN_SWIOTLB_H */