]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iommu/arm-smmu-v3: Avoid constructing invalid range commands
authorRobin Murphy <robin.murphy@arm.com>
Mon, 11 Sep 2023 11:57:04 +0000 (12:57 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Oct 2023 19:59:05 +0000 (21:59 +0200)
commitbb1fae816c9001ebb18e928a2f76a9e99f522ee9
tree1ce70c634ca684addae4133b06a2540a091029db
parentc4edc7b5c8367edeb78844e85cd310a821a1475e
iommu/arm-smmu-v3: Avoid constructing invalid range commands

[ Upstream commit eb6c97647be227822c7ce23655482b05e348fba5 ]

Although io-pgtable's non-leaf invalidations are always for full tables,
I missed that SVA also uses non-leaf invalidations, while being at the
mercy of whatever range the MMU notifier throws at it. This means it
definitely wants the previous TTL fix as well, since it also doesn't
know exactly which leaf level(s) may need invalidating, but it can also
give us less-aligned ranges wherein certain corners may lead to building
an invalid command where TTL, Num and Scale are all 0. It should be fine
to handle this by over-invalidating an extra page, since falling back to
a non-range command opens up a whole can of errata-flavoured worms.

Fixes: 6833b8f2e199 ("iommu/arm-smmu-v3: Set TTL invalidation hint better")
Reported-by: Rui Zhu <zhurui3@huawei.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/b99cfe71af2bd93a8a2930f20967fb2a4f7748dd.1694432734.git.robin.murphy@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c