mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 14:19:09 -04:00
msm: ipa3: Fix to unmap sgt pages with correct size
scatterlist pages not unmapped properly, it was leading to issue when mapping the same pages again. Adding changes to store scatterlist information properly and unmap the page with correct length. Change-Id: If11926608f633ce1d66150b1e4b6c515adc48049 Signed-off-by: Ashok Vuyyuru <avuyyuru@codeaurora.org>
This commit is contained in:
parent
a2ea5ff32c
commit
eca7b0f54f
1 changed files with 27 additions and 8 deletions
|
|
@ -420,14 +420,33 @@ int ipa3_smmu_map_peer_buff(u64 iova, u32 size, bool map, struct sg_table *sgt,
|
|||
}
|
||||
}
|
||||
} else {
|
||||
res = iommu_unmap(smmu_domain,
|
||||
rounddown(iova, PAGE_SIZE),
|
||||
roundup(size + iova - rounddown(iova, PAGE_SIZE),
|
||||
PAGE_SIZE));
|
||||
if (res != roundup(size + iova - rounddown(iova, PAGE_SIZE),
|
||||
PAGE_SIZE)) {
|
||||
IPAERR("Fail to unmap 0x%llx\n", iova);
|
||||
return -EINVAL;
|
||||
if (sgt != NULL) {
|
||||
va = rounddown(iova, PAGE_SIZE);
|
||||
len = 0;
|
||||
for_each_sg(sgt->sgl, sg, sgt->nents, i) {
|
||||
len = PAGE_ALIGN(sg->offset + sg->length);
|
||||
res = iommu_unmap(smmu_domain, va,
|
||||
roundup(len, PAGE_SIZE));
|
||||
if (res !=
|
||||
roundup(len, PAGE_SIZE)) {
|
||||
IPAERR("Fail to unmap iova=%llx\n",
|
||||
iova);
|
||||
return -EINVAL;
|
||||
}
|
||||
va += len;
|
||||
count++;
|
||||
}
|
||||
} else {
|
||||
res = iommu_unmap(smmu_domain,
|
||||
rounddown(iova, PAGE_SIZE),
|
||||
roundup(size + iova -
|
||||
rounddown(iova, PAGE_SIZE),
|
||||
PAGE_SIZE));
|
||||
if (res != roundup(size + iova -
|
||||
rounddown(iova, PAGE_SIZE), PAGE_SIZE)) {
|
||||
IPAERR("Fail to unmap 0x%llx\n", iova);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
IPADBG("Peer buff %s 0x%llx\n", map ? "map" : "unmap", iova);
|
||||
|
|
|
|||
Loading…
Reference in a new issue