From: Konrad Rzeszutek Wilk Subject: [PATCH 02/31] Enable Xen-SWIOTLB if running in [non-]privileged and disable the Xen-IOMMU if an IOMMU is detected. Date: Thu, 5 Nov 2009 16:33:10 -0500 Message-ID: <1257456819-782-3-git-send-email-konrad.wilk@oracle.com> References: <1257456819-782-1-git-send-email-konrad.wilk@oracle.com> <1257456819-782-2-git-send-email-konrad.wilk@oracle.com> Return-path: In-Reply-To: <1257456819-782-2-git-send-email-konrad.wilk@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Jeremy Fitzhardinge , root , Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org From: root For PCI passthrough to work correctly, we need the Xen-SWIOTLB. Otherwise PCI devices in the non-privileged domains might not be able to do DMA. Signed-off-by: Konrad Rzeszutek Wilk --- arch/x86/xen/pci-swiotlb.c | 2 +- drivers/pci/xen-iommu.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/arch/x86/xen/pci-swiotlb.c b/arch/x86/xen/pci-swiotlb.c index 00f2260..ecdbfe2 100644 --- a/arch/x86/xen/pci-swiotlb.c +++ b/arch/x86/xen/pci-swiotlb.c @@ -984,7 +984,7 @@ static struct dma_map_ops xen_swiotlb_dma_ops = { void __init xen_swiotlb_init(void) { - if (xen_initial_domain()) { + if (xen_domain()) { printk(KERN_INFO "PCI-DMA: Using Xen software bounce buffering for IO (Xen-SWIOTLB)\n"); xen_swiotlb_init_with_default_size(64 * (1<<20)); /* default to 64MB */ dma_ops = &xen_swiotlb_dma_ops; diff --git a/drivers/pci/xen-iommu.c b/drivers/pci/xen-iommu.c index 9ba63b1..c9a2af5 100644 --- a/drivers/pci/xen-iommu.c +++ b/drivers/pci/xen-iommu.c @@ -263,6 +263,9 @@ void __init xen_iommu_init(void) if (xen_initial_domain()) /* For dom0, the IOMMU is handled by arch/x86/xen/pci-swiotlb.c. */ return; + if (iommu_detected) + return; + printk(KERN_INFO "Xen: Initializing Xen DMA ops\n"); force_iommu = 0; -- 1.6.2.5