On 11.02.2020 17:36, Robin Murphy wrote:
On 11/02/2020 4:03 pm, Chuck Lever wrote:
Robin, your explanation makes sense to me. I can post a fix for this
imbalance later today for Andre to try.
FWIW here's a quick hack which *should* suppress the concatenation
behaviour - if it makes Andre's system any happier then that would
indeed point towards dma_map_sg() handling being the culprit.
Robin.
This hack do indeed make things work again.
----->8-----
diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index a2e96a5fd9a7..a6b71bad518e 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -779,7 +779,7 @@ static int __finalise_sg(struct device *dev, struct
scatterlist *sg, int nents,
* - but doesn't fall at a segment boundary
* - and wouldn't make the resulting output segment too long
*/
- if (cur_len && !s_iova_off && (dma_addr & seg_mask) &&
+ if (0 && cur_len && !s_iova_off && (dma_addr & seg_mask) &&
(max_len - cur_len >= s_length)) {
/* ...then concatenate it with the previous one */
cur_len += s_length;
@@ -799,6 +799,7 @@ static int __finalise_sg(struct device *dev, struct
scatterlist *sg, int nents,
if (s_length + s_iova_off < s_iova_len)
cur_len = 0;
}
+ WARN_ON(count < nents);
return count;
}