Skip to content

soc: apple: sep: pick the platform profile by SoC; the board DT decides - #2439

Draft
RyanTheTide wants to merge 1 commit into
integration/aurorafrom
spec-m5neo/sep-profile-soc
Draft

RyanTheTide wants to merge 1 commit into
integration/aurorafrom
spec-m5neo/sep-profile-soc

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Problem. select() in drivers/soc/apple/profile.rs picks the T8122, T6040, T6041, T6050, T8132 and T8142 profiles only for a list of board compatibles, the boards whose ADTs were read. Every new board on one of these SoCs needs its own driver patch. J614s, J614c, J715, J716c, K116s and J813 each got one, and #2115 adds the K114s. Thanks to @chrisohearn for the K114s report that brought this up.

Change. These profiles are now picked by SoC alone, as T8103, T6000/T6001, T6020/T6021, T8112 and T8140 already are. Nothing the driver reads from them is per board. Shared memory, handoff, key store and keybag encoding follow the SoC's sepOS. The DART window and DMA mask follow the SoC's SEP DART, which the SoC .dtsi also describes. xart_guard is a safety policy. The sensor's bus, chip select and SPI mode come from the board's apple,mesa-fingerprint node, and the profile's sensor constants are not read at run time. nonce_session follows the sensor generation, which is the same on every board of each SoC read so far.

The SEP node's status can't be what selects a board. On these SoCs the driver enables the SEP node and its DART when it loads, and the trees leave both disabled for that reason. What the board trees do set is the SEP mailbox. On T6040, T6041, T6050 and T8142 the mailbox is enabled on exactly the boards the old lists named. enable_sep_and_dart() (dt.rs) now leaves the SEP disabled when its mailbox is disabled. When a board has no SEP node at all (J704), it logs that and returns, instead of failing module init.

This makes the apple,k114s line in #2115 unnecessary. The K114s still needs its board DT to enable sep_mbox and ps_sep the way the K116s does. Until then it gets the T6050 profile but nothing binds. This complements #2247 (SEP and DART enabled on every T8132 board).

Testing.

  • All 66 Apple silicon board DTBs in the tree, compiled at 0abc2f3, with each board's profile and SEP binding computed before and after. Every board that had a profile is unchanged, including the lab machines J700 (T8140), J616s (T6040), J316s (T6000) and J413 (T8112).
  • The boards whose behaviour changes are all T8122 or T8132. The SoC .dtsi enables the SEP mailbox on every board there, so after this change the SEP attaches on J433, J434, J504 (T8122) and J604, J623, J624, J773g (T8132). That already happens on the T6020/T6021 and T8112 desktops (J474s, J475c, J473).
  • On J773s, J575c, J714c, J716s, J775c, J775d, J873s, K114c, K114s and J704 the profile changes but the mailbox is disabled (or there is no SEP node), so nothing binds, as before.
  • rustfmt (kernel .rustfmt.toml): the changed hunks are clean.
  • KUnit: the selection test is now selection_follows_the_soc_alone, plus unprofiled_socs_are_refused. The Touch ID sensor test covers J604, J715, K114s, J813 and J815.
  • Rust build of sep.o (release config, CONFIG_APPLE_SEP_KUNIT_TEST=y): the base builds with 12 existing warnings. The build with this change is still queued on the loaded build box; I'll post the result here.

Still to run.

  • Lab rows (J700, J616s, J316s, J413): dmesg | grep -i 'SEP platform profile' prints the same name as before, and Touch ID enrol/match still works.
  • Owners of the boards that change, a row please: load apple_sep and check that the SEP binds (SEP platform profile: T8122/J613 or T8132/J713/J715) and that s2idle still works. Where there is a sensor (J604), also enrol and match.
Per-board table (DT status at 0abc2f3, profile and SEP binding before/after; abridged to changed boards and lab machines)

