[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [Patch] use dev DMA masks in dma_alloc_coherent
64bit devices (whose dma_mask and coherent_dma_mask are set to 64bits) can use MEMZONE_DOM while creating contiguous_region for coherent mappings. Please apply the appended patch. Signed-off-by: Suresh Siddha <suresh.b.siddha@xxxxxxxxx> diff -r 84ee014ebd41 linux-2.6-xen-sparse/arch/xen/i386/kernel/pci-dma.c --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/pci-dma.c Wed Aug 17 20:34:38 2005 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/pci-dma.c Thu Aug 18 11:06:42 2005 @@ -129,6 +129,7 @@ struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL; unsigned int order = get_order(size); unsigned long vstart; + unsigned long dma_mask = 0; /* ignore region specifiers */ gfp &= ~(__GFP_DMA | __GFP_HIGHMEM); @@ -145,13 +146,18 @@ return NULL; } - if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff)) - gfp |= GFP_DMA; + if (!dev) + dma_mask = 0xffffffff; + else + /* Kludge to make it bug-to-bug compatible with i386. i386 + uses the normal dma_mask for alloc_coherent. */ + dma_mask = dev->coherent_dma_mask & *dev->dma_mask; vstart = __get_free_pages(gfp, order); ret = (void *)vstart; if (ret != NULL) { + order |= (dma_mask <= 0xffffffff) ? (32 << 8) : 0; xen_create_contiguous_region(vstart, order); memset(ret, 0, size); diff -r 84ee014ebd41 linux-2.6-xen-sparse/arch/xen/i386/kernel/swiotlb.c --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/swiotlb.c Wed Aug 17 20:34:38 2005 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/swiotlb.c Thu Aug 18 11:06:42 2005 @@ -131,7 +131,7 @@ xen_create_contiguous_region( (unsigned long)io_tlb_start, - get_order(io_tlb_nslabs * (1 << IO_TLB_SHIFT))); + get_order(io_tlb_nslabs * (1 << IO_TLB_SHIFT)) | (32 << 8)); io_tlb_end = io_tlb_start + io_tlb_nslabs * (1 << IO_TLB_SHIFT); diff -r 84ee014ebd41 linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c Wed Aug 17 20:34:38 2005 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c Thu Aug 18 11:06:42 2005 @@ -294,7 +294,7 @@ /* 2. Get a new contiguous memory extent. */ BUG_ON(HYPERVISOR_dom_mem_op( - MEMOP_increase_reservation, &mfn, 1, order | (32<<8)) != 1); + MEMOP_increase_reservation, &mfn, 1, order) != 1); /* 3. Map the new extent in place of old pages. */ for (i = 0; i < (1<<order); i++) { diff -r 84ee014ebd41 linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c Wed Aug 17 20:34:38 2005 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c Thu Aug 18 11:06:42 2005 @@ -277,7 +277,7 @@ #ifdef CONFIG_X86_PAE /* this gives us a page below 4GB */ - xen_create_contiguous_region((unsigned long)pgd, 0); + xen_create_contiguous_region((unsigned long)pgd, 0 | (32 << 8)); #endif if (!HAVE_SHARED_KERNEL_PMD) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |