]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
iommu/arm-smmu: Intelligent SMR allocation
authorRobin Murphy <robin.murphy@arm.com>
Mon, 12 Sep 2016 16:13:54 +0000 (17:13 +0100)
committerWill Deacon <will.deacon@arm.com>
Fri, 16 Sep 2016 08:34:20 +0000 (09:34 +0100)
commit588888a7399db352d2b1a41c9d5b3bf0fd482390
treeae2e5e9ef4848d72794beaba0360591bed717dde
parentd3097e39302083d58922a3d1032d7d59a63d263d
iommu/arm-smmu: Intelligent SMR allocation

Stream Match Registers are one of the more awkward parts of the SMMUv2
architecture; there are typically never enough to assign one to each
stream ID in the system, and configuring them such that a single ID
matches multiple entries is catastrophically bad - at best, every
transaction raises a global fault; at worst, they go *somewhere*.

To address the former issue, we can mask ID bits such that a single
register may be used to match multiple IDs belonging to the same device
or group, but doing so also heightens the risk of the latter problem
(which can be nasty to debug).

Tackle both problems at once by replacing the simple bitmap allocator
with something much cleverer. Now that we have convenient in-memory
representations of the stream mapping table, it becomes straightforward
to properly validate new SMR entries against the current state, opening
the door to arbitrary masking and SMR sharing.

Another feature which falls out of this is that with IDs shared by
separate devices being automatically accounted for, simply associating a
group pointer with the S2CR offers appropriate group allocation almost
for free, so hook that up in the process.

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