Repository navigation
arm: apple: choose the MTP handoff in one place - #55
RyanTheTide wants to merge 3 commits into
Conversation
Once MTP firmware has run, it cannot be started again. Taken to QUIESCED or SLEEP and restarted by the next owner, it faults or never answers. This has been seen on T8122 (J613), T8132 (J604), T8140 (J700) and T8142 (J813). Each board got its own fix: a live handoff on J700, J713, J614s and J613, a cold MTP on J813, J604 and T6050, and three board lists that decide which board gets which. Choose the handoff once, in apple_rtkit_helper_handoff(), from the MTP node's compatible: - An M2-generation MTP (apple,t8112-mtp, apple,t6020-mtp) restarts cleanly, and so does a helper that is not an MTP. U-Boot stops it at OS entry, as before. - iBoot already runs the T8142 and T6050 MTPs before the OS, so U-Boot never touches them: the helper and keyboard do not bind. - Every other MTP is started only if its DART is in bypass, and is handed to the OS running (mtp-live-v1). The T8132 and T6041 MTPs keep the retained form (system endpoint mask, startup drain, legacy marker). Linux keys its adoption of these MTPs on the same compatibles. The live handoff is now the same on every SoC that uses it. The buffer inventory is always published. No session is published before the keyboard's READY. A failed publication stops the MTP and disables it and its keyboard in the OS tree. A published session whose DART retention fails refuses OS entry. OSLog stays in SRAM unless the helper has no SRAM region, or on T8140, where the handoff has only been run with OSLog in DRAM. The board lists in apple_rtkit_helper_allowed(), apple_mtp_kbd_probe(), board_late_init() and ft_board_setup() go away. The J713 startup drain runs for every retained-form MTP, found through the DockChannel keyboard's helper. This reworks the per-board handoffs by DjDeveloperr (T8140), Eryk Wieliczko (J713), Michal S. (J614s) and Satya Benson (J613), and the J813 and J604 cold paths by Acelogic and aeries0x. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This reverts commit 9e748a1. It moved several boards from a cold MTP to the live handoff without hardware rows and made the live handoff the target policy. The next commit keeps the single selector and every board's current behaviour; the behaviour changes follow separately. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Once MTP firmware newer than the M2's has run, it cannot be started again, and every board got its own fix for that, spread over board lists in apple_rtkit_helper_allowed(), apple_mtp_kbd_probe(), board_late_init() and ft_board_setup(). Gather the decision in apple_rtkit_helper_handoff(), which reads the MTP node: - RESTART: M2-generation MTPs (apple,t8112-mtp, apple,t6020-mtp) and helpers that are not an MTP; U-Boot stops them at OS entry. - OS: apple,t8142-mtp and apple,t6050-mtp, which iBoot already runs; U-Boot never touches them. - PARK: every other MTP when /chosen/aurora,mtp-handoff is "off" and the MTP can be parked. The park sequence plugs into rtkit_helper_can_park(), which returns false for now. - LIVE: the fallback, on the boards where it is qualified (J700, J613, J713, J614s). Until each board has a hardware row, the J604 and the other T6041 boards keep a cold MTP and the remaining boards keep the restart path, from one table next to the selector. The live publication form follows the MTP too: retained for T8132 and T6041, with an inventory for T8122, plain for T8140. Every caller asks the selector instead of a board compatible. Behaviour is unchanged except in two places. The J815 and other T8142 boards now leave the MTP to the OS like the J813. A failed J613 publication now stops the MTP and disables it and its keyboard in the OS tree, as on J713, instead of panicking. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
J704 (MacBook Pro 14-inch, M5, apple,t8142-mtp) on this PR's head, 59d31da (apple_m1_defconfig), as the ESP Stage 2 payload after aura (aura → U-Boot → GRUB → Fedora 44 KDE, LUKS root), normal boot:
With plain aurora-wip (37baf8f), the same setup has a crashed MTP and no keyboard at the prompt (control run on #66). So this covers the J704, and I'll close #66 in favour of this PR. AI-assisted (Assisted-by: LLM), tested by me on the hardware. |
|
Collecting the handoff choice into apple_rtkit_helper_handoff() is a good step, but the rtkit_helper_unparked[] table in arch/arm/mach-apple/rtkit_helper.c still keys it on machine compatibles: apple,t8132-mtp is LIVE on apple,j713 but OS on apple,j604, and apple,t6041-mtp is LIVE only on apple,j614s. Two boards with the same MTP and firmware get different handoffs, and a new board silently falls into whatever the NULL row says. The production version decides from the MTP node itself (its compatible, the firmware version it reports, or a property the earlier stage publishes) with no board column, and the per-board rows go away as the hardware rows come in. Until then this should stay a draft. |
|
Blockers: 3. These build on the earlier comment about the board column in
What I checked: the old and new per-board choices for J413, J700, J613, J713, J614s, J604, J813, T6041 and T6050. Apart from the two changes listed, they agree. HW row: this head as a one-shot Stage 2 on the J700 (live), J616s (cold), J413 (restart) and M1 Pro (no MTP). On each: U-Boot keyboard in GRUB where it applies, Linux keyboard and trackpad, no RTKit crash dump, 0 failed units and 0 new kernel errors. Add a J715 or J615 if the default changes. Assisted-by: LLM (Claude:Opus 5.5) |
|
Verified on MacBook Pro (14-inch, M5, 24 GB, Skipping Tested-by: WJW [email protected] |
Refactor with no intended behaviour change, apart from the two cases listed below. Squash-merge recommended: the branch history keeps an earlier, wider version of this change followed by its revert. The behaviour changes that version made now live in the stacked draft #57.
What it does
Once MTP firmware newer than the M2's has run, it cannot be started again: taken to QUIESCED or SLEEP and started by the next owner, it faults or never answers (T8122 J613 #30, T8132 J604 #44, T8140 J700 c523219/#37, T8142 J813 fbfe606). Every board got its own fix for that, and the choice between them was spread over board lists in
apple_rtkit_helper_allowed(),apple_mtp_kbd_probe(),board_late_init()andft_board_setup().This PR makes the choice in one place,
apple_rtkit_helper_handoff(), which reads the MTP node:RESTARTapple,t8112-mtp,apple,t6020-mtp, or a helper that is not an MTPOSapple,t8142-mtp,apple,t6050-mtpPARK/chosen/aurora,mtp-handoff = "off"and the MTP can be parkedrtkit_helper_can_park(), which returns false here (see "Relation to #49").LIVEmtp-live-v1).Until each board has a hardware row, the unparked fallback keeps today's per-board behaviour. It comes from one table next to the selector:
The live publication form also follows the MTP: retained for T8132/T6041, with an inventory for T8122, plain for T8140. It used to be picked by
j713/j614s/j613. Every caller (helper bind and probe, keyboard bind and probe,board_late_init()'s keyboard start and retained-input drain,ft_board_setup()) now asks the selector.Behaviour changes (only these two)
Credit: this reworks the per-board handoffs by DjDeveloperr (T8140), Eryk Wieliczko (J713), Michal S. (J614s) and Satya Benson (J613), and the J813/J604 cold paths by Acelogic and aeries0x.
Relation to #49 (park)
This PR does not stack on #49. #49 is still a draft and has not run on hardware, and it carries #37, which fails on hardware. This PR gives it a hook instead:
rtkit_helper_can_park(). The natural hardware property is an MTP node that describes its always-on power chain (apple,aon-pmgr,apple,aon-power-words,apple,aon-cpu-word, and a"firmware"reg); linux#1813 adds those to the T8140 DT.rtkit_helper_stop()forAPPLE_RTKIT_HELPER_PARK.PARKinapple_rtkit_helper_fdt_fixup()./chosen/aurora,mtp-handoff = "off"is already read by the selector, so arm: apple: park the T8140 MTP at OS entry with its pristine image #49 no longer needs a T8140 branch.Tests
apple_m1_defconfig, GCC 16.1 aarch64,KCFLAGS=-Werror: builds clean.test/py/tests/test_apple_*.pywith--noconftest: 36 passed, 2 skipped. Two of these tests are new:test_helper_handoff_follows_the_mtpchecks the handoff, the retained form andallowed()for 16 MTP/board rows (J413, J414, J813, J815, J714c, J700, J613, J504, J514c, J713, J604, J715, J614s, J616s, J616c, and a non-MTP helper), with noaurora,mtp-handoff, with"off"and with"live". Each row matches today's behaviour, apart from the T8142 J815.test_live_publish_plain_and_inventory_formsruns the generic live publication against real libfdt in both forms.Hardware rows owed
None are needed for the refactor beyond a regression boot. Each is a one-shot U-Boot boot to the prompt, then Linux through EFI, checking the keyboard in U-Boot/GRUB and the keyboard and trackpad in Linux:
Stacked behaviour changes (unparked MTPs go live on every board, one live publication form): #57 (draft).