public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] iommu: dont fail silently
@ 2024-01-04 17:12 Caleb Connolly
  2024-01-04 17:47 ` Dragan Simic
  2024-01-19 16:09 ` Tom Rini
  0 siblings, 2 replies; 9+ messages in thread
From: Caleb Connolly @ 2024-01-04 17:12 UTC (permalink / raw)
  To: Tom Rini, Mark Kettenis; +Cc: u-boot, Caleb Connolly

When attempting to probe a device which has an associated IOMMU, if the
IOMMU device can't be found (no driver, disabled driver, driver failed
to probe, etc) then we currently fail to probe the device with no
discernable error.

If we fail to hook the device up to its IOMMU, we should make sure that
the user knows about it. Write some better error messages for
dev_iommu_enable() to facilitate this.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
---
 drivers/iommu/iommu-uclass.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/iommu-uclass.c b/drivers/iommu/iommu-uclass.c
index 6babc0e3a672..dff3239cccb1 100644
--- a/drivers/iommu/iommu-uclass.c
+++ b/drivers/iommu/iommu-uclass.c
@@ -86,16 +86,16 @@ int dev_iommu_enable(struct udevice *dev)
 		ret = dev_read_phandle_with_args(dev, "iommus",
 						 "#iommu-cells", 0, i, &args);
 		if (ret) {
-			debug("%s: dev_read_phandle_with_args failed: %d\n",
-			      __func__, ret);
+			log_err("%s: Failed to parse 'iommus' property for '%s': %d\n",
+				__func__, dev->name, ret);
 			return ret;
 		}
 
 		ret = uclass_get_device_by_ofnode(UCLASS_IOMMU, args.node,
 						  &dev_iommu);
 		if (ret) {
-			debug("%s: uclass_get_device_by_ofnode failed: %d\n",
-			      __func__, ret);
+			log_err("%s: Failed to find IOMMU device for '%s': %d\n",
+				__func__, dev->name, ret);
 			return ret;
 		}
 		dev->iommu = dev_iommu;
@@ -106,8 +106,11 @@ int dev_iommu_enable(struct udevice *dev)
 		ops = device_get_ops(dev->iommu);
 		if (ops && ops->connect) {
 			ret = ops->connect(dev);
-			if (ret)
+			if (ret) {
+				log_err("%s: Failed to connect '%s' to IOMMU '%s': %d\n",
+					__func__, dev->name, dev->iommu->name, ret);
 				return ret;
+			}
 		}
 	}
 
-- 
2.42.1


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

end of thread, other threads:[~2024-01-19 16:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-04 17:12 [PATCH] iommu: dont fail silently Caleb Connolly
2024-01-04 17:47 ` Dragan Simic
2024-01-05 13:55   ` Caleb Connolly
2024-01-05 14:47     ` Dragan Simic
2024-01-05 16:09       ` Caleb Connolly
2024-01-05 16:48         ` Dragan Simic
2024-01-05 17:50           ` Tom Rini
2024-01-05 17:52             ` Dragan Simic
2024-01-19 16:09 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox