]> xenbits.xensource.com Git - people/ssmith/netchannel2-pvops.git/commitdiff
swiotlb: use swiotlb_alloc_boot to allocate emergency pool
authorJeremy Fitzhardinge <jeremy@goop.org>
Mon, 9 Feb 2009 20:05:53 +0000 (12:05 -0800)
committerJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Fri, 26 Jun 2009 00:03:45 +0000 (17:03 -0700)
Use swiotlb_alloc_boot() to allocate the emergency pool memory
so that it gets set up properly in the architecture code.

Also fix xen_swiotlb_fixup() to deal with sub-slab-sized allocations,
as the emergency pool is smaller than IO_TLB_SEGSIZE.

[ Impact: allocate emergency pool with appropriate allocator ]

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Acked-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
drivers/pci/xen-iommu.c
lib/swiotlb.c

index 678a0e5d39594600a889c9162aef5305965a622f..bc64397b7565dcb4d0ceec9385705e22c671df1f 100644 (file)
@@ -48,16 +48,22 @@ void xen_swiotlb_fixup(void *buf, size_t size, unsigned long nslabs)
                buf, size);
 
        dma_bits = get_order(IO_TLB_SEGSIZE << IO_TLB_SHIFT) + PAGE_SHIFT;
-       for (i = 0; i < nslabs; i += IO_TLB_SEGSIZE) {
+
+       i = 0;
+       do {
+               int slabs = min(nslabs - i, (unsigned long)IO_TLB_SEGSIZE);
+
                do {
                        rc = xen_create_contiguous_region(
                                (unsigned long)buf + (i << IO_TLB_SHIFT),
-                               get_order(IO_TLB_SEGSIZE << IO_TLB_SHIFT),
+                               get_order(slabs << IO_TLB_SHIFT),
                                dma_bits);
                } while (rc && dma_bits++ < max_dma_bits);
                if (rc)
                        panic(KERN_ERR "xen_create_contiguous_region failed\n");
-       }
+
+               i += slabs;
+       } while(i < nslabs);
 }
 
 int xen_wants_swiotlb(void)
index bffe6d7ef9d9a01a52db11e12e54207bc9b41a0c..095dc616aa7045c5ef7d66c697072bbb6750a1a7 100644 (file)
@@ -208,7 +208,8 @@ swiotlb_init_with_default_size(size_t default_size)
        /*
         * Get the overflow emergency buffer
         */
-       io_tlb_overflow_buffer = alloc_bootmem_low(io_tlb_overflow);
+       io_tlb_overflow_buffer = swiotlb_alloc_boot(io_tlb_overflow,
+                                                   io_tlb_overflow >> IO_TLB_SHIFT);
        if (!io_tlb_overflow_buffer)
                panic("Cannot allocate SWIOTLB overflow buffer!\n");