| board | SoC | DT sep | DT sep mbox | profile before | profile after | SEP bound before | SEP bound after | changed |
| t6000-j316s | t6000 | okay | okay | T6000 | T6000 | yes | yes | |
| t6040-j616s | t6040 | disabled | okay | T6040 | T6040 | yes (runtime enable) | yes (runtime enable) | |
| t6040-j773s | t6040 | disabled | disabled | - | T6040 | no (module: no profile) | no (DT mailbox disabled) | profile only |
| t6041-j575c | t6041 | disabled | disabled | - | T6041 | no (module: no profile) | no (DT mailbox disabled) | profile only |
| t6050-j714c | t6050 | disabled | disabled | - | T6050 | no (module: no profile) | no (DT mailbox disabled) | profile only |
| t6050-j716s | t6050 | disabled | disabled | - | T6050 | no (module: no profile) | no (DT mailbox disabled) | profile only |
| t6050-j775c | t6050 | disabled | disabled | - | T6050 | no (module: no profile) | no (DT mailbox disabled) | profile only |
| t6050-j775d | t6050 | disabled | disabled | - | T6050 | no (module: no profile) | no (DT mailbox disabled) | profile only |
| t6050-j873s | t6050 | disabled | disabled | - | T6050 | no (module: no profile) | no (DT mailbox disabled) | profile only |
| t6050-k114c | t6050 | disabled | disabled | - | T6050 | no (module: no profile) | no (DT mailbox disabled) | profile only |
| t6050-k114s | t6050 | disabled | disabled | - | T6050 | no (module: no profile) | no (DT mailbox disabled) | profile only |
| t6050-k116c | t6050 | disabled | disabled | - | T6050 | no (module: no profile) | no (DT mailbox disabled) | profile only |
| t8112-j413 | t8112 | disabled | okay | T8112 | T8112 | yes (runtime enable) | yes (runtime enable) | |
| t8122-j433 | t8122 | disabled | okay | - | T8122 | no (module: no profile) | yes (runtime enable) | YES |
| t8122-j434 | t8122 | disabled | okay | - | T8122 | no (module: no profile) | yes (runtime enable) | YES |
| t8122-j504 | t8122 | disabled | okay | - | T8122 | no (module: no profile) | yes (runtime enable) | YES |
| t8132-j604 | t8132 | disabled | okay | - | T8132 | no (module: no profile) | yes (runtime enable) | YES |
| t8132-j623 | t8132 | disabled | okay | - | T8132 | no (module: no profile) | yes (runtime enable) | YES |
| t8132-j624 | t8132 | disabled | okay | - | T8132 | no (module: no profile) | yes (runtime enable) | YES |
| t8132-j773g | t8132 | disabled | okay | - | T8132 | no (module: no profile) | yes (runtime enable) | YES |
| t8140-j700 | t8140 | okay | okay | T8140 | T8140 | yes | yes | |
| t8142-j704 | t8142 | absent | absent | - | T8142 | no (module: no profile) | no (no SEP node) | profile only |

The full 66-board table and the scripts that produced it are kept with the lane's evidence.

Assisted-by: LLM (Claude:Opus 5.5)

select() matched T8122, T6040, T6041, T6050, T8132 and T8142 only
together with a list of board compatibles, the boards whose ADTs had
been read. Each new board on one of these SoCs needed a driver patch
(J614s, J614c, J715, J716c, K116s, J813, and K114s in review), although
nothing the driver reads from these profiles is board-specific:

- shared-memory geometry, handoff, key-store dialect and keybag
  encoding follow the SoC's sepOS;
- the DART window and the wide DMA mask follow the SoC's SEP DART
  aperture, which the SoC .dtsi also describes;
- xart_guard is a safety policy;
- the sensor's bus, chip select and SPI mode come from the board's
  apple,mesa-fingerprint node; the profile's sensor constants are not
  read at run time;
- nonce_session follows the sensor generation, which is the same on
  every board of each SoC read so far.

Pick these profiles by SoC alone, as T8103, T6000/T6001, T6020/T6021,
T8112 and T8140 already are.

The SEP node's status cannot be the board selector here: the warm-attach
path enables the SEP node and its DART at module load, and the trees
leave both disabled for it. The SEP mailbox's status is what the board
device trees set: on T6040, T6041, T6050 and T8142 it is enabled on
exactly the boards the old lists named. enable_sep_and_dart() now leaves
the SEP disabled when its mailbox is disabled, and when there is no SEP
node (J704) it logs and returns instead of failing module init.

From compiled DTBs of all 66 Apple silicon boards in the tree:

- every board that had a profile keeps it and attaches as before
  (J700, J616s, J316s and J413 among them);
- J773s, J575c, J714c, J716s, J775c, J775d, J873s, K114c, K114s and
  J704 now get their SoC's profile, but their mailbox is disabled (or
  there is no SEP node), so nothing binds, as before;
- J433, J434, J504 (T8122) and J604, J623, J624, J773g (T8132): the
  SoC .dtsi enables the SEP mailbox on every board, so the SEP now
  attaches there with the SoC's profile, as it already does on the
  T6020/T6021 and T8112 desktops.

Update the selection KUnit test to match.

Link: #2115
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@techmore

Copy link
Copy Markdown
Contributor

J773g row (Mac mini M4, 16 GB, macOS 27.2 stub, so sepOS 27.2). This PR's commit e07097bd on integration/aurora 0abc2f38 with #2317 and #1898; #2247 not in the tree. apple_sep loaded by hand, read-only (xart_writes=0 provision_keybag=0 trusted_keys=0 filevault_api=0), one boot:

  • SEP platform profile: T8132/J713/J715; 3aa600000.sep bound to apple_sep; attach: 7 endpoints advertised; ready in 3113 ms: 12 endpoints …, key store open; xART read with writes disabled (170 slots, 13 live records). No SEP panic, timeout or DART fault in the 60 s after the load. The next boot of the installed system was normal.
  • With those parameters the driver still created /var/lib/aurora-sep-host-state.bin (2.3 MB) on the Linux root.
  • s2idle: not attributable to this PR on this unit. Without apple_sep loaded, pm_test=freezer passes and pm_test=devices never returns (netconsole ends at Freezing remaining freezable tasks completed; the machine resets about 30 s later; the hanging device is not named). Same on a second build with asahi.config's sleep options (APPLE_SOC_SLEEP, RTC_DRV_APPLE_PMU), PCIE_APPLE_MSI still off. Not run with the SEP bound.
  • Not checked: macOS after the bind; a load with the default (writing) parameters.

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