iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iommu: Do not probe devices on IOMMU-less busses
@ 2020-05-11 16:10 Thierry Reding
  2020-05-13  8:42 ` Joerg Roedel
  0 siblings, 1 reply; 2+ messages in thread
From: Thierry Reding @ 2020-05-11 16:10 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: linux-tegra, iommu, Jon Hunter

From: Thierry Reding <treding@nvidia.com>

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.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
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(+)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 9888a3c82b15..4050569188be 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -196,6 +196,9 @@ static int __iommu_probe_device(struct device *dev, struct list_head *group_list
 	struct iommu_group *group;
 	int ret;
 
+	if (!ops)
+		return -ENODEV;
+
 	if (!dev_iommu_get(dev))
 		return -ENOMEM;
 
-- 
2.24.1

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iommu: Do not probe devices on IOMMU-less busses
  2020-05-11 16:10 [PATCH] iommu: Do not probe devices on IOMMU-less busses Thierry Reding
@ 2020-05-13  8:42 ` Joerg Roedel
  0 siblings, 0 replies; 2+ messages in thread
From: Joerg Roedel @ 2020-05-13  8:42 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-tegra, iommu, Jon Hunter

On Mon, May 11, 2020 at 06:10:00PM +0200, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> 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.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
> 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(+)

Applied, thanks.

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-13  8:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-11 16:10 [PATCH] iommu: Do not probe devices on IOMMU-less busses Thierry Reding
2020-05-13  8:42 ` Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).