Skip to content

T8132 (MacBook Air 13-inch M4, J713): Touch ID profile and spi2 sensor node (on top of #200) - #248

Open
MuBai-He wants to merge 8 commits into
omacom:integration/aurorafrom
MuBai-He:j713-touchid
Open

MuBai-He wants to merge 8 commits into
omacom:integration/aurorafrom
MuBai-He:j713-touchid

Conversation

@MuBai-He

Copy link
Copy Markdown

Stacked on #200. The first five commits are #200's; review the last three.

Summary

Adds the 13-inch M4 MacBook Air (J713) next to #200's J715:

  1. apple_sep: T8132_J713, the J715 profile with J713's own FDR MSRk file, apple/msrk-j713.bin. It uses J715's rules: a 10,848-byte body, loaded only after SESSION_SHARE status 0x16, and one retry. It is selected only on apple,j713. The sensor description says what J713 reads back: ID 0x3356, mode 2. Adds three KUnit cases.
  2. dt-bindings: apple,t8132-spi.
  3. t8132.dtsi / t8132-j713.dts: spi2 and its Mesa sensor. Both are disabled in the SoC file, as in t8122.dtsi. J713 enables them with NUB GPIO 28, spi-cpol, 20 ns chip-select timing and apple/mesacal-j713.bin.
  4. Documentation: Documentation/input/devices/j713-touchid.rst.

No sbio.rs change was needed. On J713, a capture taken straight after calibration gets IMAGE_ASSESSMENT 0x16. The sensor must be registered again first: power cycle, identity, CLEAR_STATE, serial and nonce, session, patch and params, without the root key or calibration. The existing flow already does that before every enrolment and match.

How J713 differs from J715

  • Root-key file name. This is the only difference. The rules and input sizes are the same: the MSRk body is 10,848 bytes and the source-6 calibration is 130,427 bytes on both. The signed IMG4 payload alone (1,726 bytes) is refused with 0x1c.
  • Sensor description. 0x3356 and mode 2 are descriptive; the driver does not branch on them. J715 keeps the values it inherits from T8122, because nothing here was measured on J715.

Evidence

MacBook Air 13-inch M4 (J713). The gigalocker held 9 session records that Linux did not create. Test setup:

Results:

  • Activation: profile T8132/J713, 12 endpoints. The first SESSION_SHARE returned 0x16. The driver loaded msrk-j713.bin and the retry was accepted.
  • Use: the owner enrolled one finger. It matched twice and another finger was rejected twice.
  • Persistence: three cold boots, on two builds of the module. Each restored the enrolment from the Catacomb files. After a cold boot the enrolled finger matched and another finger was rejected; the owner confirmed both.
  • xART guard: default level 1, no refusals of enclave writes in builds without KUnit (see "Found while testing" for the KUnit build). The only gigalocker change was the enclave rewriting a shared root record (kind 1).
  • KUnit: ran at insmod on the J713. All 11 apple_sep suites passed: 124 cases, including the three new J713 cases, with 0 failures and 0 skips. The kit kernel has CONFIG_KUNIT=m, so the module was built with its suites enabled and kunit was loaded with enable=1.
  • DT: dtc 1.7.2 builds t8132-j713.dtb and t8132-j715.dtb with no warnings. The decompiled spi2 and sensor nodes match the live overlay property for property. The one difference is the controller compatible: the kit's spi-apple lacks hardware chip-select timing, so the run bound a copy of this tree's driver under a private compatible.
apple_sep 3aa600000.sep: SEP platform profile: T8132/J713
apple_sep: xART guard level 1: 9 session records exist, 0 created by Linux; the other 9 are protected
apple_sep 3aa600000.sep: sensor: SESSION_SHARE status 0x16; loading FDR MSRk
apple_sep 3aa600000.sep: Touch ID: restored 1 enrolled identity/identities; enrolment survived reboot

Found while testing (existing code, not changed here)

When APPLE_SEP_KUNIT_TEST is enabled, apple_sep_xart_guard calls Guard::check() on its test guards. Each refusal in a test also calls crate::diag::xart_guard_refused(), which counts it in the driver's global refusal counter. After the suites run at insmod, diag/xart_guard_refusals reads 13 and diag/matching reads blocked. Meanwhile diag/touchid is ready, matching works, and no enclave write was refused. All 13 refusal messages fall between the suite's KTAP version 1 line and ok 1 apple_sep_xart_guard.

A readiness check that trusts diag/matching would turn Touch ID off on a kernel built with the tests. One possible fix is to skip the diag call under kernel::kunit::in_kunit_test(). That belongs in its own change, so it is not included here.

Not tested

  • Keybag creation with the guard on. This Mac's identity keybag was created earlier by a development build with xart_guard=0. Under guard 2, the enclave's rewrite of the kind-2 shared root was refused. Under guard 1 it then rewrote a session record that predates Linux, which was also refused. integration/aurora has since added a first-setup window (1f45121, 5447fa2), which this branch does not include. A fresh J713 setup with the guard on has not been run.
  • In-tree build. The driver was built only as the 7.1.9 port, not in this tree.
  • Booting the in-tree t8132-j713.dtb. The hardware run used the kit DTB plus an overlay.
  • rustfmt and dt_binding_check, which were not available.
  • The data-ready interrupt; the driver polls.
  • Login through fprintd/PAM, and suspend with the SEP active.
  • Re-running J715. This branch adds only a new variant and a new detect() branch.

Merge Danger

Door: two-way

Blast Radius: J713 only. The profile is selected only on apple,j713, and J715 and the other profiles are unchanged. In t8132.dtsi, spi2 and the sensor are disabled; only t8132-j713.dts enables them. On a J713 without apple_sep, spi-apple binds spi2 and the sensor node has no driver, as on J613. As on J715, the SEP nodes stay disabled and the sep alias is not set.

Private data: none in the patches. msrk-j713.bin and mesacal-j713.bin are per-machine files supplied at provisioning.

Assisted-by: Claude:claude-opus-5-5

audreyt and others added 8 commits October 24, 2026 11:33
The M4 (T8132) SEP DART and SEP mailbox are the same parts as on T8122.
Add apple,t8132-dart, with the apple,t8110-dart fallback, and
apple,t8132-asc-mailbox, with the apple,asc-mailbox-v4 fallback.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Audrey Tang <au@civic.ai>
Describe the M4 SEP the way t8122.dtsi does: the SEP and its DART
disabled, the DART carrying the SEP's own IOVA window from the J715 ADT
(dart-sep vm-base-0 0x10000004000, vm-size-0 0xffff0000) with no offset,
and the ASC mailbox inside the SEP wrapper at +0x8000.

The ADT lists the mailbox interrupts as 390 389 392 391. In that order
the recv-not-empty slot holds the line that is asserted while the
receive FIFO is empty; the ASC v4 mailbox has no IRQ acknowledge, so
starting the channel polls an empty FIFO in hard IRQ context and the
machine freezes. Use 389 390 391 392, the order the T8122 SEP mailbox
and the other T8132 ASC mailboxes use.

No board adds the sep alias yet. With the alias, m1n1 hands the SEP its
firmware region and manifests, but current m1n1 keeps a pointer from
fdt_get_alias() across inserting memory-region, and on T8132 its SEP ROM
random request leaves the running sepOS no longer reading its mailbox.
Both are fixed in Kb2uka/Omarchy-M4-Native#168; the alias can follow
once the bootloader carries them.

Tested on a 15-inch M4 MacBook Air (J715) with equivalent nodes in the
Omarchy M4 kit tree: the mailbox starts without freezing and the SEP
answers.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Audrey Tang <au@civic.ai>
The 15-inch M4 MacBook Air (J715) hands over a running SEP (ADT
sepfw-booted), like the M3 Air, so this is T8122's warm registration,
shared-memory geometry, variant-5 key store and xART guard default.

Its SEP DART window is the ADT's own, 0x100_0000_4000 + 0xffff0000,
given as a range with no offset. This matches what t8132.dtsi carries,
and unlike the BIT(40) offset window it also reaches the SEP on kernels
whose DART driver does not apply apple,dma-offset. The Mesa sensor is on
spi2 at 0x3ad108000; its identity is unchecked, so capture stays
unqualified. Only J715 selects the profile.

Tested on a J715 (macOS 27.0.1) with an earlier port of this driver on
the Omarchy M4 kit kernel (7.1.9), the DART window set the same way and
the m1n1 fixes from Kb2uka/Omarchy-M4-Native#168: the SEP attaches with
12 endpoints, the identity keybag is provisioned, a P-256 key held by
the SEP signs through OpenSSH, and the same key signs after a reboot
with the driver loaded at boot. With the 0..4 GiB offset window on that
kernel the SEP never answered.

Not tested: this tree on hardware, the xART guard on J715 (the tested
Mac provisioned before the guard existed), and Touch ID.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Audrey Tang <au@civic.ai>
Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
load_sensor_root_key returned without sensor_step_failed when the container length was rejected, so an empty msrk-j700.bin lost the SENSOR_ROOT_KEY step failure it reported before the profile rework. Report it again for every rejected length.

Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
The 13-inch M4 MacBook Air (J713) describes the same SEP and sensor wiring
as J715 in its ADT: sepfw-booted, the same dart-sep window, and a Mesa
sensor on spi2 at 0x3ad108000. Its sensor session uses the same nonce
authentication, and SESSION_SHARE answers 0x16 until the machine's own
FDR MSRk body is loaded.

Add T8132_J713, the J715 profile with SensorRootKey::J713. It names
apple/msrk-j713.bin and follows J715's 10,848-byte rule and its single
retry after status 0x16. The sensor description records what J713 reads
back: ID 0x3356 in mode 2. Select it only on apple,j713.

Tested on one J713 with this profile ported to the Omarchy M4 kit kernel
7.1.9 and the default xart_guard of 1. The first SESSION_SHARE returned
0x16, msrk-j713 was loaded and the retry was accepted. One finger was
enrolled and matched, and another finger was rejected. After a cold boot
the enrolment was restored from the Catacomb files and matched again. The
guard refused no write. The identity keybag was created before this run
by a development build with the guard off; j713-touchid.rst explains why.

KUnit ran on the same J713 at insmod, with this tree's apple_sep suites
built into that port and kunit.enable=1: all 11 suites passed, 124 cases
including the three J713 ones, with no failures or skips.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: MuBai-He <51275418+MuBai-He@users.noreply.github.com>
The M4 (T8132) SPI controllers are the T8103 block. Its spi2 carries the
Touch ID sensor on the 13-inch MacBook Air (J713).

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: MuBai-He <51275418+MuBai-He@users.noreply.github.com>
Describe spi2 and its Mesa fingerprint sensor in t8132.dtsi, both
disabled, as t8122.dtsi does. Enable them on J713 with the values from
its ADT (/arm-io/spi2/mesa): power on NUB GPIO 28, active high, and 20 ns
chip-select setup and hold. The sensor answers in mode 2, so the board
sets spi-cpol. The data-ready line (AP GPIO 199) is left out, so the
driver polls. The calibration file is named per board, as on J613.

The controller runs from clkref, which divides to 8 MHz exactly. The
hardware run used these properties, applied as an overlay on the Omarchy
M4 kit's device tree, with clkref, AIC interrupt 1056 and ps_spi2. The
kit kernel's spi-apple lacks hardware chip-select timing, so that run
bound a copy of this tree's driver under a private compatible.

The SEP nodes stay disabled and the sep alias is not set, as on J715.

dtc 1.7.2 builds t8132-j713.dtb and t8132-j715.dtb without warnings.
dt_binding_check was not run.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: MuBai-He <51275418+MuBai-He@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants