WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 2/2] Fix calling order wherein iommu_detected would b

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 2/2] Fix calling order wherein iommu_detected would be set after software IO TLB was initialized causing double IO TLB allocation.
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Mon, 14 Sep 2009 11:20:13 -0400
Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Delivery-date: Mon, 14 Sep 2009 08:30:28 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
The iommu_detected flag was set _after_ the Software IO TLB was initialized.
This caused the Xen software IO TLB to be init and right after that the 
software IO TLB.
Merging xen_swiotlb_init and xen_swiotlb_init_alloc in one function that sets
this argument fixes the issue.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
 arch/x86/include/asm/xen/swiotlb.h |    6 ++----
 arch/x86/kernel/pci-dma.c          |    2 +-
 arch/x86/xen/pci-swiotlb.c         |   13 +++----------
 3 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/arch/x86/include/asm/xen/swiotlb.h 
b/arch/x86/include/asm/xen/swiotlb.h
index 81d8502..d094f89 100644
--- a/arch/x86/include/asm/xen/swiotlb.h
+++ b/arch/x86/include/asm/xen/swiotlb.h
@@ -2,11 +2,9 @@
 #define _ASM_X86_XEN_SWIOTLB_H
 
 #ifdef CONFIG_PCI_XEN
-extern int xen_swiotlb_init(void);
-extern void xen_swiotlb_init_alloc(void);
+extern void xen_swiotlb_init(void);
 #else
-static inline int xen_swiotlb_init(void) { return -ENODEV; }
-static void xen_swiotlb_init_alloc(void) { }
+static void xen_swiotlb_init(void) { }
 #endif
 
 #endif
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 90da583..4695757 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -130,7 +130,7 @@ void __init pci_iommu_alloc(void)
 
        amd_iommu_detect();
 
-       xen_swiotlb_init_alloc();
+       xen_swiotlb_init();
 
        pci_swiotlb_init();
 }
diff --git a/arch/x86/xen/pci-swiotlb.c b/arch/x86/xen/pci-swiotlb.c
index 19b78e2..76194d4 100644
--- a/arch/x86/xen/pci-swiotlb.c
+++ b/arch/x86/xen/pci-swiotlb.c
@@ -970,19 +970,12 @@ static struct dma_map_ops xen_swiotlb_dma_ops = {
        .dma_supported = NULL,
 };
 
-int __init xen_swiotlb_init(void)
+void __init xen_swiotlb_init(void)
 {
-       if (xen_pv_domain() && xen_initial_domain()) {
-               iommu_detected = 1;
-               return 0;
-       }
-       return -ENODEV;
-}
-void __init xen_swiotlb_init_alloc(void)
-{
-       if (xen_pv_domain() && xen_initial_domain()) {
+       if (xen_initial_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;
+               iommu_detected = 1;
        }
 }
-- 
1.6.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 2/2] Fix calling order wherein iommu_detected would be set after software IO TLB was initialized causing double IO TLB allocation., Konrad Rzeszutek Wilk <=