From d6b6f2e5bb15e41efce9f0ffb69f395f22c8266f Mon Sep 17 00:00:00 2001 From: Sean Dolbec Date: Wed, 4 Nov 2026 06:26:50 -0500 Subject: [PATCH] iommu/apple-dart: refuse v2.2 DARTs whose reg misses the exception records T8110-family DARTs that report version 2.2 or later keep the exception bitmap at 0x4000 and the per-stream exception records at 0x8000 + 0x40 * sid. The reset path drains them on every probe. A node whose reg covers only the first 0x4000 bytes therefore faults on the first exception read. Device trees shaped after the Gravity M4 Mac mini (J773g) tree describe 12 DARTs this way (ADMAC, 8 USB, 3 PCIe). There the fault kills the kernel in the device initcalls and the bootloader watchdog resets the SoC about a minute later, with no output. Refuse such a node at probe with a message that names the region and the size it needs. Every DART this refuses already faults today, so no working DART changes behaviour. The consumers of a refused DART probe without an IOMMU once the deferred probe times out. The fix for the device tree is a reg of 0xc000 (the ADT gives 0x20000 for the PCIe DARTs). Tested on J773g with integration/aurora 19f71a142419 plus this change: with the 0x4000 windows the kernel boots and refuses the 11 enabled short DARTs, and Ethernet, NVMe and ADMAC come up after the deferral; with 0xc000 windows no DART is refused. Fixes: f57d90040433 ("iommu/apple-dart: Support T8140 DARTs and firmware-owned stream roots") Assisted-by: LLM Signed-off-by: Sean Dolbec --- drivers/iommu/apple-dart.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index f6373a71881c2..35eeacd305f70 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -4302,6 +4302,19 @@ static int apple_dart_probe(struct platform_device *pdev) goto err_clk_disable; } + /* + * v2.2 moved the exception bitmap to 0x4000 and the per-stream + * exception records to 0x8000. A node whose reg stops short of them + * would fault on the first exception read during reset. + */ + if (dart->hw->type == DART_T8110 && dart->version >= 0x0202 && + resource_size(res) < DART_T8110_ERR_SID(dart->num_streams)) { + ret = dev_err_probe(dev, -EINVAL, + "MMIO region %pR too small for v2.2 exception records (need %#x); fix the DT reg\n", + res, DART_T8110_ERR_SID(dart->num_streams)); + goto err_clk_disable; + } + ret = apple_dart_read_remaps(dart); if (ret) goto err_clk_disable;