OSDN Git Service

iommu/arm-smmu-v3: Avoid locking on invalidation path when not using ATS
authorWill Deacon <will@kernel.org>
Tue, 20 Aug 2019 15:28:54 +0000 (16:28 +0100)
committerWill Deacon <will@kernel.org>
Thu, 22 Aug 2019 17:16:11 +0000 (18:16 +0100)
commitcdb8a3c3463563b7bdb6f653bf4b0ffa3a95f366
treeeef77dbb6f7518f0d9756bbe5cf061d54ebc1e9d
parent353e3cf8590cf182a9f42e67993de3aca91e8090
iommu/arm-smmu-v3: Avoid locking on invalidation path when not using ATS

When ATS is not in use, we can avoid taking the 'devices_lock' for the
domain on the invalidation path by simply caching the number of ATS
masters currently attached. The fiddly part is handling a concurrent
->attach() of an ATS-enabled master to a domain that is being
invalidated, but we can handle this using an 'smp_mb()' to ensure that
our check of the count is ordered after completion of our prior TLB
invalidation.

This also makes our ->attach() and ->detach() flows symmetric wrt ATS
interactions.

Acked-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
drivers/iommu/arm-smmu-v3.c