iommu/arm-smmu: Poll for TLB sync completion more effectively
authorRobin Murphy <robin.murphy@arm.com>
Thu, 30 Mar 2017 16:56:32 +0000 (17:56 +0100)
committerWill Deacon <will.deacon@arm.com>
Thu, 6 Apr 2017 15:06:43 +0000 (16:06 +0100)
commit8513c89300696a68963cc504c21d034c6369e183
treed45e868a1851e92cb66afaa463a97b93726a2c83
parent11febfca2419652f28804879a58ffd32adce2372
iommu/arm-smmu: Poll for TLB sync completion more effectively

On relatively slow development platforms and software models, the
inefficiency of our TLB sync loop tends not to show up - for instance on
a Juno r1 board I typically see the TLBI has completed of its own accord
by the time we get to the sync, such that the latter finishes instantly.

However, on larger systems doing real I/O, it's less realistic for the
TLBs to go idle immediately, and at that point falling into the 1MHz
polling loop turns out to throw away performance drastically. Let's
strike a balance by polling more than once between pauses, such that we
have much more chance of catching normal operations completing before
committing to the fixed delay, but also backing off exponentially, since
if a sync really hasn't completed within one or two "reasonable time"
periods, it becomes increasingly unlikely that it ever will.

Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
drivers/iommu/arm-smmu.c