Skip to content

crypto: apple: SIO AES engine skcipher driver for T6000 and T8112 - #1572

Merged
RyanTheTide merged 3 commits into
integration/aurorafrom
aesref/apple-sio-aes-skcipher
Nov 11, 2026
Merged

RyanTheTide merged 3 commits into
integration/aurorafrom
aesref/apple-sio-aes-skcipher

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Adds a crypto API driver for the SIO AES engine on T6000 (M1 Pro/Max/Ultra) and T8112 (M2), and enables the existing apple,aes nodes on those SoCs.

Driver

  • drivers/crypto/apple-aes.c registers ecb(aes), cbc(aes) and ctr(aes) (*-aes-apple-sio) through crypto_engine.
  • Each request loads a software key and IV through the command FIFO, runs the block operation by DMA behind the SIO DART (stream 1, 32-bit DMA mask) and waits for the barrier interrupt.
  • Only the software key selector is used. The key-disable and DKEY banks are not mapped.
  • Data is staged in one 512 KiB DMA bounce buffer. CTR commands are split so the low counter word never wraps inside one command. Output IVs are computed in software.
  • Runtime PM with a 50 ms autosuspend delay; the AES power domain is off when idle. System sleep stops and restarts the engine queue.
  • Priority 150. aes-ce (300) and aes-neon (200) stay the default for every mode, because the engine is much slower (numbers below). Users get it only by driver name, for example capi:cbc-aes-apple-sio-plain64 in dm-crypt.
  • The probe-only diagnostics driver (drivers/soc/apple/apple-sio-aes.c) keeps T6041 and T8140.

Key and IV bytes go into the FIFO as little-endian 32-bit words. Big-endian words fail the FIPS-197 vector.

Results, M1 Pro (j316s)

Kernel 7.3.0-aurora-aesref1 (this branch on integration/aurora 9b181ec), DTB = the production fleet64 j316s DTB with only crypto@39b060000 set okay.

  • testmgr at boot: ecb, cbc and ctr selftest: passed.
  • Default ecb(aes)/cbc(aes)/ctr(aes) stay *-aes-ce (priority 300).
  • dm-crypt on a loop file, 128 MiB of random data, written with apple-sio and read back with aes-ce and the other way round: 6/6 identical (ecb, cbc, ctr at 512 B and 4 KiB sectors).
  • 2.43 GB in 2.67 M requests through the engine: 0 engine errors, 0 DART faults, 0 AVC denials, SELinux enforcing.
  • s2idle 3/3 woken by apple-pmu-rtc, then the dm-crypt round trip again: pass.
dm-crypt aes-256, MB/s apple-sio write apple-sio read aes-ce write aes-ce read
cbc, 512 B sectors 7.8 14.1 417 1052
cbc, 4 KiB sectors 13.1 49.4 474 1487
ctr, 4 KiB sectors 47.5 49.5 836 1338
ecb, 4 KiB sectors 49.9 51.7 910 1257

cryptsetup benchmark -c aes-cbc -s 256 (aes-ce): 896 MiB/s encrypt, 5515 MiB/s decrypt.

Results, M2 (j413)

Kernel 7.3.0-aurora-aesref2 (this branch at 6a15dd2), DTB = the production fleet64 j413 DTB with only aes@23500c000 set okay.

  • testmgr at boot: ecb, cbc and ctr selftest: passed. Defaults stay *-aes-ce.
  • dm-crypt round trips apple-sio <-> aes-ce: 6/6 identical.
  • 2.43 GB in 2.67 M requests: 0 engine errors, 0 DART faults, 0 AVC denials, enforcing. Power domain off when idle.
  • s2idle 3/3 (apple-pmu-rtc), then the dm-crypt round trip again: pass.
dm-crypt aes-256, MB/s apple-sio write apple-sio read aes-ce write aes-ce read
cbc, 512 B sectors 8.2 14.2 547 1448
cbc, 4 KiB sectors 15.6 55.8 549 2155
ctr, 4 KiB sectors 54.3 55.9 1212 2279
ecb, 4 KiB sectors 55.6 57.8 733 1910

cryptsetup benchmark -c aes-cbc -s 256 (aes-ce): 860 MiB/s encrypt, 5794 MiB/s decrypt.

The M1 Pro run used aesref1 with the driver module rebuilt from 6a15dd2 against that tree. The M2 run used a kernel built from the branch head.

🤖 Generated with Claude Code

Add ecb(aes), cbc(aes) and ctr(aes) on the SIO AES engine of T6000 and
T8112. The driver loads a software key and IV through the command FIFO,
runs the block operation by DMA behind the SIO DART and waits for the
barrier interrupt. It never selects a hardware key and never maps the
key-disable bank.

Requests go through crypto_engine and are staged in one 512 KiB DMA
bounce buffer, which handles arbitrary scatterlists, in-place requests
and CTR tails. CTR commands are split so the low counter word never
wraps inside one command. The output IV is computed in software. The
block is powered by runtime PM with a 50 ms autosuspend delay.

The engine is slower than the ARMv8 Crypto Extensions, so the
algorithms register at priority 150, below aes-ce and aes-neon. Users
get them only by driver name.

The probe-only diagnostics driver keeps T6041 and T8140.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The skcipher driver now drives these nodes. Enable them on T6000,
T6001, T6002 and T8112.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The engine takes the key and IV bytes as little-endian 32-bit words.
With big-endian words the FIPS-197 vector comes out wrong and the
self-tests fail; with little-endian words ecb, cbc and ctr pass.

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

Copy link
Copy Markdown
Contributor Author

Buildbox gates: full arm64 kernel build of 6a15dd2 with the fleet config (CONFIG_CRYPTO_DEV_APPLE_SIO_AES=m, no new warnings in drivers/crypto/apple-aes.c); scripts/dtc/apple-dt-check.sh 9b181ec3..6a15dd26: 137 DTBs build at base and head, 412 warning lines on both, 0 new warnings; checkpatch --strict on the driver: no errors or code warnings. Branch is clean against integration/aurora 716670b.

@RyanTheTide
RyanTheTide marked this pull request as ready for review November 11, 2026 18:22
@RyanTheTide
RyanTheTide merged commit 5b81ed4 into integration/aurora Nov 11, 2026
5 checks passed
@RyanTheTide
RyanTheTide deleted the aesref/apple-sio-aes-skcipher branch November 11, 2026 18:22
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