]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
iommu: dont fail silently
authorCaleb Connolly <caleb.connolly@linaro.org>
Thu, 4 Jan 2024 17:12:22 +0000 (17:12 +0000)
committerTom Rini <trini@konsulko.com>
Thu, 18 Jan 2024 17:18:48 +0000 (12:18 -0500)
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

index 6babc0e3a67203ca7db2b6510380e995067a117a..dff3239cccb151c59041e14dcc1cc0b9b52d2f9e 100644 (file)
@@ -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;
+                       }
                }
        }