Repository navigation
arm: apple: park the T8140 MTP at OS entry with its pristine image - #49
Draft
RyanTheTide wants to merge 3 commits into
Draft
RyanTheTide wants to merge 3 commits into
RyanTheTide wants to merge 3 commits into
Conversation
U-Boot starts the T8140 MTP for its own keyboard and used to hand the running session to the OS. It reserved the firmware's DRAM buffers, left the DART stream in bypass and set apple,rtkit-handoff = "mtp-live-v1". Linux then had to adopt that session and could never restart it. Stop it before the OS instead. The remove path now asks for an RTKit sleep rather than QUIESCED, clears the run bit and releases the DART bypass, and the OS device tree fixup publishes nothing for this helper. A firmware stopped for a sleep starts again from its reset vector, so the OS can reset the MTP's CPU and run it as its own. U-Boot's keyboard and its INIT replay into the FIFO don't change. J713, J614s and the other helpers keep their handoffs and the QUIESCED stop. A failed stop is now logged. A kernel without the matching rtkit-helper restart loses the internal keyboard and trackpad, as the Kconfig help says. Signed-off-by: Diljit Singh <[email protected]>
The T8140 MTP keeps its firmware in SRAM and a run changes the firmware's data there, so the OS can't start a firmware U-Boot ran just by resetting its CPU (INIT is never read). U-Boot has handed the running session over instead. When the boot loader before U-Boot sets /chosen/aurora,mtp-handoff = "off", park it instead: - before the first run, copy the whole firmware SRAM (reg "firmware") into memory U-Boot never gives back, and take its CRC-32; - at OS entry, stop the firmware with an RTKit sleep and clear the run bit (as before), then put every word of the MTP's power chain in the always-on PMGR fully on with automatic power management off (apple,aon-pmgr, apple,aon-power-words), and disable the CPU and hold it in reset (apple,aon-cpu-word); - the OS tree gets the image as no-map reserved memory, its address and size in apple,sram-image and its CRC in apple,sram-image-crc32, and no live session. The OS writes the image back and starts the firmware as one nobody ran. Without the property, or if the image couldn't be kept or passed on, the OS gets the running session as before. Assisted-by: LLM Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Ryan Murray <[email protected]>
This was referenced Nov 19, 2026
Contributor
Author
|
Early note on this draft (no full review yet):
Assisted-by: LLM (Claude:Opus 5.5) |
Contributor
Author
|
Besides the two points in the earlier note, commits cfb83d5 and f82884b carry Co-Authored-By and Assisted-by trailers in the commit message; they need replacing with commits that carry only the author's Signed-off-by. This also still waits on aurora-silicon/linux#1813 (open, draft) and on #37, whose commit it carries, plus a J700 row with parking as the default. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
U-Boot starts the T8140 MTP for its own keyboard and trackpad, and today hands the running session to the OS (
mtp-live-v1). This parks it at OS entry instead, so the OS can start it as a firmware nobody ran. The counterpart on the Linux side is aurora-silicon/linux#1813.It carries #37's commit unchanged (the RTKit sleep stop at OS entry), plus one commit on top.
Why a CPU reset isn't enough
The MTP keeps its firmware in SRAM, and a run changes the firmware's data there. #37's stop plus a CPU reset in Linux started the firmware from its reset vector with that data dirty, and it never read INIT. The only clean image a later stage can get is the SRAM as iBoot loaded it, before the first run.
What this does
It applies only when the boot loader before U-Boot sets
/chosen/aurora,mtp-handoff = "off", which an aura Stage 2 passes with the configuration linechosen.aurora,mtp-handoff=off.reg-names"firmware") into memory U-Boot never gives back, and take its CRC-32.mtp-image@...). On themtpnode,apple,sram-image = <address size>andapple,sram-image-crc32. Noapple,rtkit-handoffand no live buffers.apple,aon-pmgr,apple,aon-power-words, parents first). The MTP SRAM has two parents, the SCM fabric and the CPU. Last, the CPU is disabled and held in reset (apple,aon-cpu-word).Without the property, or if the image can't be kept or passed on, the OS gets the running session as before. So a kernel without linux#1813 keeps its keyboard.
Tested
apple_m1_defconfigwithCONFIG_APPLE_MTP_KEYB=yandCONFIG_WERROR=y: builds with no warnings.test_apple_helper_handoff.pyandtest_apple_mtp_keyboard.py: 9 passed. The T8140 cases now check that a parked MTP passes its image on and adopts nothing, and that the stop parks it once, after the run bit is clear.