From 0f35583d84147297a7c4950209fa85b866024b24 Mon Sep 17 00:00:00 2001 From: Erik Bourget Date: Tue, 17 Nov 2026 23:03:25 -0500 Subject: [PATCH] iommu: apple-dart: adopt T8132 internal display DARTs by default on 26.6.2 firmware On T8132 (M4) Macs running 26.6.2 firmware, the internal display DARTs that iBoot leaves live (the DCP's SID23 at 0x30a340000 and the scanout/PIODMA frontend at 0x30a300000) were adopted only when the command line set apple_dart.j713_dcp=1 and apple_dart.j713_display=1. No distribution sets them by default, so an installed 26.6.2 system came up on simpledrm: appledrm never bound the DCP, and the GPU never started. Gate internal display DART adoption directly on the internal DCP devicetree node instead of the board/OS-version helper or opt-in module parameters: require that the "dcp" node is available, compatible with "apple,t8132-dcp", and carries apple,firmware-version 26.6.2 via apple_dart_dcp_firmware(). That check stays strictly as a hardware-safety guard matching apple_dart_dcp_validate() until a loader-published internal DCP handoff property lands in Aura first and the kernel keys on it (tracked in https://github.com/aurora-silicon/linux/issues/2621): the retained-DART path assumes the inherited table and DMA layout of the 26.6.2 DCP firmware, so any other firmware (including 27.2, which is out of scope here) or disabled DCP leaves both internal display DARTs untouched (-ENODEV) without pinning their tables, reserving the SID23 window, or resetting the live DARTs. Remove the runtime-writable apple_dart.j713_dcp and apple_dart.j713_display module parameters, and update the APPLE_DART_J713_DCP Kconfig help text to reflect that it is no longer an opt-in bring-up profile. Those parameters originally guarded early READY bring-up with a requirement that userspace arm a watchdog before probing SID23, when an unvalidated probe risked resetting or corrupting a live locked display DART and wedging the SoC. That precondition no longer applies to the adopted path: - probe performs no DART register or page-table writes: preserve_display skips apple_dart_hw_reset() and apple_dart_drain_stale_exceptions(), and apple_dart_dcp_import() validates the locked T8110 registers (TCR, ENABLE_STREAMS, TTBR) and inherited root/leaf PTEs read-only against ADT reserved-memory bounds and excluded Linux RAM, refusing any mismatch or instability without mutating hardware; - probe refuses adoption (-EIO) if any display DART fault is already pending or masked, attaches the shared fault IRQ only once both display DARTs pass validation, quarantines the faulting DART's borrowed streams on fault without issuing FLUSH_UNLOCK, and quarantines both display peers before releasing the shared IRQ; - a refused DART leaves DCP probe refused (via the IOMMU-group check in drm/apple) so simpledrm keeps the panel safely. Adopting the display DARTs holds the display kexec blocker for the rest of the boot, as it already did with the parameters set; on T8132 Macs the managed radio DART also holds its own kexec blocker. Link: https://github.com/aurora-silicon/aura/issues/462 Link: https://github.com/aurora-silicon/linux/issues/2621 Signed-off-by: Erik Bourget --- drivers/iommu/Kconfig | 16 ++++++------ drivers/iommu/apple-dart.c | 51 ++++++++++++++------------------------ 2 files changed, 28 insertions(+), 39 deletions(-) diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index 4233b253b06e2..1cdbd93be4fb1 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -317,17 +317,19 @@ config APPLE_DART Say Y here if you are using an Apple SoC. config APPLE_DART_J713_DCP - bool "Retained J713 display DART support" + bool "Retained T8132 display DART support" depends on APPLE_DART=y && ARM64_16K_PAGES select MFD_SYSCON help - Adopt the qualified running J713 internal display DARTs. Their - firmware-visible allocations, page tables and noncoherent CPU - mappings remain pinned until platform reset. This limited bringup - profile requires the built-in ARM64 DMA implementation; its private - mapping/cache interfaces are not a modular DMA API. + Adopt the inherited T8132 (M4) display DARTs when the boot loader + hands over a qualified DCP firmware session. Their firmware-visible + allocations, page tables and noncoherent CPU mappings remain pinned + until platform reset, which requires the built-in ARM64 DMA + implementation (not APPLE_DART=m). - Leave this disabled for ordinary DART use, including APPLE_DART=m. + Say Y here to support native display and its dependent GPU bring-up + on T8132 Macs with a qualified DCP handoff (requires built-in + APPLE_DART and 16 KiB pages). config APPLE_DART_KUNIT_TEST bool "KUnit tests for Apple DART domains and commands" if !KUNIT_ALL_TESTS diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index d66e87da3f560..65d7cafd98fce 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -887,16 +887,6 @@ static struct platform_driver apple_dart_driver; static const struct iommu_ops apple_dart_iommu_ops; static bool apple_dart_fault_pending(struct apple_dart *dart); -/* READY bring-up only: userspace must arm its watchdog before probing SID23. */ -static bool apple_dart_dcp_enabled; - -module_param_named(j713_dcp, apple_dart_dcp_enabled, bool, 0600); -MODULE_PARM_DESC(j713_dcp, "Enable explicit J713 DCP DART probe after arming watchdog"); - -static bool apple_dart_frontend_enabled; -module_param_named(j713_display, apple_dart_frontend_enabled, bool, 0600); -MODULE_PARM_DESC(j713_display, "Enable explicit J713 display DART admission after arming watchdog"); - /* The machine's first compatible string, for log lines that name the board. */ static const char *apple_dart_board(void) { @@ -5365,11 +5355,12 @@ static int apple_dart_probe(struct platform_device *pdev) /* * The M4 internal display DARTs are live: DCP firmware (SID23) - * and the scanout/PIODMA frontend (SID0/SID16) keep using them. Leave - * both untouched until userspace, with its watchdog armed, opts in. + * and the scanout/PIODMA frontend (SID0/SID16) keep using them. + * Adopt them only when the internal DCP node carries the qualified + * firmware handoff; leave them untouched otherwise. */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - j713_display = res && !tunneled && apple_t8132_firmware_path() && + j713_display = res && !tunneled && of_device_is_compatible(dev->of_node, "apple,t8132-dart") && (res->start == 0x30a300000ULL || res->start == 0x30a340000ULL); /* The external DCP firmware DARTs (SID23) of dcpext0 and dcpext1. */ @@ -5385,25 +5376,21 @@ static int apple_dart_probe(struct platform_device *pdev) of_machine_is_compatible("apple,t8132") && of_device_is_compatible(dev->of_node, "apple,t8132-dart") && res->start == 0x490000000ULL; - /* - * Off the qualified firmware nothing hands the internal display DARTs - * over, but the running DCP still uses them: never reset them. - */ - if (res && !tunneled && !apple_t8132_firmware_path() && - of_machine_is_compatible("apple,t8132") && - of_device_is_compatible(dev->of_node, "apple,t8132-dart") && - (res->start == 0x30a300000ULL || res->start == 0x30a340000ULL)) { - dev_info(dev, "Leaving inherited display DART untouched off the qualified firmware\n"); - return -ENODEV; - } - if (j713_display && !IS_ENABLED(CONFIG_APPLE_DART_J713_DCP)) - return dev_err_probe(dev, -EOPNOTSUPP, - "retained J713 display requires CONFIG_APPLE_DART_J713_DCP=y\n"); - if (j713_display && - ((res->start == 0x30a300000ULL && !READ_ONCE(apple_dart_frontend_enabled)) || - (res->start == 0x30a340000ULL && !READ_ONCE(apple_dart_dcp_enabled)))) { - dev_info(dev, "Leaving inherited display DART untouched; explicit guarded probe required\n"); - return -ENODEV; + if (j713_display) { + struct device_node *owner = of_find_node_by_path("dcp"); + bool handed_over = owner && + of_device_is_available(owner) && + of_device_is_compatible(owner, "apple,t8132-dcp") && + apple_dart_dcp_firmware(owner); + + of_node_put(owner); + if (!handed_over) { + dev_info(dev, "Leaving inherited display DART untouched\n"); + return -ENODEV; + } + if (!IS_ENABLED(CONFIG_APPLE_DART_J713_DCP)) + return dev_err_probe(dev, -EOPNOTSUPP, + "retained T8132 display requires CONFIG_APPLE_DART_J713_DCP=y\n"); } if (j713_dcpext) { /* Its block is powered only if the loader handed the DCP over. */