Skip to content

wifi: apple: centauri: keep the firmware crash record and restart a silently stopped Alpha - #3460

Merged
DjDeveloperr merged 4 commits into
aurora-silicon:mainfrom
m0d16l14n1:feat/centauri-keep-crash-record
Dec 2, 2026
Merged

DjDeveloperr merged 4 commits into
aurora-silicon:mainfrom
m0d16l14n1:feat/centauri-keep-crash-record

Conversation

@m0d16l14n1

@m0d16l14n1 m0d16l14n1 commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

What: keep what the N1 Wi-Fi firmware left behind when it stops, and restart it when it stops without saying so. The restart after a firmware fault freed the crash region and the Alpha DRAM log before anyone could read them. They are now copied first and kept as debugfs firmware_crash_saved and firmware_log_saved, and the restart log gives their size. Alpha can also leave execution stage 2 without a fault interrupt; the link and scan workers then reported only a disconnect or an aborted scan, and Wi-Fi stayed down until a module reload. Now they request the restart. Stacked on #3458 (base feat/centauri-wifi-stats 625fd0f15687); this PR's own commits are the three listed under Details. This replaces the N1 test branch #3166 for this topic.
Tested: J815 (MacBook Air 15" M5) with this head's code: apple_centauri and btcentauri built from the N1 tester merge cded55efa713 and swapped live into the running j815/prtest-r8 (7b4bbe9) kernel (see Evidence), no centauri or Bluetooth words on the command line: PASS. A firmware stop from debugfs (rom_boot 5) took the fault path: the crash region was copied (40960 bytes), Wi-Fi rejoined and hci0 was back in 15 s. Centauri host tests 20/20. Regression: 0 SELinux denials (SELinux not built on this image), 0 failed units, 0 N1 driver errors, 0 WARN/BUG/Oops.
Risk: two-way door; N1 boards on the shared transport (J813, J815 and the other T8142/T8152 boards). The copies cost one allocation of the region's size per restart. The new restart trigger fires only when Alpha is out of stage 2 while the transport is neither stopping nor paused. T6050 boards are not reached (#3346 covers their warm-reset recovery).
Not yet: a real firmware crash captured (the debugfs stop leaves the region all zero); the silent-stop restart and the DRAM log copy have not fired on hardware in this run (no silent stop happened, and the firmware log was not started); a J813 row.

Details

Commits of this PR (on top of #3458):

  • wifi: apple: centauri: keep the firmware crash region across a restart: copy the crash region in the firmware's secondary memory before the restart frees anything; debugfs firmware_crash_saved; the restart log says how large it was and whether it held anything.
  • wifi: apple: centauri: restart the firmware when Alpha stops silently: the link and scan workers check the Alpha execution stage and call the existing recovery request when it has left stage 2.
  • wifi: apple: centauri: keep the Alpha DRAM log across a restart: when fwlog_start set the log up, copy it before the restart frees it; debugfs firmware_log_saved; log its size, the consumer and producer indices, and the stage value seen.

The restart paragraph in centauri.rst describes all three.

Evidence

Tested tree: cded55efa713 = this branch + #3207, #3459 and the BT audio and AWDL branches. This head differs from what was tested only in commit messages and in two lines of tools/asahi/run-host-tests.py that register other branches' host tests. Modules swapped live into J815 7.3.0-aurora-j815-dev (j815/prtest-r8 7b4bbe9), command line console=tty0 user4k=on pcie_aspm=off idle=nop arm64.nowfxt plus the image's root/ESP words, apple_sep.xart_writes=0 apple_sep.provision_keybag=0 (removed from main, logged as unknown and ignored) and aurora.untested_commit=0 aurora.alphasleep=0 (stop the test initramfs setting its opt-ins, so the module defaults are what run); no centauri or Bluetooth words.

124.26 apple_centauri 0000:01:00.0: recovery: stage 0x2, releasing the firmware's buffers
124.26 apple_centauri 0000:01:00.0: recovery: kept the firmware crash region (40960 bytes, all zero)
125.14 apple_centauri 0000:01:00.0: recovery: stage 0x0 after the warm reset
125.95 apple_centauri 0000:01:00.0: recovery: post-reset execution stage=0x1
128.90 apple_centauri 0000:01:00.0: recovery: IPC start 0
PASS recover: Wi-Fi rejoined and hci0 back in 15 s

…, and data path

Add full station telemetry, channel survey, band capability reporting,
ethtool firmware version reporting, and data-path improvements:

- Parse firmware statistics reports using packed wire structures with
  compile-time layout checks: TX retries/failures and live RX/TX bitrates
  (TLV 0xf901), beacon RX/loss (TLV 0xf915), TX power and rate history
  (TLV 0xf920), per-chain RSSI and noise floor (TLV 0xf923), station
  noise (TLV 0xf908), and CCA channel survey (TLV 0xf903).
- Populate wiphy->fw_version from firmware version query and wire
  ethtool_ops.get_drvinfo = cfg80211_get_drvinfo on both T8142/T8152 and
  T6050 Wi-Fi netdevs so ethtool -i reports the running firmware version.
- Populate HT, VHT, and 2.4/5/6 GHz HE band capabilities, decode
  disconnect reason codes, apply initial firmware regulatory country hint,
  and avoid restricting channel widths absent from 20 MHz-only lists.
- Add NAPI GRO receive processing, TX in-flight cap with bypass watchdog,
  and TCP pacing shift; add Centauri driver documentation.

Signed-off-by: Nick <nekreshen@yandex.ru>
The firmware reserves a crash region in its secondary memory, which
debugfs firmware_crash reads. A restart after a firmware fault frees
that memory before anyone can read it, so the region of the firmware
that stopped is lost and the fault leaves no record of its own.

Copy the region before the restart frees anything and expose the copy
as debugfs firmware_crash_saved. The restart log says how large it was
and whether it held anything.

Signed-off-by: Nick <nekreshen@yandex.ru>
Alpha can leave execution stage 2 without raising a fault interrupt.
The link worker then only reported a disconnect and the scan worker an
aborted scan, and Wi-Fi stayed down until the module was reloaded.

When either worker finds Alpha out of stage 2 while the transport is
neither stopping nor paused, request the firmware restart.

Signed-off-by: Nick <nekreshen@yandex.ru>
The firmware faults seen on the J815 leave nothing to read: the crash
region in secondary memory is all zero after an Alpha stop, and the
restart frees the Alpha DRAM log, the only record the firmware keeps
of what it did last, together with the rest of the IPC buffers.

When fwlog_start set the log up, copy it before the restart frees it
and expose the copy as debugfs firmware_log_saved; the restart log
gives its size and the consumer and producer indices. Log the Alpha
execution stage value seen when the stop is detected, which the fault
message did not give.

Signed-off-by: Nick <nekreshen@yandex.ru>
@m0d16l14n1
m0d16l14n1 requested review from a team and DjDeveloperr as code owners November 28, 2026 01:48
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) 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) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Merge readiness at f8442a49: not ready yet

