[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Oops, reenable swiotlb (more last round :-)



ChangeSet 1.1327.1.22, 2005/05/02 13:09:26-06:00, djm@xxxxxxxxxxxxxxx

        Oops, reenable swiotlb (more last round :-)



 lib/Makefile                 |    2 -
 patch/linux-2.6.11/swiotlb.c |   63 +++++++++++++++++++++++++++++++++++++++++++
 tools/mkbuildtree            |   24 ++++++++--------
 xenmisc.c                    |    2 -
 4 files changed, 77 insertions(+), 14 deletions(-)


diff -Nru a/xen/arch/ia64/lib/Makefile b/xen/arch/ia64/lib/Makefile
--- a/xen/arch/ia64/lib/Makefile        2005-05-03 04:10:25 -04:00
+++ b/xen/arch/ia64/lib/Makefile        2005-05-03 04:10:25 -04:00
@@ -9,7 +9,7 @@
        bitop.o checksum.o clear_page.o csum_partial_copy.o copy_page.o \
        clear_user.o strncpy_from_user.o strlen_user.o strnlen_user.o   \
        flush.o ip_fast_csum.o do_csum.o copy_user.o                    \
-       memset.o strlen.o memcpy.o
+       memset.o strlen.o memcpy.o swiotlb.o
 
 default: $(OBJS)
        $(LD) -r -o ia64lib.o $(OBJS)
diff -Nru a/xen/arch/ia64/patch/linux-2.6.11/swiotlb.c 
b/xen/arch/ia64/patch/linux-2.6.11/swiotlb.c
--- /dev/null   Wed Dec 31 16:00:00 196900
+++ b/xen/arch/ia64/patch/linux-2.6.11/swiotlb.c        2005-05-03 04:10:25 
-04:00
@@ -0,0 +1,77 @@
+ swiotlb.c |   21 +++++++++++++--------
+ 1 files changed, 13 insertions(+), 8 deletions(-)
+
+Index: linux-2.6.11-xendiffs/arch/ia64/lib/swiotlb.c
+===================================================================
+--- linux-2.6.11-xendiffs.orig/arch/ia64/lib/swiotlb.c 2005-04-08 
12:13:54.040202667 -0500
++++ linux-2.6.11-xendiffs/arch/ia64/lib/swiotlb.c      2005-04-08 
12:19:09.170367318 -0500
+@@ -124,8 +124,11 @@ swiotlb_init_with_default_size (size_t d
+       /*
+        * Get IO TLB memory from the low pages
+        */
+-      io_tlb_start = alloc_bootmem_low_pages(io_tlb_nslabs *
+-                                             (1 << IO_TLB_SHIFT));
++      /* FIXME: Do we really need swiotlb in HV? If all memory trunks
++       * presented to guest as <4G, are actually <4G in machine range,
++       * no DMA intevention from HV...
++       */
++      io_tlb_start = alloc_xenheap_pages(get_order(io_tlb_nslabs * (1 << 
IO_TLB_SHIFT)));
+       if (!io_tlb_start)
+               panic("Cannot allocate SWIOTLB buffer");
+       io_tlb_end = io_tlb_start + io_tlb_nslabs * (1 << IO_TLB_SHIFT);
+@@ -135,16 +138,16 @@ swiotlb_init_with_default_size (size_t d
+        * to find contiguous free memory regions of size up to IO_TLB_SEGSIZE
+        * between io_tlb_start and io_tlb_end.
+        */
+-      io_tlb_list = alloc_bootmem(io_tlb_nslabs * sizeof(int));
++      io_tlb_list = alloc_xenheap_pages(get_order(io_tlb_nslabs * 
sizeof(int)));
+       for (i = 0; i < io_tlb_nslabs; i++)
+               io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE);
+       io_tlb_index = 0;
+-      io_tlb_orig_addr = alloc_bootmem(io_tlb_nslabs * sizeof(char *));
++      io_tlb_orig_addr = alloc_xenheap_pages(get_order(io_tlb_nslabs * 
sizeof(char *)));
+ 
+       /*
+        * Get the overflow emergency buffer
+        */
+-      io_tlb_overflow_buffer = alloc_bootmem_low(io_tlb_overflow);
++      io_tlb_overflow_buffer = 
alloc_xenheap_pages(get_order(io_tlb_overflow));
+       printk(KERN_INFO "Placing software IO TLB between 0x%lx - 0x%lx\n",
+              virt_to_phys(io_tlb_start), virt_to_phys(io_tlb_end));
+ }
+@@ -328,13 +331,13 @@ swiotlb_alloc_coherent(struct device *hw
+        */
+       flags |= GFP_DMA;
+ 
+-      ret = (void *)__get_free_pages(flags, order);
++      ret = (void *)alloc_xenheap_pages(get_order(size));
+       if (ret && address_needs_mapping(hwdev, virt_to_phys(ret))) {
+               /*
+                * The allocated memory isn't reachable by the device.
+                * Fall back on swiotlb_map_single().
+                */
+-              free_pages((unsigned long) ret, order);
++              free_xenheap_pages((unsigned long) ret, order);
+               ret = NULL;
+       }
+       if (!ret) {
+@@ -372,7 +375,7 @@ swiotlb_free_coherent(struct device *hwd
+ {
+       if (!(vaddr >= (void *)io_tlb_start
+                     && vaddr < (void *)io_tlb_end))
+-              free_pages((unsigned long) vaddr, get_order(size));
++              free_xenheap_pages((unsigned long) vaddr, get_order(size));
+       else
+               /* DMA_TO_DEVICE to avoid memcpy in unmap_single */
+               swiotlb_unmap_single (hwdev, dma_handle, size, DMA_TO_DEVICE);
+@@ -388,8 +391,10 @@ swiotlb_full(struct device *dev, size_t 
+        * When the mapping is small enough return a static buffer to limit
+        * the damage, or panic when the transfer is too big.
+        */
++#ifndef XEN
+       printk(KERN_ERR "PCI-DMA: Out of SW-IOMMU space for %lu bytes at "
+              "device %s\n", size, dev ? dev->bus_id : "?");
++#endif
+ 
+       if (size > io_tlb_overflow && do_panic) {
+               if (dir == PCI_DMA_FROMDEVICE || dir == PCI_DMA_BIDIRECTIONAL)
diff -Nru a/xen/arch/ia64/tools/mkbuildtree b/xen/arch/ia64/tools/mkbuildtree
--- a/xen/arch/ia64/tools/mkbuildtree   2005-05-03 04:10:25 -04:00
+++ b/xen/arch/ia64/tools/mkbuildtree   2005-05-03 04:10:25 -04:00
@@ -142,7 +142,7 @@
 softlink arch/ia64/lib/strncpy_from_user.S arch/ia64/lib/strncpy_from_user.S
 softlink arch/ia64/lib/strnlen_user.S arch/ia64/lib/strnlen_user.S
 #softlink arch/ia64/lib/swiotlb.c arch/ia64/lib/swiotlb.c
-#cp_patch arch/ia64/lib/swiotlb.c arch/ia64/lib/swiotlb.c swiotlb.c
+cp_patch arch/ia64/lib/swiotlb.c arch/ia64/lib/swiotlb.c swiotlb.c
 softlink arch/ia64/lib/xor.S arch/ia64/lib/xor.S
 
 softlink lib/cmdline.c arch/ia64/cmdline.c
@@ -151,19 +151,19 @@
 
 # xen/include/asm-generic files
 
-softlink include/asm-generic/bug.h include/asm-generic/bug.h bug.h
-softlink include/asm-generic/div64.h include/asm-generic/div64.h div64.h
+softlink include/asm-generic/bug.h include/asm-generic/bug.h
+softlink include/asm-generic/div64.h include/asm-generic/div64.h
 softlink include/asm-generic/errno.h include/asm-generic/errno.h
 softlink include/asm-generic/errno-base.h include/asm-generic/errno-base.h
-softlink include/asm-generic/ide_iops.h include/asm-generic/ide_iops.h 
ide_iops.h
-softlink include/asm-generic/iomap.h include/asm-generic/iomap.h iomap.h
-softlink include/asm-generic/pci-dma-compat.h 
include/asm-generic/pci-dma-compat.h pci-dma-compat.h
-softlink include/asm-generic/pci.h include/asm-generic/pci.h pci.h
-softlink include/asm-generic/pgtable.h include/asm-generic/pgtable.h pgtable.h
-softlink include/asm-generic/pgtable-nopud.h 
include/asm-generic/pgtable-nopud.h pgtable-nopud.h
-softlink include/asm-generic/sections.h include/asm-generic/sections.h 
sections.h
-softlink include/asm-generic/topology.h include/asm-generic/topology.h 
topology.h
-softlink include/asm-generic/vmlinux.lds.h include/asm-generic/vmlinux.lds.h 
vmlinux.lds.h
+softlink include/asm-generic/ide_iops.h include/asm-generic/ide_iops.h
+softlink include/asm-generic/iomap.h include/asm-generic/iomap.h
+softlink include/asm-generic/pci-dma-compat.h 
include/asm-generic/pci-dma-compat.h
+softlink include/asm-generic/pci.h include/asm-generic/pci.h
+softlink include/asm-generic/pgtable.h include/asm-generic/pgtable.h
+softlink include/asm-generic/pgtable-nopud.h 
include/asm-generic/pgtable-nopud.h
+softlink include/asm-generic/sections.h include/asm-generic/sections.h
+softlink include/asm-generic/topology.h include/asm-generic/topology.h
+softlink include/asm-generic/vmlinux.lds.h include/asm-generic/vmlinux.lds.h
 
 
 # xen/include/asm-ia64 files
diff -Nru a/xen/arch/ia64/xenmisc.c b/xen/arch/ia64/xenmisc.c
--- a/xen/arch/ia64/xenmisc.c   2005-05-03 04:10:25 -04:00
+++ b/xen/arch/ia64/xenmisc.c   2005-05-03 04:10:25 -04:00
@@ -33,7 +33,7 @@
 void hpsim_setup(char **x) { }
 
 // called from mem_init... don't think s/w I/O tlb is needed in Xen
-void swiotlb_init(void) { }
+//void swiotlb_init(void) { }  ...looks like it IS needed
 
 long
 is_platform_hp_ski(void)

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.