Skip to content

input: apple_mtp_kbd: leave an MTP handed to the OS halted alone - #69

Merged
DjDeveloperr merged 1 commit into
aurora-silicon:aurora-wipfrom
kazuhidet:j715/mtp-cold
Nov 25, 2026
Merged

DjDeveloperr merged 1 commit into
aurora-silicon:aurora-wipfrom
kazuhidet:j715/mtp-cold

Conversation

@kazuhidet

@kazuhidet kazuhidet commented Nov 22, 2026 •

Copy link
Copy Markdown

Summary

On the J715 (MacBook Air 15-inch, M4), the MTP has the same problem as on the J604 in #44:

Instead of adding the J715 to the board list, the probe now returns -ENODEV whenever /chosen linux-enablement-mac,dapf-halted-handoff names /arm-io/mtp, the MTP's ADT path. This is the property the earlier stage reads to hand the MTP over halted. Every tree that asks for a halted MTP gets one, with no table.

Board Before After
J604 skipped by its apple,j604 entry skipped by the property, which t8132-j604.dts has. That entry goes
J715 started, then crashed in Linux skipped, once #2745's tree is in
J813, T6050 skipped by their entries unchanged: their trees don't name the MTP there
everything else unchanged unchanged

The cost is the one #44 accepted: no internal keyboard in U-Boot or GRUB on these boards.

Testing

J715 (Mac16,13), OS firmware 26.6.2, stage 1 → aura → U-Boot → Linux, three boots:

  • Same parts in every boot:
  • One test-only patch in all three, not in this PR. It makes apple_nvme_probe() return -ENODEV on the J715 before touching the controller.
    • This Mac's stage 1 resets the ANS and shuts NVMe down before it chainloads the next stage, so U-Boot cannot use NVMe here.
    • The kernel was carried in the boot.bin and started with booti from preboot, so the EFI/GRUB path was not tested.
aurora-wip 5445237 + board entry (first version of this PR) + this change
U-Boot mtpkbd: keyboard not ready after 1000 ms, MTP CPU_CTRL 0x10 (RUN) mtpkbd: keyboard failed to start (-19) mtpkbd: keyboard failed to start (-19)
Linux MTP RTKit: co-processor has crashed 0.3 ms after init. Data abort (ESR 0x96000004) at the same firmware PC as the J604 crash in #44, then -ETIME, probe -62 "MTP Says Hello", no crash "MTP Says Hello", no crash
Input none; keyboard and trackpad dead "Apple MTP keyboard", "Apple MTP multi-touch"; both work same
  • CPUs 0-9 in every boot, and no DART faults in the records.
  • One recorded boot of each build.

Off the hardware:

  • apple_m1_defconfig builds with KCFLAGS=-Werror (GCC 16.1, aarch64).
  • test_apple_mtp_keyboard.py and test_apple_helper_handoff.py pass with --noconftest (9).
  • checkpatch is clean.

The J604 was not re-run. Its tree in integration/aurora (d1b022d) has the property, so it should take the same path as before, now through the property.

Relation to #55 and #57

Merge order: this depends on aurora-silicon/linux#2745 for the J715. Without it, the J715's tree has no property, and its MTP faults in Linux anyway (CTE invalid).

@RyanTheTide

Copy link
Copy Markdown
Contributor

Read at 62f2327. The diagnosis is clear (same firmware build and the same crash PC as the J604), and the before/after rows show the change does what it says.

