Merge tag 'for-5.15/parisc' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
[linux-2.6-microblaze.git] / arch / ia64 / hp / common / sba_iommu.c
index 656a488..8ad6946 100644 (file)
@@ -33,7 +33,7 @@
 #include <linux/bitops.h>         /* hweight64() */
 #include <linux/crash_dump.h>
 #include <linux/iommu-helper.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
 #include <linux/prefetch.h>
 #include <linux/swiotlb.h>
 
@@ -485,8 +485,7 @@ sba_search_bitmap(struct ioc *ioc, struct device *dev,
        ASSERT(((unsigned long) ioc->res_hint & (sizeof(unsigned long) - 1UL)) == 0);
        ASSERT(res_ptr < res_end);
 
-       boundary_size = (unsigned long long)dma_get_seg_boundary(dev) + 1;
-       boundary_size = ALIGN(boundary_size, 1ULL << iovp_shift) >> iovp_shift;
+       boundary_size = dma_get_seg_boundary_nr_pages(dev, iovp_shift);
 
        BUG_ON(ioc->ibase & ~iovp_mask);
        shift = ioc->ibase >> iovp_shift;
@@ -1460,7 +1459,7 @@ static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist,
                sglist->dma_address = sba_map_page(dev, sg_page(sglist),
                                sglist->offset, sglist->length, dir, attrs);
                if (dma_mapping_error(dev, sglist->dma_address))
-                       return 0;
+                       return -EIO;
                return 1;
        }
 
@@ -1487,7 +1486,7 @@ static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist,
        coalesced = sba_coalesce_chunks(ioc, dev, sglist, nents);
        if (coalesced < 0) {
                sba_unmap_sg_attrs(dev, sglist, nents, dir, attrs);
-               return 0;
+               return -ENOMEM;
        }
 
        /*
@@ -2071,6 +2070,8 @@ static const struct dma_map_ops sba_dma_ops = {
        .dma_supported          = sba_dma_supported,
        .mmap                   = dma_common_mmap,
        .get_sgtable            = dma_common_get_sgtable,
+       .alloc_pages            = dma_common_alloc_pages,
+       .free_pages             = dma_common_free_pages,
 };
 
 static int __init