Skip to content

soc: apple: sep: read the pnon digest on the two-to-four-page SEPs - #2810

Draft
RyanTheTide wants to merge 1 commit into
mainfrom
sepxars/pnon-legacy-v2
Draft

RyanTheTide wants to merge 1 commit into
mainfrom
sepxars/pnon-legacy-v2

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Replaces #1761 (same changes, commit trailers fixed, on the current integration/aurora).

The pnon endpoint on M1 Pro, M2 and A18 Pro advertises 2 to 4 pages each way and expects the older mailbox format for its calls. The client from #1734 only spoke the M4 Pro format, so it left those SEPs alone (absent).

  • Two mailbox formats, picked from the discovery layout:
    • 5 to 7 pages (M4 Pro): tag 2, request length in data. The reply has the status in type and the reply length in data. Unchanged.
    • 2 to 4 pages (M1 Pro, M2, A18 Pro): tag 1, request length in bits 16-31, data 0. The reply has the reply length in bits 16-31 and the service result in data.
  • The out-of-line request and reply are the same in both: the 32-byte hcPB header with operation 0x0e, and an 80-byte hrPB reply carrying the 48-byte digest.
  • Buffers on the 2 to 4 page layout: 4 pages each way. Any other layout is still left alone.
  • The format is never retried in the other one. The A18 Pro answered the tag 2 word with tag 2 and data 1, a refusal with no reply bytes. The old decoder read that as a one-byte reply. A tag 2 word can't complete a tag 1 call, and a tag 1 word can't complete a tag 2 call.

Tests

  • KUnit sep.kunitconfig: 601 run, 599 pass, 2 skip. apple_sep_pnon 10/10. The new cases cover the tag 1 request word, tag 1 success and refusal replies, the A18 Pro's tag 2 answer, cross-format words and the layout-to-format mapping.

The pnon endpoint on M1 Pro, M2 and A18 Pro advertises two to four
pages each way and expects the older mailbox format for its calls:
tag 1, the out-of-line length in bits 16-31 and data zero. Its reply
carries the reply length in bits 16-31 and the service result in data.
The A18 Pro answered the tag 2 request with tag 2 and data 1, a refusal
with no reply bytes, which the driver read as a one-byte reply.

The out-of-line request and reply are the same as on M4 Pro: the
32-byte request header with the blessed-digest operation, and an
80-byte reply with the 48-byte digest. Pick the format and the buffer
sizes from the discovery layout (four pages each way on the
two-to-four-page layout) and never retry in the other format. Any
other layout is still left alone.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Review at d5f2b34 (non-author, draft). No blocker in the code; not ready until it has run once on each class of machine that newly receives the call, and those rows are not listed in the body yet.

  • Merges cleanly on integration/aurora 6748d83. One commit, human trailers only (the trailer problem of the predecessor is fixed).
  • No chip or board checks: the mailbox format and buffer sizes come from the endpoint's own discovery layout word (offer()), exact match on the two known layouts, anything else is left alone as before.
  • Bounds on the reply: on_pnon() accepts a length only in HEADER_LEN..=DIGEST_REPLY_LEN (32 to 80) before it waits for or reads the receive buffer, the registered receive size is at least four pages on both layouts, and check_reply() checks the slice length before every index and requires exactly 80 bytes for a digest. A nonzero status never reads the buffer. A word in the other format is classified Other and cannot complete the exchange. The generation is sampled before the buffer is read, so a late answer cannot complete a later exchange.
  • Exposure is unchanged: the digest is still only in the root-only diag/local_policy_digest, and the only operation sent is the read.
  • The M4 Pro path is unchanged apart from carrying the format through Exchange.

Small points, not blocking:

  • There is still no hardware run on this head, and the change makes every boot of the machines with the two-to-four-page layout send a call their enclave has not been sent by this driver before. The tag 1 words in the tests are constructed, not recorded; the one observation cited is the refusal of the tag 2 word. Please say in the body what the tag 1 format is based on (one of our own traces can be cited as such), and add a "Still to run" list: one boot each on an M1 Pro, an M2 and an A18 Pro machine, plus an M4 Pro to show no change. Pass: the digest reads 48 bytes, equal across two boots; no pnon refusal or unexpected-message line; Touch ID match and a key-store operation still work after the call; one s2idle cycle.
  • classify() for tag 1 accepts any tag 1 word on the endpoint as the reply while an exchange waits, where the tag 2 arm also requires param == 0. If the format has fixed-zero bits (the upper half of data, bits above the length), checking them would keep an unrelated tag 1 word from ending the exchange as Malformed and the real reply from being dropped as unexpected. This was raised on the predecessor and is unchanged.
  • The test comment carries an internal work label next to the J616s recording; it is already on the base, but since the file is being touched, drop it.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Review at d5f2b34. The SEP message width now follows the endpoint's advertised page geometry. Keep the small-layout and larger-layout rows distinct. Verify the ordinary J413 path returns the digest and refuses an unexpected reply length while leaving key state intact. The software fixture checks serialization but cannot establish the older SEP's live behavior.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Row: M1 Pro (J316s, T6000), negative. Combined one-shot test kernel 7.3.0-aurora-dsw2 (main 2a173ca + this PR's head d5f2b34 + 14 other drafts; no other PR in it touches drivers/soc/apple/'s pnon client). Default command line.

  • Fleet kernel (fleet89): diag/pnon = absent (the 2-4 page SEP is left alone, as described).
  • With this PR: diag/pnon = failed, and dmesg shows pnon: the boot-policy service did not return the digest (NoReply) at 11 s.
  • The failure is contained: the key store opens (ready in 3532 ms: 12 endpoints ..., key store open), diag/keybag = present, 0 error-level lines, 0 WARN/BUG, s2idle rc 0.

So the tag 1 request this PR sends gets no reply on this SEP. The digest isn't read, and the endpoint goes from absent to failed. This stays a draft until the request is fixed for the 2-4 page layout. A next row on the M2 (J473) will show whether the T8112 SEP behaves the same way.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Follow-up row: J473 (M2 mini, T8112). diag/pnon = read with this PR (dsw2) and also read on the fleet kernel (fleet89), whose pnon client still leaves the two-to-four-page layout alone (main drivers/soc/apple/pnon.rs:583). So this M2's SEP already takes the existing format, and the PR changes nothing on it. Together with the M1 Pro row above, the only board where the new path runs got NoReply. The new request format needs another look (or another source for the M1 Pro layout) before this can go further. It stays a draft.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Third row: Neo (J700, A18 Pro), negative like the M1 Pro. Same combined kernel 7.3.0-aurora-dsw2. The A18 Pro is one of the three SEPs this PR targets. Fleet edge kernel: diag/pnon = absent. With this PR: diag/pnon = failed, and dmesg at 8.9 s shows pnon: the boot-policy service did not return the digest (NoReply). The key store still opens (ready in 1454 ms ... key store open), 0 WARN/BUG. So both 2-4 page SEPs we can test (T6000, A18 Pro) get no reply to the tag-1 request, and the M2 already reads on main. The request format is wrong for these SEPs. This stays a draft until it's reworked.

This branch has not been deployed

No deployments
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.

1 participant