]> www.infradead.org Git - users/jedix/linux-maple.git/commit
iommu/arm-smmu: Make instance lookup robust
authorRobin Murphy <robin.murphy@arm.com>
Thu, 5 Dec 2024 16:33:55 +0000 (16:33 +0000)
committerWill Deacon <will@kernel.org>
Mon, 9 Dec 2024 22:46:53 +0000 (22:46 +0000)
commit7d835134d4e13e9c30509fd24a42f8c2b94135ea
tree40950d3c121cbdffcbb853f97f07b54679e8343b
parent9b640ae7fbba13d45a8b9712dff2911a0c2b5ff4
iommu/arm-smmu: Make instance lookup robust

Relying on the driver list was a cute idea for minimising the scope of
our SMMU device lookups, however it turns out to have a subtle flaw. The
SMMU device only gets added to that list after arm_smmu_device_probe()
returns success, so there's actually no way the iommu_device_register()
call from there could ever work as intended, even if it wasn't already
hampered by the fwspec setup not happening early enough.

Switch both arm_smmu_get_by_fwnode() implementations to use a platform
bus lookup instead, which *will* reliably work. Also make sure that we
don't register SMMUv2 instances until we've fully initialised them, to
avoid similar consequences of the lookup now finding a device with no
drvdata. Moving the error returns is also a perfect excuse to streamline
them with dev_err_probe() in the process.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/6d7ce1dc31873abdb75c895fb8bd2097cce098b4.1733406914.git.robin.murphy@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
drivers/iommu/arm/arm-smmu/arm-smmu.c