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

[Xen-changelog] [xen-unstable] [IA64] Fix bug in xen_alloc_coherent()



# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1181582491 21600
# Node ID 8655f7b7d50cd351be4525080223421f835b5bb9
# Parent  f63349a4051d13cc40b576cdd2f3f5deaebe1c18
[IA64] Fix bug in xen_alloc_coherent()

xen_create_contiguous_region() needs an order, not a mask.  Also change
s/hwdev/dev/ for consistency.

Signed-off-by: Alex Williamson <alex.williamson@xxxxxx>
---
 linux-2.6-xen-sparse/arch/ia64/xen/xen_dma.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff -r f63349a4051d -r 8655f7b7d50c 
linux-2.6-xen-sparse/arch/ia64/xen/xen_dma.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/xen_dma.c      Mon Jun 11 11:17:33 
2007 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/xen_dma.c      Mon Jun 11 11:21:31 
2007 -0600
@@ -22,6 +22,7 @@
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  */
 
+#include <linux/bitops.h>
 #include <linux/dma-mapping.h>
 #include <linux/mm.h>
 #include <asm/scatterlist.h>
@@ -40,18 +41,18 @@ do {                                                        
        \
  * when merged with upstream Linux.
  */
 static inline int
-address_needs_mapping(struct device *hwdev, dma_addr_t addr)
+address_needs_mapping(struct device *dev, dma_addr_t addr)
 {
        dma_addr_t mask = 0xffffffff;
 
        /* If the device has a mask, use it, otherwise default to 32 bits */
-       if (hwdev && hwdev->dma_mask)
-               mask = *hwdev->dma_mask;
+       if (dev && dev->dma_mask)
+               mask = *dev->dma_mask;
        return (addr & ~mask) != 0;
 }
 
 int
-xen_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
+xen_map_sg(struct device *dev, struct scatterlist *sg, int nents,
           int direction)
 {
        int i;
@@ -60,7 +61,7 @@ xen_map_sg(struct device *hwdev, struct 
                sg[i].dma_address = page_to_bus(sg[i].page) + sg[i].offset;
                sg[i].dma_length  = sg[i].length;
 
-               IOMMU_BUG_ON(address_needs_mapping(hwdev, sg[i].dma_address));
+               IOMMU_BUG_ON(address_needs_mapping(dev, sg[i].dma_address));
        }
 
        return nents;
@@ -68,7 +69,7 @@ EXPORT_SYMBOL(xen_map_sg);
 EXPORT_SYMBOL(xen_map_sg);
 
 void
-xen_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
+xen_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
             int direction)
 {
 }
@@ -101,7 +102,7 @@ xen_alloc_coherent(struct device *dev, s
                return NULL;
 
        if (xen_create_contiguous_region(vaddr, order,
-                                        dev->coherent_dma_mask)) {
+                                        fls64(dev->coherent_dma_mask))) {
                free_pages(vaddr, order);
                return NULL;
        }

_______________________________________________
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®.