Skip to content

Commit f13eabc

Browse files
Isaac J. Manjarresjoergroedel
authored andcommitted
iommu/io-pgtable-arm-v7s: Implement arm_v7s_unmap_pages()
Implement the unmap_pages() callback for the ARM v7s io-pgtable format. Signed-off-by: Isaac J. Manjarres <[email protected]> Signed-off-by: Georgi Djakov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 4a77b12 commit f13eabc

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

drivers/iommu/io-pgtable-arm-v7s.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -710,15 +710,32 @@ static size_t __arm_v7s_unmap(struct arm_v7s_io_pgtable *data,
710710
return __arm_v7s_unmap(data, gather, iova, size, lvl + 1, ptep);
711711
}
712712

713-
static size_t arm_v7s_unmap(struct io_pgtable_ops *ops, unsigned long iova,
714-
size_t size, struct iommu_iotlb_gather *gather)
713+
static size_t arm_v7s_unmap_pages(struct io_pgtable_ops *ops, unsigned long iova,
714+
size_t pgsize, size_t pgcount,
715+
struct iommu_iotlb_gather *gather)
715716
{
716717
struct arm_v7s_io_pgtable *data = io_pgtable_ops_to_data(ops);
718+
size_t unmapped = 0, ret;
717719

718720
if (WARN_ON(iova >= (1ULL << data->iop.cfg.ias)))
719721
return 0;
720722

721-
return __arm_v7s_unmap(data, gather, iova, size, 1, data->pgd);
723+
while (pgcount--) {
724+
ret = __arm_v7s_unmap(data, gather, iova, pgsize, 1, data->pgd);
725+
if (!ret)
726+
break;
727+
728+
unmapped += pgsize;
729+
iova += pgsize;
730+
}
731+
732+
return unmapped;
733+
}
734+
735+
static size_t arm_v7s_unmap(struct io_pgtable_ops *ops, unsigned long iova,
736+
size_t size, struct iommu_iotlb_gather *gather)
737+
{
738+
return arm_v7s_unmap_pages(ops, iova, size, 1, gather);
722739
}
723740

724741
static phys_addr_t arm_v7s_iova_to_phys(struct io_pgtable_ops *ops,
@@ -781,6 +798,7 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struct io_pgtable_cfg *cfg,
781798
data->iop.ops = (struct io_pgtable_ops) {
782799
.map = arm_v7s_map,
783800
.unmap = arm_v7s_unmap,
801+
.unmap_pages = arm_v7s_unmap_pages,
784802
.iova_to_phys = arm_v7s_iova_to_phys,
785803
};
786804

0 commit comments

Comments
 (0)