Skip to content

kboot: T8152: run speaker safety, amp config, and speaker ID - #548

Merged
RyanTheTide merged 1 commit into
aurora-silicon:mainfrom
sithglan:feat/t8152-audio-dt
Nov 27, 2026
Merged

RyanTheTide merged 1 commit into
aurora-silicon:mainfrom
sithglan:feat/t8152-audio-dt

Conversation

@sithglan

@sithglan sithglan commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

What: Call dt_set_speaker_safety(), kboot_audio_amp_config(dt, adt), and kboot_audio_speaker_id(dt, adt) at the start of dt_prepare_t8152(), matching the generic kboot_prepare_dt() path, and add a host test (tests/python/test_t8152_audio_dt.py) covering both loader modes and all three post-#328 dt_set_speaker_safety() CPMS cases.

Tested: Mac mini (M6, J873g), system firmware 27.2, exact head c83bcb7f (1.0.0b17-gc83bcb7f, guarded one-shot Stage 1 aura-try Stage 2 trial) paired with aurora-silicon/linux#3434 (7.3.0-aurora-j873-speaker+ 18a0e3bcd3f7) and speakerguardd v2 (5bd2d652): /soc/i2c@33101c000/codec@38 received apple,speaker-config (4 B, amp level 15), apple,bop-config (24 B), and apple,amp-dcblocker-config (4 B) from the Mac's ADT (apple,amp-tx-zd-config absent), with no stale asahi-speaker-safety or apple,speaker-id under /chosen; macaudio admitted AppleJ873 (Primary + Secondary playback, Primary capture only, Amp Gain Volume capped at 15, Speaker Volume locked at floor, Amp Fault Status = 0,0,0); speakerguardd-selfcheck (AID48, derived-nosense) PASS, speakerguardd v2 supervisor + PipeWire sgv2#voicing-1ch -> sgv2#1ch granted "Speaker Protection" on stream start and returned to muted floor on idle, 0 kernel audio/DART errors, 0 failed units. Local host tests at c83bcb7f: pytest tests/python/test_t8152_audio_dt.py tests/python/test_t8152_display_fb.py (8/8, GCC + Clang 19), tests/run-kboot-audio.sh (38/38), make rustfmt-check clean.

Risk: two-way door — affects T8152 DT preparation only. kboot_audio_amp_config() and kboot_audio_speaker_id() fail soft and never stop a boot; dt_set_speaker_safety() scrubs stale /chosen/asahi-speaker-safety nodes and publishes or fails closed on a partial speaker-cpms-bgd_* ADT profile, matching every other SoC.

Not yet: Coordinates with #115 (stale pre-#328 draft, supersedes it if preferred) and #287 (if #287 makes kboot_audio_amp_config() staged across all chips per review, T8152 automatically inherits the staged copy with no duplicate call).

Details
  • src/kboot.c: call dt_set_speaker_safety(), kboot_audio_amp_config(dt, adt), and kboot_audio_speaker_id(dt, adt) at the start of dt_prepare_t8152(), before fdt_pack().
  • tests/python/test_t8152_audio_dt.py: compiles the real dt_set_speaker_safety() and dt_prepare_t8152() against the in-tree libfdt with -Wall -Wextra -Werror -fsanitize=undefined and verifies:
    1. No CPMS profile in /product/audio (J873g 27.x ADT), both aurora,minimal-boot and non-minimal modes: stale asahi-speaker-safety scrubbed, apple,speaker-config written before fdt_pack(), kboot_audio_speaker_id() called, step order preserved.
    2. Complete CPMS profile in /product/audio: stale node replaced and all profile properties published.
    3. Partial CPMS profiles (missing a speaker-cpms-bgd_* property or missing acoustic-id): dt_prepare_t8152() returns -1 and leaves dt_ready == false.
    4. Missing /chosen: fails closed (-1).
Evidence
  • CC=cc pytest -v tests/python/test_t8152_audio_dt.py: 1 passed.
  • CC=clang-19 pytest -v tests/python/test_t8152_audio_dt.py: 1 passed.
  • pytest -q tests/python/test_t8152_audio_dt.py tests/python/test_t8152_display_fb.py: 8 passed.
  • bash tests/run-kboot-audio.sh: 38 scenarios pass.
  • make rustfmt-check: clean.
  • J873g hardware boot (1.0.0b17-gc83bcb7f + 7.3.0-aurora-j873-speaker+, one-shot aura-try, 0 failed units):
    • /sys/firmware/devicetree/base/chosen/asahi,m1n1-stage2-version: 1.0.0b17-gc83bcb7f
    • /sys/firmware/devicetree/base/chosen/: no asahi-speaker-safety or apple,speaker-id
    • /sys/firmware/devicetree/base/soc/i2c@33101c000/codec@38/: apple,speaker-config (4 B), apple,bop-config (24 B), apple,amp-dcblocker-config (4 B) present from ADT; apple,amp-tx-zd-config absent.
    • AppleJ873: Amp Gain Volume min=0, max=15, values=15; Speaker Volume locked at floor until "Speaker Protection" lease grant; Amp Fault Status = 0,0,0; speakerguardd-selfcheck (5bd2d652, AID48, derived-nosense) PASS.

On T8152, kboot_prepare_dt() returns early into dt_prepare_t8152() before
dt_set_speaker_safety(), kboot_audio_amp_config(), and
kboot_audio_speaker_id(). Because those three steps never run on T8152:

