iommu/arm-smmu: Implement the unmap_pages() callback for the SMMU driver

Implement the unmap_pages() callback for the SMMU driver to allow
a range of pages of the same size to be unmapped in one call,
as opposed to unmapping each page per call. Also, remove the
unmap IOMMU driver hook, as it is no longer used.

Without this patch, we see the following latencies:

(average over 10 iterations)
    size           iommu_map      iommu_unmap
      4K            0.401 us         5.296 us
     64K            1.260 us         5.140 us
      1M           17.239 us        18.624 us
      2M            0.130 us         4.348 us
     12M            0.416 us         4.588 us
     24M            0.729 us         4.828 us
     32M            0.947 us         4.994 us

    size        iommu_map_sg      iommu_unmap
      4K            0.401 us         4.401 us
     64K            0.505 us         5.145 us
      1M            4.583 us        16.989 us
      2M            7.745 us         4.447 us
     12M           40.000 us         5.182 us
     24M           78.270 us         5.729 us
     32M          108.661 us         6.271 us

With this patch, we observe the following latencies:

(average over 10 iterations)
    size           iommu_map      iommu_unmap
      4K            0.432 us         4.505 us
     64K            1.255 us         4.411 us
      1M           16.557 us         4.437 us
      2M            0.130 us         4.432 us
     12M            0.421 us         4.369 us
     24M            0.744 us         4.375 us
     32M            0.953 us         4.359 us

    size        iommu_map_sg      iommu_unmap
      4K            0.463 us         4.401 us
     64K            0.593 us         4.411 us
      1M            4.463 us         4.437 us
      2M            7.463 us         4.453 us
     12M           42.942 us         4.692 us
     24M           83.692 us         4.703 us
     32M          105.916 us         4.796 us.

Change-Id: Iee4b41c7a61c3e9862dd50111345e0329d90ea41
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
Isaac J. Manjarres
2021-03-16 15:23:32 -07:00
parent 61762de63a
commit e5175c9c83

View File

@ -2329,8 +2329,9 @@ static int arm_smmu_map_sg(struct iommu_domain *domain, unsigned long iova,
return ret;
}
static size_t arm_smmu_unmap(struct iommu_domain *domain, unsigned long iova,
size_t size, struct iommu_iotlb_gather *gather)
static size_t arm_smmu_unmap_pages(struct iommu_domain *domain, unsigned long iova,
size_t pgsize, size_t pgcount,
struct iommu_iotlb_gather *gather)
{
size_t ret;
struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
@ -2341,7 +2342,7 @@ static size_t arm_smmu_unmap(struct iommu_domain *domain, unsigned long iova,
arm_smmu_secure_domain_lock(smmu_domain);
ret = ops->unmap(ops, iova, size, gather);
ret = ops->unmap_pages(ops, iova, pgsize, pgcount, gather);
/*
* While splitting up block mappings, we might allocate page table
@ -3118,7 +3119,7 @@ static struct qcom_iommu_ops arm_smmu_ops = {
.attach_dev = arm_smmu_attach_dev,
.map = arm_smmu_map,
.map_sg = arm_smmu_map_sg,
.unmap = arm_smmu_unmap,
.unmap_pages = arm_smmu_unmap_pages,
.flush_iotlb_all = arm_smmu_flush_iotlb_all,
.iotlb_sync_map = arm_smmu_iotlb_sync_map,
.iotlb_sync = arm_smmu_iotlb_sync,