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-changelog

[Xen-changelog] [xen-3.0.4-testing] [LINUX] dma: Use swiotlb mask for co

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.0.4-testing] [LINUX] dma: Use swiotlb mask for coherent mappings too
From: "Xen patchbot-3.0.4-testing" <patchbot-3.0.4-testing@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 03 Jan 2007 14:15:32 -0800
Delivery-date: Wed, 03 Jan 2007 14:15:43 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1166613664 0
# Node ID 4531b892915a51918769786b1863fb98589a082a
# Parent  2ec9711cd03acda5aa10510ff7131548cadf2835
[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>

Rename 'io_tlb_dma_bits' to the more correct 'dma_bits'. This also
affects the name of the boot parameter, which is now 'dma_bits='.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

Based on xen-unstable changeset 13099:301bcae1692814d4261560cb053278ee51bfb1c0
---
 linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c          |    5 +-
 linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c              |   20 +++++------
 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/swiotlb.h |    2 +
 3 files changed, 15 insertions(+), 12 deletions(-)

diff -r 2ec9711cd03a -r 4531b892915a 
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       Wed Dec 20 
10:14:50 2006 +0000
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/pci-dma-xen.c       Wed Dec 20 
11:21:04 2006 +0000
@@ -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,
+                                                dma_bits) != 0) {
                        free_pages(vstart, order);
                        return NULL;
                }
diff -r 2ec9711cd03a -r 4531b892915a 
linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c   Wed Dec 20 10:14:50 
2006 +0000
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c   Wed Dec 20 11:21:04 
2006 +0000
@@ -47,8 +47,8 @@ EXPORT_SYMBOL(swiotlb);
  */
 #define IO_TLB_SHIFT 11
 
-/* Width of DMA addresses in the IO TLB. 30 bits is a b44 limitation. */
-#define DEFAULT_IO_TLB_DMA_BITS 30
+/* Width of DMA addresses. 30 bits is a b44 limitation. */
+#define DEFAULT_DMA_BITS 30
 
 static int swiotlb_force;
 static char *iotlb_virt_start;
@@ -98,14 +98,14 @@ static struct phys_addr {
  */
 static DEFINE_SPINLOCK(io_tlb_lock);
 
-static unsigned int io_tlb_dma_bits = DEFAULT_IO_TLB_DMA_BITS;
+unsigned int dma_bits = DEFAULT_DMA_BITS;
 static int __init
-setup_io_tlb_bits(char *str)
-{
-       io_tlb_dma_bits = simple_strtoul(str, NULL, 0);
+setup_dma_bits(char *str)
+{
+       dma_bits = simple_strtoul(str, NULL, 0);
        return 0;
 }
-__setup("swiotlb_bits=", setup_io_tlb_bits);
+__setup("dma_bits=", setup_dma_bits);
 
 static int __init
 setup_io_tlb_npages(char *str)
@@ -167,7 +167,7 @@ swiotlb_init_with_default_size (size_t d
                int rc = xen_create_contiguous_region(
                        (unsigned long)iotlb_virt_start + (i << IO_TLB_SHIFT),
                        get_order(IO_TLB_SEGSIZE << IO_TLB_SHIFT),
-                       io_tlb_dma_bits);
+                       dma_bits);
                BUG_ON(rc);
        }
 
@@ -197,7 +197,7 @@ swiotlb_init_with_default_size (size_t d
               bytes >> 20,
               (unsigned long)iotlb_virt_start,
               (unsigned long)iotlb_virt_start + bytes,
-              io_tlb_dma_bits);
+              dma_bits);
 }
 
 void
@@ -665,7 +665,7 @@ int
 int
 swiotlb_dma_supported (struct device *hwdev, u64 mask)
 {
-       return (mask >= ((1UL << io_tlb_dma_bits) - 1));
+       return (mask >= ((1UL << dma_bits) - 1));
 }
 
 EXPORT_SYMBOL(swiotlb_init);
diff -r 2ec9711cd03a -r 4531b892915a 
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      Wed Dec 
20 10:14:50 2006 +0000
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/swiotlb.h      Wed Dec 
20 11:21:04 2006 +0000
@@ -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 unsigned int dma_bits;
+
 #ifdef CONFIG_SWIOTLB
 extern int swiotlb;
 #else

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-3.0.4-testing] [LINUX] dma: Use swiotlb mask for coherent mappings too, Xen patchbot-3.0.4-testing <=