Repository navigation
kboot: T8152: run speaker safety, amp config, and speaker ID - #548
Conversation
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
left a comment
There was a problem hiding this comment.
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, butkboot_audio_speaker_id()writes/chosen/asahi,speaker-id. If you have the Stage 2 log from that boot, please post itskboot: audio: ... speaker ID/no speaker ID straplines (or say whether/chosen/asahi,speaker-idwas 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-checkwith clang-format 20.1.8 is clean.make RELEASE=1 CHAINLOADING=1 ESP_STAGE2=1 USE_CLANG=1 BUILTIN_LOGO=aurora BUILDSTD=1builds 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 aretest_loadobjs.py::test_tool_output_lines/test_run_tool, a localnmoutput difference that also fails on main26c1a85b. tests/run-kboot-audio.sh: 38 scenarios pass.tests/python/test_t8152_audio_dt.pywithsrc/kboot.cfrom main: fails att8152_audio_dt.c:344: amp_written == 1. At head: passes, 8/8 together withtest_t8152_display_fb.py.- GitHub CI at head is still queued.
|
Merge readiness at
Areas: none matched in CODEOWNERS Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
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>
What: Call
dt_set_speaker_safety(),kboot_audio_amp_config(dt, adt), andkboot_audio_speaker_id(dt, adt)at the start ofdt_prepare_t8152(), matching the generickboot_prepare_dt()path, and add a host test (tests/python/test_t8152_audio_dt.py) covering both loader modes and all three post-#328dt_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 1aura-tryStage 2 trial) paired with aurora-silicon/linux#3434 (7.3.0-aurora-j873-speaker+18a0e3bcd3f7) andspeakerguarddv2 (5bd2d652):/soc/i2c@33101c000/codec@38receivedapple,speaker-config(4 B, amp level15),apple,bop-config(24 B), andapple,amp-dcblocker-config(4 B) from the Mac's ADT (apple,amp-tx-zd-configabsent), with no staleasahi-speaker-safetyorapple,speaker-idunder/chosen;macaudioadmittedAppleJ873(Primary+Secondaryplayback,Primarycapture only,Amp Gain Volumecapped at15,Speaker Volumelocked at floor,Amp Fault Status = 0,0,0);speakerguardd-selfcheck(AID48,derived-nosense) PASS,speakerguarddv2 supervisor + PipeWiresgv2#voicing-1ch->sgv2#1chgranted"Speaker Protection"on stream start and returned to muted floor on idle,0kernel audio/DART errors,0failed units. Local host tests atc83bcb7f: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-checkclean.Risk: two-way door — affects T8152 DT preparation only.
kboot_audio_amp_config()andkboot_audio_speaker_id()fail soft and never stop a boot;dt_set_speaker_safety()scrubs stale/chosen/asahi-speaker-safetynodes and publishes or fails closed on a partialspeaker-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: calldt_set_speaker_safety(),kboot_audio_amp_config(dt, adt), andkboot_audio_speaker_id(dt, adt)at the start ofdt_prepare_t8152(), beforefdt_pack().tests/python/test_t8152_audio_dt.py: compiles the realdt_set_speaker_safety()anddt_prepare_t8152()against the in-treelibfdtwith-Wall -Wextra -Werror -fsanitize=undefinedand verifies:/product/audio(J873g 27.x ADT), bothaurora,minimal-bootand non-minimal modes: staleasahi-speaker-safetyscrubbed,apple,speaker-configwritten beforefdt_pack(),kboot_audio_speaker_id()called, step order preserved./product/audio: stale node replaced and all profile properties published.speaker-cpms-bgd_*property or missingacoustic-id):dt_prepare_t8152()returns-1and leavesdt_ready == false./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.1.0.0b17-gc83bcb7f+7.3.0-aurora-j873-speaker+, one-shotaura-try,0failed units):/sys/firmware/devicetree/base/chosen/asahi,m1n1-stage2-version:1.0.0b17-gc83bcb7f/sys/firmware/devicetree/base/chosen/: noasahi-speaker-safetyorapple,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-configabsent.AppleJ873:Amp Gain Volumemin=0, max=15, values=15;Speaker Volumelocked at floor until"Speaker Protection"lease grant;Amp Fault Status = 0,0,0;speakerguardd-selfcheck(5bd2d652,AID48,derived-nosense) PASS.