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] [LINUX] dma: Use swiotlb mask for coherent mappings too

To: Keir Fraser <keir@xxxxxxxxxxxxx>, Xen Development Mailing List <xen-devel@xxxxxxxxxxxxxxxxxxx>, Calvin Webster <cwebster@xxxxxxxxx>
Subject: [Xen-devel] [LINUX] dma: Use swiotlb mask for coherent mappings too
From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 20 Dec 2006 16:14:43 +1100
Delivery-date: Tue, 19 Dec 2006 21:14:55 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.9i
Hi Keir:

[LINUX] dma: Use swiotlb mask for coherent mappings too

The recent change to use a default DMA bit width of 30 bits (required
by chips like the b44) only converted the streaming DMA primitives.
The coherent mappings are still hard-coded to 31 bits.  This means that
b44 still doesn't work under Xen.

This patch makes the io_tlb_dma_bits variable global and uses it for
coherent memory mappings.

Thanks to Calvin Webster for providing a machine with a b44 and 2G
of memory I've been able to verify that this finally makes the b44
work under Xen.

Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff -r 057f7c4dbed1 linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c       Tue Dec 19 
12:00:11 2006 +0000
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c       Wed Dec 20 
16:07:24 2006 +1100
@@ -15,6 +15,7 @@
 #include <linux/version.h>
 #include <asm/io.h>
 #include <xen/balloon.h>
+#include <asm/swiotlb.h>
 #include <asm/tlbflush.h>
 #include <asm-i386/mach-xen/asm/swiotlb.h>
 #include <asm/bug.h>
@@ -183,8 +184,8 @@ void *dma_alloc_coherent(struct device *
        ret = (void *)vstart;
 
        if (ret != NULL) {
-               /* NB. Hardcode 31 address bits for now: aacraid limitation. */
-               if (xen_create_contiguous_region(vstart, order, 31) != 0) {
+               if (xen_create_contiguous_region(vstart, order,
+                                                io_tlb_dma_bits) != 0) {
                        free_pages(vstart, order);
                        return NULL;
                }
diff -r 057f7c4dbed1 linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c   Tue Dec 19 12:00:11 
2006 +0000
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c   Wed Dec 20 16:07:24 
2006 +1100
@@ -98,7 +98,7 @@ static struct phys_addr {
  */
 static DEFINE_SPINLOCK(io_tlb_lock);
 
-static unsigned int io_tlb_dma_bits = DEFAULT_IO_TLB_DMA_BITS;
+unsigned int io_tlb_dma_bits = DEFAULT_IO_TLB_DMA_BITS;
 static int __init
 setup_io_tlb_bits(char *str)
 {
diff -r 057f7c4dbed1 
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/swiotlb.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/swiotlb.h      Tue Dec 
19 12:00:11 2006 +0000
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/swiotlb.h      Wed Dec 
20 16:07:24 2006 +1100
@@ -34,6 +34,8 @@ extern int swiotlb_dma_supported(struct 
 extern int swiotlb_dma_supported(struct device *hwdev, u64 mask);
 extern void swiotlb_init(void);
 
+extern int io_tlb_dma_bits;
+
 #ifdef CONFIG_SWIOTLB
 extern int swiotlb;
 #else

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