From 43f0791f35d27aae7d73f5cbc90a6df4383a4fe3 Mon Sep 17 00:00:00 2001 From: Satya Benson Date: Fri, 20 Nov 2026 00:16:35 -0500 Subject: [PATCH 1/4] iommu/apple-dart, soc: apple: rtkit-helper: take a live MTP handoff by its properties, not by board A boot stage that leaves the MTP running hands it over with apple,rtkit-handoff on the MTP and apple,bypass-handoff-streams on its DART. Two checks still named the J613: the DART probe accepted the bypass stream only on the J613's T8122 DART at 0x2fa808000, and the helper kept the adopted session's ASC awake over s2idle only on the J613. The 27.2 MTP firmware on the MacBook Air M2 (J413) cannot be restarted either, and U-Boot hands it over the same way through the T8112 DART at 0x24e808000. - apple-dart: inherit the stream when the DART supports bypass, the stream is 1, and its TCR reads back as bypass. The register is the hardware's own record of the handoff, so it replaces the board and address match. - rtkit-helper: keep an adopted session's ASC awake over s2idle on every board. A session is adopted only through apple,rtkit-handoff, which says it cannot be restarted. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Satya Benson --- drivers/iommu/apple-dart.c | 9 ++++++--- drivers/soc/apple/rtkit-helper.c | 8 ++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index 4bb6491eedb8c..60fe4828c7f0e 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -5833,9 +5833,12 @@ static int apple_dart_probe(struct platform_device *pdev) ret = -EINVAL; goto err_clk_disable; } - if (stream && (!of_machine_is_compatible("apple,j613") || - !of_device_is_compatible(dev->of_node, "apple,t8122-dart") || - res->start != 0x2fa808000ULL || !dart->supports_bypass || + /* + * Inherit the stream only if this DART can bypass and the boot + * stage really left that stream in bypass: the TCR read back is + * the hardware's own statement of the handoff, on any board. + */ + if (stream && (!dart->supports_bypass || stream != 1 || stream >= dart->num_streams || apple_dart_readl(dart, DART_TCR(dart, stream)) != dart->hw->tcr_bypass)) { ret = -EINVAL; diff --git a/drivers/soc/apple/rtkit-helper.c b/drivers/soc/apple/rtkit-helper.c index 8d2b45d4cb26b..cf4f9fddb9dc9 100644 --- a/drivers/soc/apple/rtkit-helper.c +++ b/drivers/soc/apple/rtkit-helper.c @@ -543,7 +543,11 @@ static int __maybe_unused apple_rtkit_helper_suspend(struct device *dev) if (helper->adopted && pm_suspend_target_state != PM_SUSPEND_TO_IDLE) return -EBUSY; - if (!helper->adopted || !of_machine_is_compatible("apple,j613")) + /* + * An adopted session (apple,rtkit-handoff) was handed over running + * because it cannot be restarted, whatever the board. + */ + if (!helper->adopted) return 0; if (!(readl(helper->asc_base + APPLE_ASC_CPU_CONTROL) & APPLE_ASC_CPU_CONTROL_RUN)) return -EHOSTDOWN; @@ -559,7 +563,7 @@ static int __maybe_unused apple_rtkit_helper_resume(struct device *dev) /* After a firmware-driven suspend's idle notice; nothing otherwise. */ apple_rtkit_helper_ap_on(helper); - if (!helper->adopted || !of_machine_is_compatible("apple,j613")) + if (!helper->adopted) return 0; if (!(readl(helper->asc_base + APPLE_ASC_CPU_CONTROL) & APPLE_ASC_CPU_CONTROL_RUN)) { dev_err(dev, "adopted MTP lost ASC RUN; refusing firmware restart\n"); From 63e2e4f3579a8d259db104c381dbc5a6d7294341 Mon Sep 17 00:00:00 2001 From: Satya Benson Date: Fri, 20 Nov 2026 02:52:59 -0500 Subject: [PATCH 2/4] arm64: dts: apple: say which MTPs a boot stage must hand over running Add apple,rtkit-keep-running to the rtk-helper binding: the helper's firmware cannot be restarted once quiesced, so a boot stage that starts it hands its first epoch to the OS running instead of stopping it. U-Boot used to pick these by board (J613) and by SoC plus OS firmware version (T8112 on 27.x); it now reads this property. - t8122-j613: set it, as U-Boot's J613 check did. - t8112-j413-fw27 (new): J413 with macOS 27 system firmware. It sets the property and the trackpad's two-stage power command (apple,power-method = <2>), which U-Boot used to patch in, following t8122-j613-25g83. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Satya Benson --- .../soc/apple/apple,rtk-helper-asc4.yaml | 9 +++++++++ arch/arm64/boot/dts/apple/Makefile | 1 + arch/arm64/boot/dts/apple/t8112-j413-fw27.dts | 18 ++++++++++++++++++ arch/arm64/boot/dts/apple/t8122-j613.dts | 5 +++++ 4 files changed, 33 insertions(+) create mode 100644 arch/arm64/boot/dts/apple/t8112-j413-fw27.dts diff --git a/Documentation/devicetree/bindings/soc/apple/apple,rtk-helper-asc4.yaml b/Documentation/devicetree/bindings/soc/apple/apple,rtk-helper-asc4.yaml index 874f667ce3f61..3a40d2b009ac0 100644 --- a/Documentation/devicetree/bindings/soc/apple/apple,rtk-helper-asc4.yaml +++ b/Documentation/devicetree/bindings/soc/apple/apple,rtk-helper-asc4.yaml @@ -76,6 +76,15 @@ properties: bypass. The host continues servicing system endpoints without restarting the coprocessor or taking it to QUIESCED. + apple,rtkit-keep-running: + type: boolean + description: | + The helper's firmware cannot be restarted once it has been taken to + QUIESCED, so a boot stage that starts it hands its first RTKit epoch to + the OS running, with apple,rtkit-handoff, instead of stopping it. Set by + the board device tree for the firmware it describes. The OS does not + read it. + apple,rtkit-buffers: oneOf: - type: boolean diff --git a/arch/arm64/boot/dts/apple/Makefile b/arch/arm64/boot/dts/apple/Makefile index 6258ce085349d..25b14626c655b 100644 --- a/arch/arm64/boot/dts/apple/Makefile +++ b/arch/arm64/boot/dts/apple/Makefile @@ -113,6 +113,7 @@ dtb-$(CONFIG_ARCH_APPLE) += t6050-k114s.dtb dtb-$(CONFIG_ARCH_APPLE) += t6050-k116c.dtb dtb-$(CONFIG_ARCH_APPLE) += t6050-k116s.dtb dtb-$(CONFIG_ARCH_APPLE) += t8112-j413.dtb +dtb-$(CONFIG_ARCH_APPLE) += t8112-j413-fw27.dtb dtb-$(CONFIG_ARCH_APPLE) += t8112-j415.dtb dtb-$(CONFIG_ARCH_APPLE) += t8112-j473.dtb dtb-$(CONFIG_ARCH_APPLE) += t8112-j493.dtb diff --git a/arch/arm64/boot/dts/apple/t8112-j413-fw27.dts b/arch/arm64/boot/dts/apple/t8112-j413-fw27.dts new file mode 100644 index 0000000000000..ae41133aa6785 --- /dev/null +++ b/arch/arm64/boot/dts/apple/t8112-j413-fw27.dts @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* J413 with macOS 27 system firmware (27.2 stub). */ +#include "t8112-j413.dts" + +/* + * The 27.x MTP firmware cannot be restarted once quiesced: a boot stage that + * starts it hands it over running (apple,rtkit-handoff). + */ +&mtp { + apple,rtkit-keep-running; +}; + +/* The 27.x trackpad firmware answers only the two-stage power command. */ +&mtp_hid { + multi-touch { + apple,power-method = <2>; + }; +}; diff --git a/arch/arm64/boot/dts/apple/t8122-j613.dts b/arch/arm64/boot/dts/apple/t8122-j613.dts index 1c503729a3101..7f1b54c9e1c0e 100644 --- a/arch/arm64/boot/dts/apple/t8122-j613.dts +++ b/arch/arm64/boot/dts/apple/t8122-j613.dts @@ -432,3 +432,8 @@ /* Per-device factory data from this Mac's own iBoot system container. */ firmware-name = "apple/mesacal-j613.bin"; }; + +/* The J613 MTP firmware cannot be restarted once quiesced: hand it over running. */ +&mtp { + apple,rtkit-keep-running; +}; From 63bdc1caccf6237874e1032392846099bb80daae Mon Sep 17 00:00:00 2001 From: Satya Benson Date: Fri, 20 Nov 2026 03:06:29 -0500 Subject: [PATCH 3/4] tools/asahi: j613-mtp-s2idle-tests: drop the unused board stub The helper no longer checks the board, so the harness's of_machine_is_compatible() stub was unused and failed -Werror. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Satya Benson --- tools/asahi/j613-mtp-s2idle-tests.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/asahi/j613-mtp-s2idle-tests.py b/tools/asahi/j613-mtp-s2idle-tests.py index 21d673862dac6..fbf39ce280e26 100644 --- a/tools/asahi/j613-mtp-s2idle-tests.py +++ b/tools/asahi/j613-mtp-s2idle-tests.py @@ -30,7 +30,6 @@ def fn(s,n): static unsigned forced_suspend,forced_resume; static int pm_runtime_force_suspend(struct device *d){forced_suspend++;return 7;} static int pm_runtime_force_resume(struct device *d){forced_resume++;return 8;} -static bool of_machine_is_compatible(const char *s){return true;} static unsigned readl(void *p){return *(unsigned *)p;} /* #1445: only a firmware-driven (T8140 S2R) sleep takes the noirq or AP-idle paths. */ static bool pm_suspend_via_firmware(void){return false;} From 45a78bfcffd0217e8c9099d92dd5913be4fdefe5 Mon Sep 17 00:00:00 2001 From: Satya Benson Date: Fri, 20 Nov 2026 03:22:28 -0500 Subject: [PATCH 4/4] scripts/dtc: apple-dt-check: report a board variant's warnings under its base board A firmware-profile variant such as t8122-j613-25g83 or t8112-j413-fw27 includes its board's .dts, so a new variant repeats every existing warning of that board under a new DTB name and fails the check. Report a variant's warnings under the base board's name instead. A warning only the variant has still shows up as new. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Satya Benson --- scripts/dtc/apple-dt-check.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/dtc/apple-dt-check.sh b/scripts/dtc/apple-dt-check.sh index 820d8dc2daf41..3942cd776c974 100755 --- a/scripts/dtc/apple-dt-check.sh +++ b/scripts/dtc/apple-dt-check.sh @@ -4,7 +4,9 @@ # and fail when HEAD has a warning BASE does not. Also runs dt_binding_check on every binding HEAD # changes. Phandle values in the messages are masked, so renumbering is not a new warning, and so # is the pattern list of a "does not match any of the regexes" message, which grows with every -# vendor prefix the bindings add. +# vendor prefix the bindings add. A firmware-profile variant (a .dts that includes another board's +# .dts, such as t8122-j613-25g83) is reported under its base board's name, so the base's existing +# warnings are not new warnings of the variant; anything the variant adds still is. # Needs dtschema (dt-validate), clang/lld (LLVM=1), flex, bison. Prints a summary. set -u BASE=$1 HEAD=$2 W=$3 @@ -17,8 +19,13 @@ warnings() { # rev tag local dtbs; dtbs=$(cd "$t/arch/arm64/boot/dts" && ls apple/*.dts | sed 's/dts$/dtb/') make -C "$t" O="$o" -j"$(nproc)" CHECK_DTBS=y $dtbs > "$W/$2.log" 2>&1 local rc=$? + local variants; variants=$(cd "$t/arch/arm64/boot/dts" && + grep -l '^#include "[^"]*\.dts"' apple/*.dts 2>/dev/null | while read -r v; do + sed -nE 's#^\#include "([^"]*)\.dts".*#s|^'"${v%.dts}"'\\.dtb: |apple/\1.dtb: |;#p' "$v" | head -1 + done) grep -E '\.dtb: |[Ww]arning|rror' "$W/$2.log" | grep -v '^ ' | sed -E "s#$t/##g; s#$o/##g" | + sed -E "s#arch/arm64/boot/dts/##; $variants" | sed -E 's#^apple/#arch/arm64/boot/dts/apple/#' | perl -pe 's{(\[\[[^:]*?\]\])}{(my $x = $1) =~ s/\d+/N/g; $x}ge; s{b\x27(?:\\.|[^\x27])*\x27}{b\x27N\x27}g; s{( not match any of the regexes): .*}{$1: ...}' | sort -u > "$W/$2.warn" echo "$2: make rc=$rc, $(wc -l < "$W/$2.warn") warning lines, $(echo $dtbs | wc -w) DTBs"