linux: Reduce restrictions on address width for DMA operations
PATCH 1/1 linux: Reduce restrictions on address width for DMA operations
Use address width needed by device rather than dma_bits in dma_alloc_coherent(). Probe supported address width in swiotlb initialization.
Signed-off-by Jan Beulich <[email protected]>
arch/i386/kernel/pci-dma-xen.c +8 -1
@@ -161,6 +161,8 @@ void *dma_alloc_coherent(struct device *struct dma_coherent_mem *mem = dev ? dev->dma_mem :NULL ;unsigned int order =get_order (size);unsigned long vstart; +u64 mask; +/* ignore region specifiers */ gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
@@ -183,9 +185,14 @@ void *dma_alloc_coherent(struct device * vstart =__get_free_pages (gfp, order); ret = (void *)vstart; +if (dev !=NULL && dev->coherent_dma_mask) + mask = dev->coherent_dma_mask; +else + mask =0xffffffff ; +if (ret !=NULL ) {if (xen_create_contiguous_region (vstart, order, - dma_bits) !=0 ) { +fls64 (mask)) !=0 ) {free_pages (vstart, order);return NULL ; }
arch/i386/kernel/swiotlb.c +42 -16
101 lines not on this page · raw message
include/asm-i386/mach-xen/asm/swiotlb.h +0 -2
@@ -34,8 +34,6 @@ extern void swiotlb_unmap_page(struct deextern 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