Skip to content

wifi: apple: centauri: restart a stopped N1 firmware without a reboot on J813 and J815 (carries #2711) - #3123

Merged
DjDeveloperr merged 7 commits into
aurora-silicon:mainfrom
m0d16l14n1:j815/n1-restart
Nov 26, 2026
Merged

DjDeveloperr merged 7 commits into
aurora-silicon:mainfrom
m0d16l14n1:j815/n1-restart

Conversation

@m0d16l14n1

@m0d16l14n1 m0d16l14n1 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What: restart a stopped N1 firmware (Wi-Fi + Bluetooth) from the driver instead of leaving both down until a reboot, on J813 and J815. This carries #2711 (Kyle's commit unchanged; he handed the branch over) plus the fixes from Ryan's review of it, the J815 warm-reset DT, and a Bluetooth attach once Beta's firmware runs, which also fixes Bluetooth coming up late on a cold boot.
Tested: J815 (MacBook Air 15" M5) at 822a1dd7369c (this head: main a60fef7 merged in, plus the centauri-scan host-test stub), in the batched candidate m0d16l14n1/linux j815/prtest-r7 d70fd05 (main a60fef7 + the open T8142 sleep, N1 and J815 PR heads, unchanged): PASS. rom_boot 5 (stopped firmware): restarted, Wi-Fi back and Bluetooth powered in 18 s, 0 HCI timeouts; stop to post-reset stage 1 in 1.7 s (191.207 to 192.931; 5.8 s with the old fixed sleeps). Cold boot: Beta HCI registered at 14 s by the kernel attach (1 ok, 0 failed). Wi-Fi (up 5 s after the wake) and Bluetooth (LE mouse still connected) back after a 604 s deep sleep woken by a key. Regression: 0 SELinux denials (SELinux off), 0 failed units, 0 new kernel errors, 0 WARN/BUG/Oops. The previous head 227c89b69b65 had the same results on j815/prtest-r4/-r6.
Risk: two-way door. J813 and J815 restart only when the firmware has stopped (at most 3 restarts in 30 min). The T6050 host's warm reset now goes through the shared SMC parser; same checks, same writes, no T6050 row yet.
Not yet: a J813 row at this head; a T6050 row for the shared parser (mfd: macsmc commit); a natural (not injected) firmware stop on J815.

Details

Commits:

  1. wifi: apple: centauri: restart a stopped N1 firmware without a reboot: wifi: apple: centauri: restart a stopped N1 firmware without a reboot #2711 at cebbad40, unchanged (Kyle Arrington).
  2. mfd: macsmc: Parse and give a PCIe endpoint's warm reset: one parser for apple,function-warm-reset / apple,warm-reset-writes, used by the T6050 host in pcie-apple and by the N1 driver, instead of the copy wifi: apple: centauri: restart a stopped N1 firmware without a reboot #2711 added (review point 3).
  3. wifi: apple: centauri: wait for the restart's stages, and retry a failed restart:
    • the two fixed msleep(2000) are gone (review point 1). The ROM boot already returns at stage 4, and the boot steps run the port cycle straight after it. After the port cycle the restart polls for stage 1, for at most 5 s. On the earlier J815 run, stage 1 was already there when the port came up (285.685), and the old code then slept until 287.715;
    • centauri_port_cycle() returns the link's result and stores the warm reset's separately, so a refused reset (link up) is retried 10 s later within the same 3-in-30-min limit, and a lost link is reported and left alone (review point 2).
  4. arm64: dts: apple: t8142-j815: Describe the N1 warm reset, as on J813: the J815 ADT's pci-bridge0 function-warm_reset names the same SMC key (bpli) and argument as J813; same writes as J813's node.
  5. wifi: apple: centauri: attach Bluetooth once Beta's firmware runs: function 2 appears with the IPC start's rescan before Beta's firmware runs, so btcentauri refused it and nothing in the kernel tried again. After the IPC start and after a restart, the driver now waits (20 ms poll, 10 s at most) for Beta's exec stage 2 with the IPC unowned, then attaches the function. btcentauri's early probe is logged at info level and returns -ENXIO.

Ryan's review: #2711 (comment) (points 1-3 above). #2711 can be closed in favour of this PR once it is reviewed.

Evidence

At 227c89b69b65 (boot 65e8a168), rom_boot 5:

230.924 firmware fault (debugfs: stopped); checking again in 2 s
232.928 firmware stopped; restarting the N1
233.515 warm reset through the SMC: 0
233.967 ROM firmware result: response=0x1 stage=0x4 mailbox=0xa5a0 poll=0
234.628 recovery: post-reset execution stage=0x1
235.995 Alpha Wi-Fi firmware running; IPC handshake complete
237.536 recovery: IPC start 0
after 21 s: restarted; Bluetooth function attach: 1; Wi-Fi connected yes, BT powered yes, HCI timeouts 0

Cold boot, same head: Beta HCI registered at 15 s; kernel attach: 1 ok, 0 failed.

Earlier run, before the review fixes:

Earlier J815 run (main 2943fff + the J815 PRs, #2711 at cebbad40 + commits 4 and 5, boot ab3dfc4a), rom_boot 5:

279.921 firmware fault (debugfs: stopped); checking again in 2 s
281.954 firmware stopped; restarting the N1
282.538 warm reset through the SMC: 0
282.813 recovery: stage 0x0 after the warm reset
282.986 ROM firmware result: response=0x1 stage=0x4 mailbox=0xa5a0 poll=0
285.685 recovery: post-reset execution stage=0x1
after 21 s: restarted; Bluetooth function attach: 1; Wi-Fi connected yes, BT powered yes, HCI timeouts 0

Cold boot, same run: Beta HCI registered at 14 s; kernel attach: 1 ok, 0 failed.

gig3m and others added 5 commits November 25, 2026 07:30
On J813 the N1 firmware can stop while the machine is awake. A background
scan sees the Alpha execution stage leave 2 and ends with -EIO, and every
later command finds the command ring full. Nothing brought Wi-Fi back
short of a reboot: PERST# alone, through the existing port cycle, leaves
the firmware running.

Restart the chip from the driver:
- Release btcentauri and free the firmware's buffers.
- Remove functions 1 and 2. The reset returns the chip to its
  single-function ROM personality, and a read through a stale function's
  BAR afterwards hangs the fabric.
- Cycle the port with the N1's warm reset, given while the port is down.
  The chip comes back in stage 0.
- Run the probe's boot steps, then attach the Beta function again.

The warm reset comes from the root port's DT node, with the properties
and parsing the T6050 boards already use (bindings/pci/apple,pcie.yaml):
apple,function-warm-reset names the SMC and the key (the ADT's
pci-bridge0 function-warm_reset), apple,warm-reset-writes the writes. A
board restarts only when its root port has both and its port cycle is
known; without them the driver never resets the chip. J813 gets them:
key 'bpli', the same key and argument as the T6050 boards, with the T6050
writes.

The Wi-Fi code reports the signs where it already sees them: the scan
loop's and command_control()'s stage checks, a full command ring and a
command timeout. A report queues a check 2 s later on an ordered,
freezable workqueue, which restarts the chip only if the firmware is
still stopped and the transport is not paused for a system sleep. At most
three restarts in 30 minutes. There is no runtime switch; a board without
the DT properties doesn't restart. debugfs rom_boot 4 restarts by hand, 5
and 6 test the fault path as a stopped firmware and as a fault that
clears.

The status file now reads under boot_lock, so no BAR read lands in a
restart's port cycle. The driver now depends on MFD_MACSMC.

Known limit, shared with the debugfs boot steps: removing function 0
under the PCI rescan lock (sysfs remove, host unbind) while a restart
runs deadlocks.

Signed-off-by: Kyle Arrington <[email protected]>
Signed-off-by: Nick <[email protected]>
A PCIe root port names its endpoint's warm reset with
"apple,function-warm-reset" (the SMC and the key) and
"apple,warm-reset-writes" (each value and the wait after it). The T6050
host reads them in pcie-apple, and the N1 restart on T8142 needs the
same: a second copy of the parser would drift from the first.

Add apple_smc_warm_reset_parse(), apple_smc_warm_reset_put() and
apple_smc_warm_reset() to the SMC driver, and use them in the T6050
host. The host's checks and messages are unchanged: at most four writes,
no wait above 100 ms, a device link to the SMC for the noirq write, and
no reset without both properties.

Signed-off-by: Nick <[email protected]>
…led restart

Review of the N1 restart:

- The restart slept 2 s after the ROM boot and 2 s after the second port
  cycle. The ROM boot already returns once the image is loaded (stage 4),
  as the boot step does, and the boot steps run the port cycle right
  after it, so the first wait goes. After the port cycle the IPC start
  needs stage 1: poll for it, for at most 5 s, and fail with the stage it
  read otherwise.
- The warm reset's result was dropped. centauri_port_cycle() now takes
  where to store it, brings the link up either way, and returns the
  link's result, so the restart can tell a refused reset (link up: try
  again) from a lost link (nothing more to do).
- A failed restart left Wi-Fi down with no further attempt. With the
  link up, the worker tries again 10 s later, within the same limit of
  three restarts in 30 minutes. With the link down it says so and stops.
- The warm reset is read with the SMC driver's parser, shared with the
  T6050 host, instead of a copy.

Signed-off-by: Nick <[email protected]>
The J815 ADT gives pci-bridge0 the same function-warm_reset as J813 (SMC
key bpli, argument 0x1000000), so the N1 driver can restart a stopped
firmware here too instead of leaving Wi-Fi and Bluetooth down until a
reboot. Without these properties centauri_recovery_request() returns
early and debugfs rom_boot 4/5 do nothing on this board.

Signed-off-by: Nick <[email protected]>
Function 2 (Bluetooth) appears with the IPC start's bus rescan, before
Beta's firmware runs, so btcentauri cannot take it then. Only the restart
path attached it afterwards; on a cold boot nothing in the kernel did and
hci0 came up only when a userspace script reloaded btcentauri (51 s after
boot on J815 boot feb7dfb0, against ~15 s for Wi-Fi).

After the IPC start step and after a restart, wait up to 10 s for Beta's
firmware (exec stage 2, IPC unowned: the state btcentauri checks), then
attach the function. The restart path's immediate attach could race the
same firmware start; it now uses the same helper.

btcentauri's early probe was logged as two errors on every boot; the state
is expected, so log it at info level and return -ENXIO, which the driver
core does not report as a failed probe.

Signed-off-by: Nick <[email protected]>
@m0d16l14n1
m0d16l14n1 requested a review from a team as a code owner November 25, 2026 04:40
@m0d16l14n1
m0d16l14n1 requested a review from Acelogic November 25, 2026 04:40
@github-actions github-actions Bot added area:bringup Area from CODEOWNERS (bot) area:power Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (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 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Merge readiness at 822a1dd7: ready to merge

Check Detail
CI at head ok 27 checks passed
Review ok approved by satchlj
Requested changes ok none
Hardware row at head ok in the PR body at 822a1dd7
Conflicts ok none
PR text ok Risk: two-way · . J813 and J815 restart only when the firmware has stopped (at most 3 restarts in 30 min). The T6050 host's warm reset now goes through the shared SMC parser; same checks, same writes, no T6050 row yet.

Areas: area:bringup, area:gpu, area:power
Merge: gh pr merge 3123 --merge (Owners and Core through the bypass: add --admin).

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

@m0d16l14n1

Copy link
Copy Markdown
Contributor Author

J815 (MacBook Air 15" M5) row at 227c89b69b65, in a batched candidate (j815/prtest-r4, the same heads minus #3129/#3130; boot 65e8a168).

aurora-feature-test n1recover (rom_boot 5, firmware stopped):

230.924 firmware fault (debugfs: stopped); checking again in 2 s
232.928 firmware stopped; restarting the N1
233.515 warm reset through the SMC: 0
233.967 ROM firmware result: response=0x1 stage=0x4 mailbox=0xa5a0 poll=0
234.628 recovery: post-reset execution stage=0x1
235.995 Alpha Wi-Fi firmware running; IPC handshake complete
237.536 recovery: IPC start 0
after 21 s: restarted; Bluetooth function attach: 1; Wi-Fi connected yes, BT powered yes, HCI timeouts 0

The fixed sleeps are gone: firmware stop to post-reset stage 1 is now 1.7 s (232.928 to 234.628); the earlier run, with the two msleep(2000), took 5.8 s. Cold boot: Beta HCI registered at 15 s, kernel attach 1 ok, 0 failed.

On j815/prtest-r6 (adds #3129/#3130), boot 6aaae3d9: Wi-Fi and Bluetooth up after one real deep sleep and wake. Regression on the same boot (6aaae3d9, after the wake): 0 SELinux denials (SELinux off), 0 failed units, 0 new kernel errors vs the previous boot, 0 WARN/BUG/Oops.

@github-actions github-actions Bot added merge-conflict Conflicts with the base branch (bot) and removed needs-hw-row No hardware row at the PR head (bot) labels Nov 25, 2026
Resolve the scan_worker conflict with aurora-silicon#3120's scan stop guards: a
stopped transport asks for recovery only when the driver isn't
stopping or paused and Alpha isn't at its run stage.

Signed-off-by: Nick <[email protected]>
The scan worker now asks for a recovery when Alpha leaves its running
stage (from main). The host model of the worker has no recovery path, so
give it a counting stub and keep the scan tests building.

Signed-off-by: Nick <[email protected]>
@m0d16l14n1
m0d16l14n1 requested review from a team as code owners November 25, 2026 05:57
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) needs-hw-row No hardware row at the PR head (bot) and removed ci-failing A check failed at the PR head (bot) merge-conflict Conflicts with the base branch (bot) labels Nov 25, 2026
@m0d16l14n1

Copy link
Copy Markdown
Contributor Author

J815 (MacBook Air 15" M5) row at the new head 822a1dd7369c (main a60fef7 merged in; the conflict with #3120 in the scan worker resolved as on the tested r6 tree; the centauri-scan host test gets a stub for the recovery call): PASS.

Candidate: m0d16l14n1/linux j815/prtest-r7 d70fd05 = main a60fef7 with these PR heads merged unchanged: #2384 f9d03e8, #2385 b1c3392, #2192 c5daf57, #2193 8be9e73, #3123 822a1dd, #3124 1a272ce, #3125 4ad71b8, #3129 6d5ec4d, #3130 76bf36c, plus the open J815 PRs (r6 + #3123's new head). Stage 2 as on r6. Command line: default + pcie_aspm=off apple_sleep.deep=1 nvme_apple.sleep_untested=1 appledrm.s2r_untested=1 apple_sep.xart_writes=0 apple_sep.provision_keybag=0 apple_sleep.t8142_wake_s=0 (the last one turns off the timed PMU wake, so the sleep lasts until a key).

aurora-feature-test n1recover (rom_boot 5, firmware stopped):

191.207 firmware stopped; restarting the N1
191.818 warm reset through the SMC: 0
192.264 ROM firmware result: response=0x1 stage=0x4 mailbox=0xa5a0 poll=0
192.931 recovery: post-reset execution stage=0x1
after 18 s: restarted; Bluetooth function attach: 1; Wi-Fi connected yes, BT powered yes, HCI timeouts 0

Cold boot: Beta HCI registered at 14 s, kernel attach 1 ok, 0 failed. Wi-Fi: factory MAC (= DT), gateway ping ok; Bluetooth: factory address (= DT), scan ok.

One deep sleep with no timer, woken by a key on the built-in keyboard after about 10 minutes (boot 9325546c): Timekeeping suspended for 603.654 seconds, 9 cores started in one burst, CPUs 0-9 online, suspend_stats success=1 fail=0; the wake source is the built-in keyboard/trackpad. Panel, NVMe, Wi-Fi (up 5 s after the wake) and Bluetooth (LE mouse still connected, 0 TX/RX errors, exec 2 / IPC 2) back.

Regression on the same boot, after the wake: 0 SELinux denials (SELinux off), 0 failed units, 0 new kernel errors vs the previous boot, 0 WARN/BUG/Oops.

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Verdict: MERGE at 822a1dd7369c
Blockers: none
Checked: full diff across macsmc warm-reset helper, pcie-apple refactor, centauri recovery and port cycle paths, btcentauri probe behavior, DT bindings and board DTS, scan test stub, and live CI

Evidence
  • Verified apple_smc_warm_reset_parse/put/apple_smc_warm_reset extraction in drivers/mfd/macsmc.c (with clean error-path put_device cleanup and microsecond bounds checking) and matching refactor in drivers/pci/controller/pcie-apple.c.
  • Verified centauri_recover() tears down function 2 (btcentauri), frees IPC buffers, removes functions 1 and 2 under pci_lock_rescan_remove(), cycles the port with the SMC warm reset, reboots from ROM, and re-attaches Beta via centauri_attach_beta() on an ordered freezable workqueue (centauri_wq) with a 3-restarts-per-30-min circuit breaker and clean disable_delayed_work_sync() teardown in centauri_remove().
  • Verified centauri_status_show() takes boot_lock to avoid BAR reads across link resets, and crash_file is created once to avoid debugfs lock inversion under boot_lock.
  • Live CI green (26/26 checks passed, 0 pending, 0 failed) with exact-head J815 hardware verification recorded on the PR.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 25, 2026
@gig3m

gig3m commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

J813 (MacBook Air 13" M5) row at 822a1dd7369c, in m0d16l14n1/linux j815/prtest-r8 7b4bbe9 plus one local display-format patch (XRGB on the primary plane, for Hyprland; it doesn't touch the N1). Default N1 module parameters; the J813 DTB from this tree carries both warm-reset properties.

  • rom_boot 6 (fault that clears): "firmware fault cleared; no restart".
  • rom_boot 5 (stopped firmware): the 2 s check, then "warm reset through the SMC: 0", stage 0x0, ROM boot, "restarted; Bluetooth function attach: 1". From "restarting the N1" to post-reset stage 1: 1.74 s (97.695 to 99.436).
  • After the restart: Bluetooth attached 6.8 s after the stop, Wi-Fi reconnected 18 s after it, 3/3 pings over the Wi-Fi interface, Bluetooth powered, 32 devices in a 6 s scan, 0 timeouts.
  • Cold boot: "Beta HCI transport registered" and "Bluetooth function attached" at 10.8 s, by the kernel, with no manual bind. The N1 itself is still started by a userspace unit (the debugfs boot steps), as before.
  • Two deep sleeps on this boot (below, soc: apple: sleep, nvme, drm/apple: T8142: deep sleep by default #3135) brought Wi-Fi and Bluetooth back each time.

Not tested: a natural firmware stop on this head.

Assisted-by: LLM (Claude:Opus 5.5)

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed ready-to-merge Meets the merge policy: merge it (bot) labels Nov 25, 2026

DjDeveloperr commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

PASS on a 14-inch MacBook Pro (J714s, M5 Pro/T6050, G17S B1), kernel 7.3.0-m5-rows-prs, at 822a1dd7369c6594f05fe3f31bb43385ba721727.

Candidate 053c0549b09b7a48582d5dfbfeb1ddbb25af442d merged these unchanged heads onto main 15695c3ba53291e78bf62140598dbdffc7fb2b72 plus Clang fix 0050f580cc54892302f38e458e609d1b793010e0, which has since merged. The baseline was that same main plus the fix (f2b85419afafcfd6e6bc5ceeaa79e9ee557563a4).

The merged heads were #2906 f3ad1a8f362c, #3123 822a1dd7369c, #3116 064c3c65cd3e, #2949 0a4f6d6576a3, #2913 48b6d70dde9e, #2218 b3e6c51a4b5f and #2007 4738426f6c24.

Wi-Fi was connected and Bluetooth hci0 was powered on before and after the 30.7 s deep sleep. There were 0 new Centauri, macsmc or pcie-apple errors. The same two pre-existing error-priority lines appeared after resume on the baseline and candidate. Centauri logged firmware country update failed: -125, and Bluetooth Centauri logged Unable to change power state from unknown to D0, device inaccessible. The count was 1 Wi-Fi Centauri, 1 Bluetooth Centauri, 0 macsmc and 0 pcie-apple on both arms. The injected-stop fixture is available on J813, J815 and J873g.

The sleep check used deep mem. The baseline s2idle attempt stayed unreachable.

The command line matched the default. SELinux was disabled. tailscaled.service was the one failed unit on both boots and on the default. Each boot had 6 error-priority lines, all the known DCP clock-index message. After one deep cycle, there were 83 warning/error-priority lines on the baseline and 79 on the candidate, with zero added lines and zero kernel WARNING: reports. The known DCP clock-index message occurred 10 times on each arm through the wake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:bringup Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) area:power Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants