Skip to content

soc: apple: sep: select the platform profile by SoC - #2631

Open
RyanTheTide wants to merge 2 commits into
integration/aurorafrom
sweep/soc-gates-sep-rebase-20261121
Open

RyanTheTide wants to merge 2 commits into
integration/aurorafrom
sweep/soc-gates-sep-rebase-20261121

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Replaces #2311, rebased onto current integration/aurora (conflicts in drivers/soc/apple/profile.rs: the Touch ID list keeps the base's J813/J815 entries plus this PR's boards, 25 in all; the base's new t8142_sensor_boards_require_the_matching_soc KUnit case now expects T8142 on every board with the SoC (J814, J704, no board) and still refuses a T8142 board on another SoC).

Problem

drivers/soc/apple/profile.rs:697-720 (0abc2f3) chose the SEP platform profile on T8122, T6040, T6041, T6050, T8132 and T8142 only for the boards it had been tried on: J613, J615, J614s, J616s, J614c, J616c, J714s, K116s, J716c, J713, J715, J813 and J815. Any other board with the same SoC got no profile, so it had no SEP and no Touch ID. The profile itself holds only SoC facts: SEP shared memory and handshake, the DART window, and the SPI controller the SoC wires to the sensor. The list started in 64ff4f1 and grew one board per commit.

Change

  • select() picks the profile by the SoC compatible alone. T8103, T8112, T6000/T6001, T6020/T6021 and T8140 already work this way.
  • detect() returns no profile when the device tree has no apple,sep node. Module init then logs that the SEP stays disabled, as it does today, and does not fail on the missing node. This matters for the T8142 J704, whose dts does not describe the SEP yet.
  • enable_sep_and_dart() leaves the SEP and its DART disabled when the board keeps the SEP mailbox disabled. With the profile picked by SoC alone, boards such as J773s, J575c, J716s, J775c, J873s and K114s now get a profile, but their device trees describe no usable enclave. Most trees leave the SEP node and its DART disabled for the warm attach to enable, so only the mailbox status says whether a board has one. Without this check the module would enable the SEP and its DART at load on those boards.
  • KUnit: the selection test now checks that the board compatible does not change the result. The Touch ID test covers J504, J614c, J715, J604, J716s, K116s, J704, J813 and J815 as well.

A board without a built-in sensor (Mac mini, Mac Studio, iMac) has nothing on the sensor's SPI bus. The sensor probe finds no part, and the SEP runs without biometrics, as on the M1 and M2 Mac minis.

The profiles were written by Scott Jones (T8122), Michal S. (J614s), Artyom Astafurov and Jos Dehaes (T6041), Diljit Singh (T6050), Jens Axboe (K116s), Erik Bourget (J713, J716c) and Nick (T8142).

Testing

  • Rebased head (on c3d01cb): make ARCH=arm64 LLVM=1 drivers/soc/apple/ with defconfig + asahi.config + CONFIG_APPLE_SEP_KUNIT_TEST=y builds apple-sep.o; no warnings in the changed files. KUnit on arm64 QEMU (kunit.py run --arch=arm64 --kunitconfig=drivers/soc/apple/sep.kunitconfig 'apple_sep*'): 307/307 pass, apple_sep_profile 9/9 including t8142_sensor_boards_require_the_matching_soc and selection_follows_the_soc. tools/asahi/run-host-tests.py --only sep: 23/23 pass.

  • Build, release config, LLVM, CONFIG_APPLE_SEP_KUNIT_TEST=y: make drivers/soc/apple/ builds apple-sep.o, including the KUnit tests. No warnings in the changed file. The Rust warnings in bio.rs, key.rs, control.rs and store.rs were there before.

  • KUnit on arm64 QEMU (tools/testing/kunit/kunit.py run --arch=arm64 --kunitconfig=drivers/soc/apple/sep.kunitconfig 'apple_sep*', as in CI): 306/306 pass, including apple_sep_profile (8 subtests: selection_follows_the_soc, unprofiled_socs_are_refused). Host tests (tools/asahi/run-host-tests.py): 427/427 pass.

  • Compiled DTBs of this tree, SEP mailbox status per board on the SoCs that change: enabled on J614s, J616s, J614c, J616c, J714s, J716c, K116s, J433, J434, J504, J613, J615, J604, J623, J624, J713, J715, J773g, J813, J815; disabled on J773s, J575c, J714c, J716s, J775c, J775d, J873s, K114c, K114s, K116c; no SEP node on J704.

  • Hardware (one-shot test kernel 7.3.0-aurora-swl1 = integration 0abc2f3 + this and the other open sweep PRs, 2026-11-20):

    • T6040 J616s: 'SEP platform profile: T6040/J616s' as on the current kernel.
    • T6000 J316s: 'SEP platform profile: T6000/J316s' as on the current kernel. 3 s2idle cycles clean on both.

Still to run

  • J616s (T6040): dmesg | grep "SEP platform profile" shows T6040/J616s, the same as before. Touch ID enrol and verify still work.
  • Neo J700 (T8140), M1 Pro J316s (T6000), M2 J413 (T8112): this code path did not change. dmesg | grep "SEP platform profile" shows the same profile as before.
Boards newly reached (none in our lab)
SoC Boards Sensor
T8122 J504 built in
T8122 J433, J434 none (iMac)
T6040 J773s none (Mac mini; SEP mailbox disabled: SEP stays off)
T6041 J575c none (Mac Studio; SEP mailbox disabled: SEP stays off)
T6050 J714c, J716s, K114s, K114c, K116c built in (SEP mailbox disabled in the DT: SEP stays off)
T6050 J873s, J775c, J775d none (SEP mailbox disabled: SEP stays off)
T8132 J604 built in
T8132 J773g, J623, J624 none
T8142 J704 no apple,sep node, so no profile

Each of these boards includes the SoC dtsi with the same SEP, SEP DART and spi2 nodes as the boards on the old list. The mailbox check and the added KUnit cases come from #2439, which this PR supersedes.

Assisted-by: LLM (Claude:Opus 5.5)

On T8122, T6040, T6041, T6050, T8132 and T8142 the SEP profile was chosen
only for the boards it had been tried on (J613, J615, J614s, J616s, J614c,
J616c, J714s, K116s, J716c, J713, J715, J813, J815). Every other board with
the same SoC got no profile, and so no SEP and no Touch ID, although each
profile holds only SoC facts: the SEP's shared memory and handshake, its
DART window, and the SPI controller the SoC wires to the sensor.

Select by the SoC compatible, as T8103, T8112, T6000/T6001, T6020/T6021
and T8140 already are. A board without a built-in sensor has nothing on
that bus: the sensor probe finds no part and the SEP runs without
biometrics, as on the M1 and M2 Mac minis.

A device tree that does not describe the SEP at all (the T8142 J704 has
no apple,sep node yet) now gets no profile, so module init keeps saying
the SEP stays disabled instead of failing on the missing node.

The KUnit selection test now checks that the board compatible does not
matter, and the Touch ID list covers the boards this admits.

The profiles were written by Scott Jones (T8122), Michal S. (J614s),
Artyom Astafurov and Jos Dehaes (T6041), Diljit Singh (T6050), Jens Axboe
(K116s), Erik Bourget (J713, J716c) and Nick (T8142).

Fixes: 64ff4f1 ("soc: apple: sep: add a T8122 (MacBook Air M3) platform profile")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…disabled

With the profile picked by SoC alone, select() now also returns a profile
on boards whose device tree describes no usable enclave, and the warm
attach then enables the SEP node and its DART at module load. Most device
trees leave both disabled for that path, so their status cannot say
whether a board has an enclave.

The SEP mailbox's status does: the SEP cannot be reached without it, and
the device tree enables it (in the board file, or in the SoC .dtsi for
every board of that SoC) where the SEP is described for the machine.
enable_sep_and_dart() now leaves the SEP and its DART disabled when the
mailbox is disabled.

