diff --git a/drivers/thunderbolt/apple.c b/drivers/thunderbolt/apple.c index ba7ec0bc0296c..6330140715e2b 100644 --- a/drivers/thunderbolt/apple.c +++ b/drivers/thunderbolt/apple.c @@ -83,6 +83,7 @@ #include #include #include +#include #include #include #include @@ -2052,6 +2053,20 @@ static int apple_nhi_probe(struct platform_device *pdev) goto err; } + /* + * The rings must never run untranslated. The DART is populated with + * the NHI, so it is normally bound first; but once the driver core + * has stopped waiting for missing suppliers (DART driver not loaded + * yet), the NHI would probe without its IOMMU. Defer, and fail the + * ACIO start now instead of letting it wait for the NHI to time out. + */ + if (of_property_present(pdev->dev.of_node, "iommus") && + !device_iommu_mapped(&pdev->dev)) { + dev_warn(&pdev->dev, "DART not bound yet, not starting the NHI\n"); + ret = -EPROBE_DEFER; + goto err; + } + anhi = devm_kzalloc(&pdev->dev, sizeof(*anhi), GFP_KERNEL); if (!anhi) { ret = -ENOMEM;