sparc64: add the segment boundary checking to IOMMUs while merging SG entries
[deliverable/linux.git] / arch / sparc64 / kernel / iommu_common.h
index 0713bd58499c1de49d2650877c60f59437b66fd3..87ace495d45f48ff0181297d396e00a11b13fef2 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/mm.h>
 #include <linux/scatterlist.h>
 #include <linux/device.h>
+#include <linux/iommu-helper.h>
 
 #include <asm/iommu.h>
 #include <asm/scatterlist.h>
@@ -58,6 +59,18 @@ static inline unsigned long calc_npages(struct scatterlist *sglist, int nelems)
        return npages;
 }
 
+static inline int is_span_boundary(unsigned long entry,
+                                  unsigned long shift,
+                                  unsigned long boundary_size,
+                                  struct scatterlist *outs,
+                                  struct scatterlist *sg)
+{
+       unsigned long paddr = SG_ENT_PHYS_ADDRESS(outs);
+       int nr = iommu_num_pages(paddr, outs->dma_length + sg->length);
+
+       return iommu_is_span_boundary(entry, nr, shift, boundary_size);
+}
+
 extern unsigned long iommu_range_alloc(struct device *dev,
                                       struct iommu *iommu,
                                       unsigned long npages,
This page took 0.024744 seconds and 5 git commands to generate.