From the compiled DTBs of this tree: J773s (T6040), J575c (T6041), and
J714c, J716s, J775c, J775d, J873s, K114c, K114s and K116c (T6050) keep the
SEP mailbox disabled, so nothing is enabled or bound there. Every board
whose mailbox is enabled attaches as before.

The selection KUnit test also covers J773g, J815, K114s, J316s and J413,
and checks that SoCs without a profile (T6002, T6031, T8152) are refused.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Rows on the two Touch ID Macs whose profile selection this changes: the M3 MacBook Air 15" (J615, T8122) and the M4 MacBook Air 13" (J713, T8132). Both PASS.

Method. Each Air's default kernel, with only apple-sep.ko replaced for one boot: that kernel's own drivers/soc/apple plus 52dabe3 and 4ae8c06 (both apply cleanly; the patched profile.rs and dt.rs are the same on both trees), built out of tree against the running kernel's build tree. Default command line, no module parameters.

J615 (T8122), 7.3.0-aurora-fleet77 J713 (T8132), 7.3.0-bj713b7
profile line SEP platform profile: T8122/J613 SEP platform profile: T8132/J713/J715
SEP ready 3113 ms, 12 endpoints, key store open 3115 ms, 12 endpoints, key store open
Touch ID sensor bound, SPI polling (the J615 DT has no data-ready line yet, #2678) bound, data-ready interrupt capture
enrolment opens (no finger, cancelled) yes yes
trusted key seal / unseal 213 / 209 ms; tampered blob refused 215 / 211 ms; tampered blob refused
SELinux, failed units, AVC Enforcing, 0, 0 Enforcing, 0, 0
kernel errors vs the previous default boot identical (15 = 15) identical (7 = 7)

Same profile, same behaviour as the board-list selection on both. A fingered enrolment and match was not part of this run; neither Air has a finger enrolled yet.

How the module was swapped

aurora-sep.service loads the module explicitly, so a temporary drop-in ran insmod of the PR build in ExecStartPre only when the command line carried a test flag, set on a one-shot boot entry (a copy of the default entry plus the flag). The journal records the inserted module's SHA-256 on each boot (J615 7fb1a074…, J713 44c006bf…). Drop-in, entry and module were removed afterwards and both Airs rebooted to their defaults.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merge-train adversarial review (MERGETRAIN-LINUX2) at 4ae8c06: NO BLOCKERS.

Code read only, nothing built here. Before the merge it still needs Dj's verdict at this head; the missing rows are listed below.

Full review

#2631 soc: apple: sep: select the platform profile by SoC @4ae8c061

VERDICT: NO BLOCKERS

The PR removes per-board gates (profile.rs:699-729), which our rules favour. I checked the mailbox status in every SoC dtsi at the head:

  • t8103, t8112, t8122, t8140, t600x, t602x and t8142-j813-sep have no status on sep_mbox, so it is available and the M1/M2/M3/Neo/T60xx behaviour is unchanged.
  • t604x.dtsi and t8132.dtsi disable it. It is re-enabled in t604x-j614-j616.dtsi, t6041-j614c-j616c.dtsi, t6050-j714s/k116s/j716c-sep, and t8132-jxxx.dtsi, which reaches J713/J715 (laptop.dtsi) and the desktop boards (desktop.dtsi).
  • The profile's controller_base is diagnostics only (profile.rs:89-92), so a sensor-less board gets no MMIO poke.
  • detect() returns ENODEV with no apple,sep node (profile.rs:653-657). Module init logs it and continues (sep.rs:3647-3660).

Nits

  • dt.rs:208-216: the mailbox check returns Ok and logs at info. It runs only for WarmRegister profiles (sep.rs:3649); cold-boot profiles (T8103/T6020 Boot) never reach it. That is fine, but the comment at profile.rs:706-709 reads as if it applies to every SoC.
  • profile.rs:725-726: the "J815 and J813 ADTs" comment now sits above an SoC-wide select. It is accurate as the source of the facts but reads like a gate. The KUnit name t8142_sensor_boards_require_the_matching_soc no longer describes the test.
  • On the T6050 boards that have a built-in sensor but a disabled mailbox (J716s, K114s, K114c, J714c, K116c), Touch ID stays off until their DTs enable it. This is intended, but nothing tracks it.

Missing rows

  • Newly reached boards, none in our lab: J504, J433, J434 (T8122); J604, J773g, J623, J624 (T8132). These now enable the SEP DART and run the handshake with the SoC profile, unproven on any of them.
  • Lab rows exist for J615 and J713 (comment), J616s and J316s (body). Missing: M2 J413 and Neo J700 rows at the head, though their path is unchanged. No fingered enrol/match on J615/J713.

@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.

Pre-PR checklist review (§1–§6) at 4ae8c061c84a: COMMENT (0 code/policy/attribution/naming/CI blockers; holding only for §5 hardware evidence).

Verified (§1–§4, §6, CI)

  • §1 Model gating: Removes per-board gating in drivers/soc/apple/profile.rs:710-728 in favour of SoC-level profile selection + DT-driven enablement (dt::sep_node() in profile::detect(), sep_mbox.is_available() in dt::enable_sep_and_dart()).
  • DT & init path check:
    • dt::sep_node() uses of_find_compatible_node() (dt.rs:31-43), so boards with no apple,sep node (e.g., t8142-j704.dts) return ENODEV from profile::detect() and skip warm attach cleanly.
    • dt::enable_sep_and_dart() (dt.rs:208-216) checks sep.parse_phandle(MBOXES_PROP, 0).is_some_and(|mbox| mbox.is_available()) and returns Ok(()) without touching sep_dart or sep when sep_mbox is disabled (t6040 J773s, t6041 J575c, t6050 J714c/J716s/J775c/J775d/J873s/K114c/K114s/K116c).
    • Checked t8122.dtsi (sep_mbox enabled by default) and t8132.dtsi + t8132-jxxx.dtsi (sep_mbox enabled for all T8132 boards): both describe sep_dart with the BIT(40) aperture and profile.rs sets xart_guard: 1 on T8122, T6040, T6041, T6050, T8132, and T8142. SensorProfile.controller_base is diagnostics-only (profile.rs:89-92).
  • §2 / §3 / §4 / §6: No cmdline/module params, no hardcoded safety limits, no naming violations. Both commits (52dabe33, 4ae8c061) carry human author/committer + human Signed-off-by: only; PR body carries Assisted-by:.
  • CI: 7/7 checks green (host-tests, source, rust-build, kunit, 3x DWC3/ATC).

Holding for §5 Evidence

  • The J615 (T8122) and J713 (T8132) rows ran out-of-tree apple-sep.ko on older base kernels without a fingered enrol/match, and the J616s / J316s rows were on pre-rebase 0abc2f38 without AVC / failed-unit / kernel-error counts.
  • Before approval/merge, please collect:
    • At-head regression rows on J616s (with Touch ID verify, 0 AVC, 0 failed units, 0 new kernel errors) and unchanged-path sanity checks (M2 J413, Neo J700);
    • At least one boot on a disabled-mailbox board exercising the new dt.rs:208-216 early-return path (confirming sep_dart/sep stay disabled and 0 new DART errors);
    • Owner rows on newly reached boards where sep_mbox is enabled (T8122 J504/J433/J434; T8132 J604/J773g/J623/J624), since those now actively enable sep_dart + sep and run the warm-attach handshake.

Nits (non-blocking)

  • drivers/soc/apple/sep.rs:3656 still logs "no platform profile for this SoC" even when profile::detect() returns ENODEV because apple,sep is absent from the DT (e.g., J704).
  • drivers/soc/apple/profile.rs:738 KUnit test name t8142_sensor_boards_require_the_matching_soc no longer fully reflects what the test asserts now that any board with apple,t8142 matches.
  • drivers/soc/apple/profile.rs:706-709 comment about dt::enable_sep_and_dart applies to WarmRegister profiles (cold-boot profiles do not call it).

Assisted-by: LLM (Gemini 4 Neon)

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