The shape is the issue: this grows a board list in apple_mtp_kbd_probe() (J604, J813, now J715), and the next M4/M5 laptop with the same MTP firmware needs another entry. The condition that matters is already in the device tree: the MTP is handed to Linux as a halted consumer (linux-enablement-mac,dapf-halted-handoff names /arm-io/mtp, which linux#2745 adds for the J715 and t8132-j604.dts has). If U-Boot's probe returned -ENODEV whenever the tree says the MTP is to be left halted for Linux, the J604, J715 and any later board would follow from their trees with no list. The J813 entry could move to the same rule if its tree says the same.

Cost note stays as you wrote it (no internal keyboard in U-Boot/GRUB on these boards). If that's acceptable for now, a follow-up to key it on the property is fine; please say so in the commit message.

Assisted-by: LLM (Claude:Opus 5.5)

When the device tree names the MTP (/arm-io/mtp) in /chosen
linux-enablement-mac,dapf-halted-handoff, the earlier stage hands it to
the OS halted and Linux cold-starts it. U-Boot's MTP keyboard probe
starts it first and stops it again at OS entry, and the firmware does
not survive the second start: on the J715 (MacBook Air 15-inch, M4),
Linux's RTKit init is followed 0.3 ms later by "co-processor has
crashed", the same data abort as on the J604, and the internal keyboard
and trackpad are gone.

Refuse the keyboard whenever the tree says so, instead of listing
boards. The J604's tree has the property, so its entry goes; the J715's
gets it from aurora-silicon/linux#2745. The J813 and T6050 keep theirs,
since their trees don't name the MTP there. U-Boot then has no internal
keyboard on these boards, and Linux gets a firmware nobody ran.

Tested on a J715 (OS firmware 26.6.2) with the #2745 tree: with
aurora-wip as is, the MTP crashes in Linux; with this change, "MTP Says
Hello" and the keyboard and trackpad work.

Signed-off-by: Kazuhide Takahashi <[email protected]>
@kazuhidet kazuhidet changed the title input: apple_mtp_kbd: leave the J715's MTP to Linux input: apple_mtp_kbd: leave an MTP handed to the OS halted alone Nov 22, 2026
@kazuhidet

Copy link
Copy Markdown
Author

Thanks, done as suggested:

  • The probe now keys on /chosen linux-enablement-mac,dapf-halted-handoff naming /arm-io/mtp.
  • The J604 and J715 entries are gone.
  • The J813 and T6050 entries stay: their trees don't name the MTP there.

I re-ran the J715 with this version: same result as the board entry. "MTP Says Hello", keyboard and trackpad, and U-Boot's keyboard probe refused. Title, commit message and description are updated; it is still one signed commit on aurora-wip.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-review of da9bad5. The board entries are gone. The probe now refuses the keyboard when /chosen linux-enablement-mac,dapf-halted-handoff names /arm-io/mtp. That is the same property the earlier stage acts on when it hands the MTP over halted, so U-Boot and the boot stage now agree by construction. ofnode_stringlist_search() also handles a tree that lists several nodes there. J604 is unchanged, since t8132-j604.dts already has the property, and the J715 row at this head shows the fix.

One ordering note: for the J715 this only takes effect once aurora-silicon/linux#2745 lands. Until then the J715 tree has no property and behaves as aurora-wip does today, so merging this first is safe. Approving from my side.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr DjDeveloperr left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formal §1–§6 pre-PR checklist review at da9bad51901e06d2499865df4a5fb727454821c7.

The code change in drivers/input/apple_mtp_kbd.c is clean and directly resolves §1 model gating for halted MTP handoffs: apple_mtp_halted_for_os() checks /chosen linux-enablement-mac,dapf-halted-handoff for "/arm-io/mtp" via ofnode_path() + ofnode_stringlist_search() (valid on both flat FDT and live tree), matching aura/src/dapf.c, t8132-j604.dts:31, and aurora-silicon/linux#2745, removing the apple,j604 board gate without adding apple,j715.

Blockers

  1. Live CI has not run (action_required):
    • Fork workflow run 45015840143 (Apple builds, covering both apple_m1_defconfig and apple_j873_defconfig with WERROR) has conclusion action_required and has not executed on da9bad51. Maintainer CI approval and a green Apple builds run are required before approval/merge.
  2. §5 Missing regression run counts (and J604 verification ask):
    • The J715 test table records U-Boot refusal (-19), Linux "MTP Says Hello", working keyboard/trackpad, CPUs 0–9, and 0 DART faults, but omits the §5 regression counts on the J715 boot (0 SELinux denials, 0 failed units, 0 new kernel errors). Please add the explicit regression counts from the J715 boot.
    • Because this removes the explicit apple,j604 compatibility check in favor of the /chosen property, please explicitly request a J604 verification run (per §1, when you do not have the other affected Mac on hand) so we confirm J604 remains unchanged on da9bad51.

Checklist summary & non-blocking notes

  • §1 No model gating: Pass on code — replaces the apple,j604 board gate with the /chosen linux-enablement-mac,dapf-halted-handoff DT property and documents why apple,j813 and apple,t6050 remain (their trees do not carry that property). Safe to merge ahead of aurora-silicon/linux#2745 since absence preserves existing behavior.
  • §2 Production-ready: Pass on code (no new cmdline/env/delay hacks; local NVMe test-only patch is clearly disclosed as out of tree).
  • §3 Safety: Pass (prevents starting a halted MTP whose firmware crashes on second start in Linux).
  • §4 Clean-room & attribution: Pass (single commit da9bad51 with human author/committer + human Signed-off-by: only, zero AI trailers).
  • §6 Naming: Pass.
  • Non-blocking note: Consider adding a small host unit test in test/py/tests/test_apple_mtp_keyboard.py exercising apple_mtp_halted_for_os() when /chosen/linux-enablement-mac,dapf-halted-handoff contains "/arm-io/mtp".

@kazuhidet

Copy link
Copy Markdown
Author

Thanks. Here are the regression counts for the J715 boot in the table (U-Boot refuses the keyboard with -19, then Linux starts the MTP: MTP Says Hello, keyboard and trackpad work, CPUs 0-9).

  • SELinux: N/A (not enabled on this install).
  • Failed units: 2, both local services of this install (j713-owner-assets, m4-j715-backlight). They fail the same way on the J715's everyday boot without U-Boot, and neither is related to the MTP or to input.
  • New kernel errors: 0. The only error lines are the known ones on this J715: avd probe -2 (no AVD firmware file), and hid-generic … device has no listeners.

Setup of that boot:

  • Kernel: the J715's everyday 7.3.0-j715-aurora+.
  • Device tree: /chosen had linux-enablement-mac,dapf-halted-handoff = "/arm-io/mtp" (#2745).
  • U-Boot: the build described in the table, i.e. the halted-handoff rule plus the local, test-only NVMe patch, on 5445237f.

J604: I don't have a J604. Could someone with a J604 (14-inch MacBook Pro, M4) boot da9bad51 through U-Boot and confirm the keyboard still behaves as before?

  • t8132-j604.dts carries dapf-halted-handoff = "/arm-io/mtp", so on a J604 the skip now comes from that property instead of apple,j604, with the same effect.
  • What would show it:
    • the U-Boot log line for apple_mtp_kbd (-19, as before);
    • Linux printing MTP Says Hello, with a working keyboard and trackpad;
    • the regression counts.

@davishann15-commits @samuelkurt, you've reported from a J604 before. Would one of you be able to?

I'll also look at the host unit test you suggested in test/py/tests/test_apple_mtp_keyboard.py, as a separate commit.

@samuelkurt

samuelkurt commented Nov 24, 2026 •

Copy link
Copy Markdown

Tested on a J604 (MacBook Pro 14-inch, M4; OS firmware 26.6.2, system firmware 27.2), booted through U-Boot da9bad5 (2026.07-gda9bad51901e, apple_m1_defconfig) with aura 1.0.0b15 and kernel 7.3.0-41.fc44.aurora. /chosen has linux-enablement-mac,dapf-halted-handoff = "/arm-io/mtp".

  • U-Boot: [apple_mtp_kbd line, e.g. -19]
  • Linux: "MTP Says Hello", no co-processor crash, Apple MTP keyboard and multi-touch registered. The keyboard and trackpad work (used to log in).
  • Regression counts: SELinux Enforcing; failed units 0; new kernel errors 0. The only error lines (brcmf -52, erofs -4) also appear on the same machine's boot with the packaged U-Boot (250385f, which still has the apple,j604 match).

Sidenote:

  • The Keyboard doesn't work in GRUB.
  • The Backlight doesn't work.

@kazuhidet

Copy link
Copy Markdown
Author

@samuelkurt thank you for the J604 row. That's the confirmation this PR needed: on da9bad51, with dapf-halted-handoff = "/arm-io/mtp", Linux cold-starts the MTP and the keyboard and trackpad work, with 0 failed units and 0 new kernel errors under SELinux Enforcing.

Two small things:

  1. The U-Boot line in your list is still the template text ([apple_mtp_kbd line, e.g. -19]). If you still have the screen or a photo, could you add the actual mtpkbd: line? If it prints keyboard failed to start (-19), the skip now comes from the /chosen property, as intended.

  2. Keyboard in GRUB: that's expected with this PR. U-Boot leaves an MTP that is handed to the OS halted alone, so U-Boot and GRUB have no internal keyboard on that Mac, and Linux starts the MTP itself.

    • On the J604 this should be unchanged from the packaged U-Boot (250385f), which skips the MTP through its apple,j604 match.
    • If GRUB's keyboard does work with 250385f on the same machine, please say so: then this PR changes behaviour on the J604, and that needs a look.

The backlight is outside this PR.

@samuelkurt

Copy link
Copy Markdown

U-Boot: mtpkbd: keyboard failed to start (-19). da9bad5 drops the apple,j604 match, so the skip now comes from the /chosen property. Captured from the screen with /chosen/u-boot,verbose set, since CONFIG_VIDEO_QUIET_BOOT keeps it off the display on a normal boot.

@github-actions github-actions Bot added changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks required sections (bot) labels Nov 24, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at da9bad51901e: the code is ready; it needs one more row.

Blockers: none in the code. Missing row: this driver starts the keyboard on every laptop, so before it merges it also needs one boot at this head on a laptop from another generation (a J813, or an M2 or M3 laptop): U-Boot still starts the MTP where the property is absent, and the keyboard works in U-Boot and Linux.

Checked: no Apple material. This adds a property check: an MTP named in /chosen/linux-enablement-mac,dapf-halted-handoff is left halted for the OS, and the J813 board check stays for now. CI is green, and your J715 row (U-Boot leaves the MTP alone with -19, Linux starts it, and the keyboard and trackpad work) covers the board. Thanks.

@DjDeveloperr
DjDeveloperr dismissed their stale review November 24, 2026 21:01

Superseded by the review at da9bad5

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 24, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

da9bad51901e J413 (M2 Air, T8112, non-M4 MTP laptop, 7.3.0-aurora-fleet89, default cmdline, guarded Stage 2 aura-try one-shot) headless boot + Linux MTP handoff PASS:

  • Booted exact U-Boot 2026.07-gda9bad51901e (DMI: Apple Inc. MacBook Air (13-inch, M2)/J413, BIOS aura 1.0.0b17 / U-Boot 2026.07-gda9bad51901e), /chosen/linux-enablement-mac,dapf-halted-handoff absent, same aura 1.0.0b17 and live DTBs.
  • Linux MTP + DockChannel HID handoff clean: rtkit-helper 24e400000.mtp and dockchannel-hid 24eb30000.input brought up Apple MTP keyboard (event1), Apple MTP multi-touch (event2), Apple MTP actuator (hid-apple-mtp-haptic), stm, and tp_accel; 0 MTP/HID errors in journalctl -k -b -p err, 0 kernel errors total, 0 AVC, 0 failed units, SELinux Enforcing.
  • Restored to production Stage 2 (U-Boot 2026.07-g5445237f1dcb, /boot/efi/m1n1/boot.bin unchanged).
  • Scope note: unattended headless run (CONFIG_BOOTDELAY=0, CONFIG_VIDEO_QUIET_BOOT=y), so interactive keypresses at the U-Boot prompt and visual capture of mtpkbd screen lines were not performed physically.

@github-actions

Copy link
Copy Markdown

Merge readiness at da9bad51: ready to merge

Check Detail
CI at head ok 2 checks passed
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok comment at da9bad51
Conflicts ok none
PR text adopt when you next edit add a 'Tested:' line; a 'Risk:' line (door and Macs) (guide)

Areas: none matched in CODEOWNERS
Merge: gh pr merge 69 --merge (Owners and Core through the bypass: add --admin).

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-template PR body lacks required sections (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants