Skip to contentSkip to conversation

xen-swiotlb: don't allocate DMA-memory beyond 32-bit

PATCH New [email protected] 1 participant 1 message Feb 1, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen-swiotlb: don't allocate DMA-memory beyond 32-bit

When running 32-bit pvops-dom0 and a driver tries to allocate a coherent DMA-memory the xen swiotlb-implementation returned memory beyond 4GB.

This caused for example not working sound on a system with 4 GB and a 64-bit compatible sound-card with sets the DMA-mask to 64bit.

On bare-metal and the forward-ported xen-dom0 patches from OpenSuse a coherent DMA-memory is always allocated inside the 32-bit address-range by calling dma_alloc_coherent_mask.

The attached patch adds the same functionality to xen swiotlb.

x86/xen/pci-swiotlb.c 2010-02-01 23:20:42.000000000 +0100 renamed from x86/xen/pci-swiotlb.c-org 2010-02-01 23:04:42.000000000 +0100 +1 -1
@@ -602,7 +602,7 @@ xen_swiotlb_alloc_coherent(struct device
        ret = (void *)vstart;
 
        if (hwdev != NULL && hwdev->coherent_dma_mask)
-               mask = hwdev->coherent_dma_mask;
+               mask = dma_alloc_coherent_mask(hwdev, flags);
        else
                mask = DMA_BIT_MASK(32);
x86/xen/pci-swiotlb.c renamed from x86/xen/pci-swiotlb.c-org +1 -1
@@ -602,7 +602,7 @@ xen_swiotlb_alloc_coherent(struct device
 	ret = (void *)vstart;
 
 	if (hwdev != NULL && hwdev->coherent_dma_mask)
-		mask = hwdev->coherent_dma_mask;
+		mask = dma_alloc_coherent_mask(hwdev, flags);
 	else
 		mask = DMA_BIT_MASK(32);
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel