iommu/tegra-smmu: Add locking around mapping operations
authorDmitry Osipenko <digetx@gmail.com>
Tue, 1 Sep 2020 20:37:30 +0000 (23:37 +0300)
committerJoerg Roedel <jroedel@suse.de>
Fri, 4 Sep 2020 12:27:18 +0000 (14:27 +0200)
commit404d0b308e4f730b1c9b2f33e84a6f7069db94c5
tree7bd91b55021629866da36992951268ddd731ce62
parent1ea5440e36a792d01aae0b22159e0a13b33589fe
iommu/tegra-smmu: Add locking around mapping operations

The mapping operations of the Tegra SMMU driver are subjected to a race
condition issues because SMMU Address Space isn't allocated and freed
atomically, while it should be. This patch makes the mapping operations
atomic, it fixes an accidentally released Host1x Address Space problem
which happens while running multiple graphics tests in parallel on
Tegra30, i.e. by having multiple threads racing with each other in the
Host1x's submission and completion code paths, performing IOVA mappings
and unmappings in parallel.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20200901203730.27865-1-digetx@gmail.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/tegra-smmu.c