iommu/arm-smmu: Don't enable clocks for map

We don't need to enable clocks during map because we don't need to do
anything through hardware (unlike unmap, which needs to do TLB
invalidation).  We had to enable clocks at one point in order to enable
a workaround for some software bugs in the page table code.  These
workarounds are no longer present, so we don't need to enable clocks.
Rip out the clock/regulator enablement.

This seems to improve the performance of iommu_map by several orders of
magnitude.  The performance impact on iommu_map_sg is smaller, maybe a
percent or two.

Change-Id: Iddf530bc35f96840413a5c46ad9ead5334b9abd1
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
This commit is contained in:
Mitchel Humpherys 2015-06-02 10:52:28 -07:00 committed by David Keitel
parent e7f0469ba0
commit eb49744e48

View file

@ -1601,34 +1601,14 @@ static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova,
unsigned long flags;
struct arm_smmu_domain *smmu_domain = domain->priv;
struct io_pgtable_ops *ops= smmu_domain->pgtbl_ops;
int atomic_ctx = smmu_domain->attributes & (1 << DOMAIN_ATTR_ATOMIC);
if (!ops)
return -ENODEV;
/* see the comment in arm_smmu_unmap */
BUG_ON(atomic_ctx && !smmu_domain->smmu);
if (atomic_ctx) {
arm_smmu_enable_clocks_atomic(smmu_domain->smmu);
} else {
mutex_lock(&smmu_domain->init_mutex);
if (smmu_domain->smmu)
arm_smmu_enable_clocks(smmu_domain->smmu);
}
spin_lock_irqsave(&smmu_domain->pgtbl_lock, flags);
ret = ops->map(ops, iova, paddr, size, prot);
spin_unlock_irqrestore(&smmu_domain->pgtbl_lock, flags);
if (atomic_ctx) {
arm_smmu_disable_clocks_atomic(smmu_domain->smmu);
} else {
if (smmu_domain->smmu)
arm_smmu_disable_clocks(smmu_domain->smmu);
mutex_unlock(&smmu_domain->init_mutex);
}
return ret;
}
@ -1639,34 +1619,14 @@ static size_t arm_smmu_map_sg(struct iommu_domain *domain, unsigned long iova,
unsigned long flags;
struct arm_smmu_domain *smmu_domain = domain->priv;
struct io_pgtable_ops *ops = smmu_domain->pgtbl_ops;
int atomic_ctx = smmu_domain->attributes & (1 << DOMAIN_ATTR_ATOMIC);
if (!ops)
return -ENODEV;
/* see the comment in arm_smmu_unmap */
BUG_ON(atomic_ctx && !smmu_domain->smmu);
if (atomic_ctx) {
arm_smmu_enable_clocks_atomic(smmu_domain->smmu);
} else {
mutex_lock(&smmu_domain->init_mutex);
if (smmu_domain->smmu)
arm_smmu_enable_clocks(smmu_domain->smmu);
}
spin_lock_irqsave(&smmu_domain->pgtbl_lock, flags);
ret = ops->map_sg(ops, iova, sg, nents, prot);
spin_unlock_irqrestore(&smmu_domain->pgtbl_lock, flags);
if (atomic_ctx) {
arm_smmu_disable_clocks_atomic(smmu_domain->smmu);
} else {
if (smmu_domain->smmu)
arm_smmu_disable_clocks(smmu_domain->smmu);
mutex_unlock(&smmu_domain->init_mutex);
}
return ret;
}