- SN012776 speaker amps (such as J873g's codec@38) never receive
  apple,speaker-config, apple,bop-config, or apple,amp-dcblocker-config
  from the Mac's ADT, so Linux's macaudio has no operating level and
  disables speakers;
- stale asahi-speaker-safety nodes under /chosen are never scrubbed, and
  future T8152 ADTs carrying speaker-cpms-bgd_* profiles would not be
  checked or published;
- any stale /chosen/apple,speaker-id property is never scrubbed or
  populated from the Mac's straps.

Call dt_set_speaker_safety(), kboot_audio_amp_config(dt, adt), and
kboot_audio_speaker_id(dt, adt) at the start of dt_prepare_t8152(), before
fdt_pack(), matching the generic kboot_prepare_dt() path.

Add tests/python/test_t8152_audio_dt.py exercising the real
dt_set_speaker_safety() and dt_prepare_t8152() against libfdt across both
loader modes and all three CPMS profile cases (none, complete, partial).

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>

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

Verdict: MERGE at c83bcb7f3010

Blockers: none

Checked: The kboot.c change is four lines at the top of dt_prepare_t8152(). They call the same three helpers in the same order as the generic kboot_prepare_dt() path (src/kboot.c:14236-14239), which T8152 skipped because of its early return. All three helpers are unchanged shared code. Every value they write comes from this Mac's ADT: the safety profile from /product/audio, the amp group's bop-config / amp-dcblocker-config / speaker-config / amp-tx-zd-config, and the speaker ID straps through find-speaker-id / function-speaker-idN / valid-speaker-ids. Nothing is hard-coded, and the PR adds no new gate. The new lines are reachable only through the existing chip_id == T8152 dispatch, so other SoCs are untouched and no regression row on another generation is needed.

It fails closed: a missing /chosen or a partial CPMS profile returns -1 before any amp property is written and leaves dt_ready false. A Mac with no profile gets no node, and a stale node is scrubbed. The amp and speaker ID steps fail soft, as on every other chip. The host test uses synthetic values only, and it fails against main's kboot.c (amp_written == 1 assertion) and passes at head.

The J873g row in the body is at the exact head and shows the amp properties from the ADT, no stale safety node, and the speaker muted until speakerguardd v2 grants it.

Non-blocking:

  • The commit message and the hardware evidence both name /chosen/apple,speaker-id, but kboot_audio_speaker_id() writes /chosen/asahi,speaker-id. If you have the Stage 2 log from that boot, please post its kboot: audio: ... speaker ID / no speaker ID strap lines (or say whether /chosen/asahi,speaker-id was present). Then it's on record whether the strap read ran on J873g.
  • These four lines duplicate the generic path. A small shared dt_set_audio() would keep the two from drifting apart.
  • #287 is being asked to make the staged all-or-none amp copy the only implementation. If that lands as kboot_audio_amp_config(), T8152 picks it up here with no further change, as the PR body says. #115 is superseded by this PR.
Evidence
  • Local CI parity at c83bcb7f (buildbox): make format-check with clang-format 20.1.8 is clean. make RELEASE=1 CHAINLOADING=1 ESP_STAGE2=1 USE_CLANG=1 BUILTIN_LOGO=aurora BUILDSTD=1 builds with no new warnings (all 12 are already on main).
  • Full pytest tests/python tests/test_t8122_gpu_reader.py tests/test_t8122_gpu_resources.py: 1252 passed, 27 skipped, 2 failed. The two failures are test_loadobjs.py::test_tool_output_lines / test_run_tool, a local nm output difference that also fails on main 26c1a85b.
  • tests/run-kboot-audio.sh: 38 scenarios pass.
  • tests/python/test_t8152_audio_dt.py with src/kboot.c from main: fails at t8152_audio_dt.c:344: amp_written == 1. At head: passes, 8/8 together with test_t8152_display_fb.py.
  • GitHub CI at head is still queued.

@github-actions github-actions Bot added blast:m5 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) labels Nov 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Merge readiness at c83bcb7f: not ready yet

Check Detail
CI at head no failing: gcc, pr-text / pr-text, pr-text / pr-text, fedora, nix
Review ok approved by RyanTheTide
Requested changes ok none
Hardware row at head ok in the PR body at c83bcb7f
Conflicts ok none
PR text ok Risk: two-way · — affects T8152 DT preparation only. kbootaudioampconfig() and kbootaudiospeakerid() fail soft and never stop a boot; dtsetspeakersafety() scrubs stale /chosen/asahi-speaker-safety nodes and publishes or fails closed on a partial speaker-cpms-bgd ADT profile, matching every other SoC.

Areas: none matched in CODEOWNERS

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@RyanTheTide
RyanTheTide merged commit 6e796e0 into aurora-silicon:main Nov 27, 2026
16 of 22 checks passed
RyanTheTide pushed a commit to axboe/aura that referenced this pull request Nov 29, 2026
Stage 1's .init and .text share one read-execute segment that ends on a
64 KiB step. aurora-silicon#547 and aurora-silicon#548 grew .text past what that step had left on
three of the toolchains stage1-size checks (text room gcc 3,696 B,
nix 3,152 B, fedora 4,008 B, floor 4,096 B); one more step would move
.data past _file_limit. The lab dev-audit flavour already did not link.

hv_vm.o, hv_virtio.o, hv_vuart.o and hv_wdt.o only run when aura hosts
a guest. Link them beside the sptm_virt objects in the executable
read-only region ([_base, _rodata_end) is mapped RX, memory.c), which
has room to spare. Only the placement changes: the code, its mapping and
the DCP log buffer assertion are the same.

With Arch clang (USE_CLANG=1 BUILDSTD=1), text room in the default
Stage 1 goes from 8,624 B to 20,912 B and rodata room from 30,280 B to
17,936 B; headroom is now the data room, 12,272 B. stage1-dev-audit
links again (3,280 B). The secure flavours and the SPTM_VIRT ESP Stage 2
keep their room.

Signed-off-by: DjDeveloperr <hey@djdev.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blast:m5 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants