]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/msm: use for_each_sgtable_sg to iterate over scatterlist
authorJonathan Marek <jonathan@marek.ca>
Mon, 13 Jun 2022 22:10:19 +0000 (18:10 -0400)
committerRob Clark <robdclark@chromium.org>
Tue, 14 Jun 2022 18:54:38 +0000 (11:54 -0700)
The dma_map_sgtable() call (used to invalidate cache) overwrites sgt->nents
with 1, so msm_iommu_pagetable_map maps only the first physical segment.

To fix this problem use for_each_sgtable_sg(), which uses orig_nents.

Fixes: b145c6e65eb0 ("drm/msm: Add support to create a local pagetable")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Link: https://lore.kernel.org/r/20220613221019.11399-1-jonathan@marek.ca
Signed-off-by: Rob Clark <robdclark@chromium.org>
drivers/gpu/drm/msm/msm_iommu.c

index bcaddbba564df0b189aa4ece9c64de3935aff8ba..a54ed354578b53c1ce53dd35831fa4260d434372 100644 (file)
@@ -58,7 +58,7 @@ static int msm_iommu_pagetable_map(struct msm_mmu *mmu, u64 iova,
        u64 addr = iova;
        unsigned int i;
 
-       for_each_sg(sgt->sgl, sg, sgt->nents, i) {
+       for_each_sgtable_sg(sgt, sg, i) {
                size_t size = sg->length;
                phys_addr_t phys = sg_phys(sg);