Merge e29f5d1c4e on remote branch

Change-Id: Ieba1f3af5ceb6d39f22d3726d47bea130b6f63a0
This commit is contained in:
Linux Build Service Account 2021-11-01 00:58:20 -07:00
commit 66b8c52ba4

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/dma-contiguous.h>
@ -460,7 +460,7 @@ static void fast_smmu_unmap_sg(struct device *dev,
struct dma_fast_smmu_mapping *mapping = dev_get_mapping(dev);
unsigned long flags;
dma_addr_t start;
size_t len;
size_t len, offset;
struct scatterlist *tmp;
int i;
@ -472,12 +472,13 @@ static void fast_smmu_unmap_sg(struct device *dev,
* contiguous IOVA allocation, so this is incredibly easy.
*/
start = sg_dma_address(sg);
offset = start & ~FAST_PAGE_MASK;
for_each_sg(sg_next(sg), tmp, nelems - 1, i) {
if (sg_dma_len(tmp) == 0)
break;
sg = tmp;
}
len = ALIGN(sg_dma_address(sg) + sg_dma_len(sg) - start,
len = ALIGN(sg_dma_address(sg) + sg_dma_len(sg) - (start - offset),
FAST_PAGE_SIZE);
av8l_fast_unmap_public(mapping->pgtbl_ops, start, len);