Repository navigation
wifi/bluetooth: apple: centauri: T8142 N1 work in one branch for testing - #3166
m0d16l14n1 wants to merge 24 commits into
Conversation
When a netdev goes down while its driver is still scanning, NETDEV_DOWN completes the scan for cfg80211 with ___cfg80211_scan_done(rdev, false). That parks the result message in rdev->scan_msg, to be sent once the driver is done, and, because the driver still owns the request, only marks the request stale. When the driver later calls cfg80211_scan_done(), the stale path frees the request and returns without queueing scan_done_wk, the only place that sends and clears rdev->scan_msg. The message then stays forever, and nl80211_trigger_scan(), cfg80211_conn_scan() and the internal scans all fail with -EBUSY while it is set: no scan or connect works on that wiphy until the driver is reloaded. Queue scan_done_wk from the stale path as well, so the parked message is sent. Since a run queued this way may find that the message has already gone out and a newer scan is in progress, make the work function return when there is no message to send and the current request has not yet been completed by the driver. Seen on a MacBook Pro (M6, J804) with the Centauri driver, on an earlier base (integration/aurora f5fa539): NetworkManager takes the interface down for a lid-close sleep while a wpa_supplicant scan runs, and after the wake every scan failed with "CTRL-EVENT-SCAN-FAILED ret=-16" until reboot. With this change (and scan abort and interface-down handling in that driver), Wi-Fi reconnected within 2 s after each of two lid sleeps, with no failed scan. Signed-off-by: LiamRay11 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Alpha host-power and ACIPC sleep requests are the N1 firmware's protocol, but suspend and resume only ran them on apple,j813. J815 has the same N1 behind the same PCI functions and its own entry in the driver's board table. Run suspend wherever the native driver bound (c->wifi is set, which needs a board entry), still behind the TEST ONLY alpha_sleep_untested switch, and drop resume's board check: it only undoes requests suspend sent and returns at once otherwise. With the switch off nothing changes on any board. Fixes: 4cca392 ("wifi: apple: centauri: quiesce Alpha for J813 system sleep") Suggested-by: Thomas Glanzmann <[email protected]> Signed-off-by: Ryan Murray <[email protected]>
Every reply to the statistics command overwrites stats_length, while station_stats_valid is only set by a station counter record of a supported length. A later reply carrying another record leaves the counters marked valid with a length that no longer describes them, and the debugfs and connection readers then iterate past station_stats. Record the length of the accepted counter record in its own field, set together with station_stats_valid, and iterate over that. Move the statistics reply handling into a helper so that it can be tested, and add a KUnit case for it (CONFIG_APPLE_CENTAURI_KUNIT_TEST). Signed-off-by: Ryan Murray <[email protected]>
The connection log line printed the last statistics reply's length next to the station counters, which no longer has to be the counters' own length. Print the kept counter length there, and add it to the debugfs station_stats header as counters=, after the reply's own fields. Word the KUnit option's help for the driver, not one board. Signed-off-by: Ryan Murray <[email protected]>
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]>
The T8142 Beta transport already carries ACL data: BR/EDR on rings 2 and 8, LE on rings 4 and 10. Delivery was opt-in (enable_acl), and it needed arm_auxiliary_rings, which opens every auxiliary ring and allocates a 1 MiB private capture of what they receive. Without both, hci0 comes up and scans, but no device can connect: pairing, HID and audio all need ACL. Turn ACL delivery on by default and arm only the two ACL rings for it. The other auxiliary rings and the capture move behind a new diagnostic_capture parameter; the frames on them are not delivered either way. enable_acl=0 still gives the command and event transport alone. Signed-off-by: Nick <[email protected]>
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]>
Alpha's host-power and ACIPC sleep handshake ran only with apple_centauri.alpha_sleep_untested=1. Without it the N1 firmware is not told the host goes to sleep, and a deep sleep is aborted and the Mac woken about a minute in. The handshake runs through full deep sleeps and wakes on J813 and J815 (MacBook Air 13" and 15" M5). Default it on, for a deep sleep only: across s2idle the firmware keeps running and nothing is sent, as before. alpha_sleep_untested=0 skips it. Signed-off-by: Nick <[email protected]>
Signed-off-by: Nick <[email protected]>
Signed-off-by: Nick <[email protected]>
Signed-off-by: Nick <[email protected]>
Signed-off-by: Nick <[email protected]>
Signed-off-by: Nick <[email protected]>
Signed-off-by: Nick <[email protected]>
…ress The J815 test tree's Bluetooth work, in one commit for testing: - SCO and LE Audio ISO data rings, and a command timeout handler; - wideband speech advertised (mSBC/LC3 over the SCO rings); - hdev->set_bdaddr through the vendor command 0xfc06; - the Beta rings are polled again instead of PCI MSI vectors (the MSI is a firmware-programmed DMA mailbox, not a PCI vector); - an RX cookie leak and a lock scope fixed, and the scan duplicate filter falls back when the controller refuses it; - a diagnostic_capture parameter for bring-up captures. Signed-off-by: Nick <[email protected]>
… path The J815 test tree's Wi-Fi work, in one commit for testing: - station info from the firmware's counters: TX retries and failures, beacon RX and loss per association, live RX and TX bitrate, per-chain signal from the PHY dump, and .get_tx_power; - a channel survey from the CCA counters (active, busy, TX time) with the PHY dump's noise floor; - the firmware version in the wiphy and ethtool info; - HT, VHT and 2.4/5 GHz HE band capabilities; - disconnect reasons decoded, an initial country hint; - channel widths a 20 MHz-only firmware list leaves out are no longer restricted; - NAPI with GRO, a TX in-flight cap and the TCP pacing shift; - the scan rework, unit tests for the parsers, and a driver document. Signed-off-by: Nick <[email protected]>
A restart through rom_boot 4 brought Wi-Fi back but left hci0 away: the Bluetooth function was re-enumerated while its firmware was still down, btcentauri gave up waiting, and nothing attached it again. The fault path's restart and rom_boot 3 both attach it once the IPC runs. Do the same after rom_boot 4. Seen on the J815 test kit: "after the restart: hci0=no (60 s)", while the fault path's restart that followed brought hci0 back in 16 s. Signed-off-by: Nick <[email protected]>
On the J815 the station info never carries per-chain signal: the PHY dump the driver asks for yields no chains. Log its result at debug level, and on failure the command's return, the reply's size and its first TLVs, so the test kit can show why. To be dropped before the split. Signed-off-by: Nick <[email protected]>
|
Correction: per-chain signal was not missing. Hardware row at 7fdab54: J815 (MacBook Air 15-inch M5). Kernel Everything passes except per-chain signal in the station info. That is still missing, so 89abbf9 logs what the PHY dump returns, for the next run. Not in this row:
|
The N1 lists Enhanced Setup Synchronous Connection in its supported commands, so the core uses it for every SCO/eSCO link, but the firmware answers it with Unsupported Feature or Parameter Value (0x11). On a MacBook Air 15" (M5) with AirPods connected, switching to the headset profile (mSBC) sent it twice, both were refused, no link came up and the microphone recorded digital silence. Set HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN so the core sends Setup Synchronous Connection with the air mode in the voice setting instead. Signed-off-by: Nick <[email protected]>
|
J813 (MacBook Air 13" M5) run at
Blocker: changing the MAC address stops the Alpha firmware on J813. NetworkManager sets a random scan address after every disconnect, so every disconnect restarts the N1. 3 of 3
Scans: "firmware fault (scan: Alpha stage)" on 2 of 16 Same AP (5765 MHz, 40 MHz), r8 modules vs this head:
Per-chain signal works on this board. The PHY dump fills it every time, and "gave no chains" never appears: Not run: headset A2DP/HFP/LE Audio (no headset), and LE mouse traffic on these modules. The new head abda032 only changes the btcentauri voice-link setup, which none of this reaches; the Wi-Fi findings stand at it. Assisted-by: LLM (Claude:Opus 5.5) |
|
Follow-up to the J813 row above: that run was on old N1 firmware. havok had Rev 72.129.725 from the 26.6.2 (25G83) restore image. I've replaced it with 27.2.1 (26B131) The MAC-change blocker doesn't depend on the firmware. On 92.4.10, 2 of 2 The N1 restart then brings the link back, so a reconnect check that only waits for "connected" passes. Mine did, in 13.7 s, against 4.1 s on the r8 modules with no fault. Worth checking whether the J815's 8 s NetworkManager reconnect went through the same restart ( Everything else on J813 now matches the J815 row, same AP (5765 MHz, 40 MHz):
The r8 modules on 92.4.10, as the control: scans 2.6 s, 0 faults, NetworkManager reconnect 4.1 s, recover 17.3 s. Assisted-by: LLM (Claude:Opus 5.5) |
|
@m0d16l14n1 checking open drafts today. To come out of draft, this still needs:
If it's no longer needed, say so here and we'll close it. Otherwise it stays open as a draft until these are done. |
|
it's a WIP, just a drafted PR for easy testing |
|
Closing: this test branch is now split into one PR per topic, all on New PRs from this branch
Earlier N1 PRs, merged
Still open, not part of the new PRs
As promised under "Not yet" above: the statistics parsers now use named, size-checked wire structures, and the PHY dump logging commit is gone. |
What: All of the N1 (Wi-Fi + Bluetooth) work for T8142 in one branch on main, for testing on hardware. It carries the open N1 PRs (#2385, #2908, #3123, #3124, #3136, #2110) unchanged and adds Bluetooth SCO/LE Audio and wideband speech, voice links without the enhanced setup command, Wi-Fi station statistics, band capabilities and data-path changes. It will be split into one PR per topic once tested; it is not meant to merge as it is.
Tested: J815 (MacBook Air 15-inch M5) at 89abbf9 (this head without its last commit), modules swapped live on the r8 test kernel, 3 runs: Wi-Fi scan, link, per-chain signal, survey, 5/5 scans, upload 79–194 Mbit/s, gateway latency idle and under load, reconnects; Bluetooth settings, scan, AirPods paired and connected with A2DP playback; firmware restart in 16–17 s; 0 N1 driver errors, 0 failed units. abda032 (voice links) itself: not yet.
Risk: two-way door · Macs with an N1 on the T8142/T8152 transport (M5 Airs and MacBook Pros, J804). The T6050 transport is unchanged.
Not yet: the headset voice link (HFP mic) at this head; download throughput (the test server refused the requests); a T8152 Mac;
btcentauri_t6050.cprobably needs the same voice-link quirk (untested there, unchanged). Before the split, the statistics parsers move from byte offsets to named fields,btcentauri.diagnostic_capture(a bring-up parameter) and the PHY dump debug commit 89abbf9 go.Details
Carried, unchanged (merge commits of their PR heads):
New:
set_bdaddrthrough vendor command 0xfc06;HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONNmakes the core send Setup Synchronous Connection instead.rom_boot4 too, as after the fault path's restart.Classic (BR/EDR) connections need
btcentauri.native_hrb, on by default in this branch. With the standard Create Connection the firmware answers Command Disallowed (0x0c) every time, so no classic device pairs (bluetoothd:Busy→AuthenticationRejected). The r8 test tree has the parameter off by default, and the first runs here inherited that. With it on, the AirPods paired and connected; LE devices were never affected.Split planned after testing: Bluetooth audio (SCO/ISO, wideband, address, voice-link quirk), Wi-Fi statistics, band capabilities and disconnect reasons, data path (with a same-Mac throughput A/B).
Evidence
Build: W=1 clean (LLVM, arm64) with the KUnit parser tests at 89abbf9; abda032 adds one quirk line and has not been built yet.
J815, modules built from 89abbf9, r8 test kernel
7.3.0-aurora-j815-dev #8, last of 3 runs:The earlier hardware-row comment listed per-chain signal as missing; that was the test reading the wrong field.
iwprints it in brackets on the signal line, and it was there in every run.