summaryrefslogtreecommitdiffstats
path: root/drivers/parisc/iommu-helpers.h
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2016-02-02 13:23:36 +1100
committerJoel Stanley <joel@jms.id.au>2016-02-02 13:23:42 +1100
commitf3f4aeb9ea8954c0da3cf0d12693f9a57f1f4ac7 (patch)
tree3663ab29736373c565d88e941162d37311cc3c75 /drivers/parisc/iommu-helpers.h
parent2a3f5f14fdf2e8fb680af168fa642ef8a9218ffb (diff)
parent849a2d3d9be31368559e6852cf64d749e6903818 (diff)
downloadtalos-obmc-linux-openbmc-20160202-1.tar.gz
talos-obmc-linux-openbmc-20160202-1.zip
Merge tag 'v4.3.5' into dev-4.3openbmc-20160202-1
This is the 4.3.5 stable release Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'drivers/parisc/iommu-helpers.h')
-rw-r--r--drivers/parisc/iommu-helpers.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/parisc/iommu-helpers.h b/drivers/parisc/iommu-helpers.h
index 761e77bfce5d..e56f1569f6c3 100644
--- a/drivers/parisc/iommu-helpers.h
+++ b/drivers/parisc/iommu-helpers.h
@@ -104,7 +104,11 @@ iommu_coalesce_chunks(struct ioc *ioc, struct device *dev,
struct scatterlist *contig_sg; /* contig chunk head */
unsigned long dma_offset, dma_len; /* start/len of DMA stream */
unsigned int n_mappings = 0;
- unsigned int max_seg_size = dma_get_max_seg_size(dev);
+ unsigned int max_seg_size = min(dma_get_max_seg_size(dev),
+ (unsigned)DMA_CHUNK_SIZE);
+ unsigned int max_seg_boundary = dma_get_seg_boundary(dev) + 1;
+ if (max_seg_boundary) /* check if the addition above didn't overflow */
+ max_seg_size = min(max_seg_size, max_seg_boundary);
while (nents > 0) {
@@ -138,14 +142,11 @@ iommu_coalesce_chunks(struct ioc *ioc, struct device *dev,
/*
** First make sure current dma stream won't
- ** exceed DMA_CHUNK_SIZE if we coalesce the
+ ** exceed max_seg_size if we coalesce the
** next entry.
*/
- if(unlikely(ALIGN(dma_len + dma_offset + startsg->length,
- IOVP_SIZE) > DMA_CHUNK_SIZE))
- break;
-
- if (startsg->length + dma_len > max_seg_size)
+ if (unlikely(ALIGN(dma_len + dma_offset + startsg->length, IOVP_SIZE) >
+ max_seg_size))
break;
/*
OpenPOWER on IntegriCloud