iommu: Do not probe devices on IOMMU-less busses
Subsystems (2)
PATCH 1/1 iommu: Do not probe devices on IOMMU-less busses
From: Thierry Reding <[email protected]>
The host1x bus implemented on Tegra SoCs is primarily an abstraction to create logical device from multiple platform devices. Since the devices in such a setup are typically hierarchical, DMA setup still needs to be done so that DMA masks can be properly inherited, but we don't actually want to attach the host1x logical devices to any IOMMU. The platform devices that make up the logical device are responsible for memory bus transactions, so it is them that will need to be attached to the IOMMU.
Add a check to __iommu_probe_device() that aborts IOMMU setup early for busses that don't have the IOMMU operations pointer set since they will cause a crash otherwise.
---
Note that this is probably also required for the BCMA bus implemented in drivers/bcma/main.c since no IOMMU operations are ever assigned to that either.
drivers/iommu/iommu.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iommu/iommu.c +3 -0
@@ -196,6 +196,9 @@ static int __iommu_probe_device(struct device *dev, struct list_head *group_liststruct iommu_group *group;int ret; +if (!ops) +return -ENODEV ; +if (!dev_iommu_get (dev))return -ENOMEM ;
Signature · 1 line
2.24.1
Quoted 14 lines · Thierry Reding
From: Thierry Reding <[email protected]>
The host1x bus implemented on Tegra SoCs is primarily an abstraction to create logical device from multiple platform devices. Since the devices in such a setup are typically hierarchical, DMA setup still needs to be done so that DMA masks can be properly inherited, but we don't actually want to attach the host1x logical devices to any IOMMU. The platform devices that make up the logical device are responsible for memory bus transactions, so it is them that will need to be attached to the IOMMU.
Add a check to
__iommu_probe_device()that aborts IOMMU setup early for busses that don't have the IOMMU operations pointer set since they will cause a crash otherwise.
Quoted 8 lines
Signed-off-by Thierry Reding <[email protected]>---
Note that this is probably also required for the BCMA bus implemented indrivers/bcma/main.csince no IOMMU operations are ever assigned to that either.drivers/iommu/iommu.c | 3 +++ 1 file changed, 3 insertions(+)
Applied, thanks.