Check Detail
CI at head ok 20 checks passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok comment at f8442a49
Conflicts ok none
PR text ok Risk: two-way · N1 boards on the shared transport (J813, J815 and the other T8142/T8152 boards). The copies cost one allocation of the region's size per restart. The new restart trigger fires only when Alpha is out of stage 2 while the transport is neither stopping nor paused. T6050 boards are not reached (#3346 covers their warm-reset recovery).

Areas: area:gpu

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

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: MERGE at f8442a49

Blockers: none in code (note: stacked on #3458 — merge after #3458 lands and remaining queued KUnit CI jobs finish green).

Checked: no Apple material, no AI attribution, no new chip/board/firmware gates, no cmdline hacks, human Signed-off-by, centauri_keep()/centauri_save_crash() locking (boot_lock), alpha_log SZ_4M bounds before 0x10/0xb0 header reads, kvfree() cleanup in centauri_remove(), alpha_halted guard (!stopping && !transport_paused), J815 recovery row (rom_boot 5, 40960-byte crash region saved, Wi-Fi + hci0 recovered in 15 s, 20/20 host tests), apple-build, host-tests, and pr-text green.

Evidence
  • Inspected the incremental diff (625fd0f1...f8442a49) across centauri.h, centauri_ipc.c, centauri_pci.c, centauri_wifi.c, and centauri.rst.
  • Verified centauri_save_crash() runs under boot_lock (asserted via lockdep_assert_held), c->ipc->alpha_log is allocated as SZ_4M (so header reads at +0x10 and +0xb0 are always in bounds), firmware_crash_saved_read/firmware_log_saved_read serialize under boot_lock, and centauri_remove() calls kvfree() on both saved buffers after debugfs_remove_recursive().
  • Hardware row: J815 (cded55efa713, identical diff) PASS on rom_boot 5 fault recovery (40960-byte crash region copied, Wi-Fi + hci0 back in 15 s, 0 driver errors).
  • CI at f8442a49: apple-build, host-tests, pr-text, KUnit ane-boot/ane-pm/dcp-fabric/dcp-topology PASS; remaining KUnit jobs queued.
  • Merge order: merge #3458 first.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merge-train status at f8442a49 (App approval and J815 row noted). Under the 6-point rule this still needs: (a) green KUnit; (b) a regression row on a second family, since the centauri N1 driver also runs on T6050 (K114s) and T8152 (J873g). We'll ask for a K114s smoke covering this stack; (c) the code-owner ping, done here: @DjDeveloperr, merge earliest 16:52 AEDT once (a) and (b) are in. Stacked on #3458: merges after it, in order. Revert: git revert -m 1 <merge>.

@erikwb

erikwb commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

J716c (16-inch M5 Max, T6050) at f8442a49: no regression on a T6050 board (not reached by the new restart path, as the PR says): N1 Wi-Fi associates with 0% gateway ping loss, Bluetooth powered, no N1 driver errors.

Evidence

Batched kernel 7.3.0-ewb368+ = main 219311530ef0 + #3605 222e0e6b + #3311 cc26f9ee + #3310 5fb10c0a + #3458 625fd0f1 + #3459 af388dc6 + #3460 f8442a49, each head merged unchanged. The J716c DTB is built without #include "t6050-media.dtsi" (main hangs the J716c at boot otherwise, #3618). One-shot trial boot on the default command line plus watchdog.open_timeout=120 (recovery watchdog for test boots only); compared with the default 7.3.0-ewb342+ on the same Mac, dock and network.

iw dev wlan0 link: associated at 5240 MHz, -37 dBm; 20 pings to the gateway 0% loss; bluetoothctl show: powered. Kernel errors are the same set as the default boot; failed units: aurora-peripherals.service only, same as the default boot.

@github-actions github-actions Bot removed needs-hw-row No hardware row at the PR head (bot) ci-failing A check failed at the PR head (bot) labels Nov 29, 2026
DjDeveloperr
DjDeveloperr previously approved these changes Dec 2, 2026

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

Approve at f8442a4900bf. The diff against main includes the already-merged #3458, so I read this PR's three commits plus the test merge on current main. Crash-region offsets and lengths are read once and bounded to the region, and the log copy uses the host's 4 MiB size. Both copies are freed in centauri_remove after the restart work is disabled and debugfs is gone. The new restart requests in the link and scan workers run outside wifi->lock. Every request still goes through the 2 s re-check and the 3-in-30-minutes limit.

Three things worth a follow-up, none blocking:

  1. A failed restart's retry overwrites the real record. centauri_save_crash copies the new boot's (zeroed) region over the one from the real crash. Skip the save when restart_failed is set, or never replace a non-zero copy with a zero one.
  2. The copy is taken while Alpha DMA is still live. It runs before centauri_free_boot, and ipc->alpha_log is read without the lock fwlog_start_write takes. Taking it inside centauri_free_boot, after the stop succeeds and before centauri_free_ipc, avoids both the torn copy and the race.
  3. No test reaches the new branch. centauri-scan-tests.py always runs at Alpha stage 2 and never counts requests. Stage 3 should give one request, and stage 3 while paused should give none.

@m0d16l14n1
m0d16l14n1 dismissed DjDeveloperr’s stale review December 2, 2026 07:12

The merge-base changed after approval.

DjDeveloperr
DjDeveloperr previously approved these changes Dec 2, 2026

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

Re-approving at f8442a4900bf. GitHub dismissed the 07:12 approval only because #3458 landed and moved the merge base. #3458 merged as 625fd0f15687, the base these three commits sit on, so the diff against main is now just this PR's own three commits, unchanged from what I reviewed. CI at this head is green. The rows are the J815 run of this code and erikwb's exact-head J716c (T6050) regression row. The three follow-ups in my earlier review (keep a non-zero record on a failed retry, copy inside centauri_free_boot, a stage-3 scan test) stay open as follow-ups.

@m0d16l14n1
m0d16l14n1 dismissed DjDeveloperr’s stale review December 2, 2026 19:55

The merge-base changed after approval.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Merging at f8442a4900bf with an admin merge. Every code-owner approval at this head is dismissed within seconds as "merge base changed" (07:12 and 19:55 today). This PR was retargeted from its stacked base, and there has been no push since. The diff against main is this PR's own three commits on top of 625fd0f15687 (#3458), exactly what was reviewed. The App approval at this head still stands. Hosted CI at this head is green (apple-build, host-tests, all KUnit suites, pr-text). The rows are the J815 run of this code (fault-path restart, Wi-Fi and hci0 back in 15 s) and the exact-head J716c (T6050) regression row. Revert with git revert -m 1 <merge>.

@DjDeveloperr
DjDeveloperr merged commit 8847cb3 into aurora-silicon:main Dec 2, 2026
21 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpu Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants