Repository navigation
wifi: apple: centauri: stop each function's DMA before freeing its buffers - #3207
Conversation
…ffers A restart, and removal, clear Bus Master on the N1's functions and free every buffer the firmware can write right after. Clearing Bus Master only stops new requests: writes a function issued before it can still be on their way. Before any buffer is freed, read each function's command register back after clearing Bus Master, which returns after the function's earlier posted writes, and wait for its pending transactions; the same for the boot DMA. If a function cannot be stopped, keep all the buffers. A restart is then not attempted, and the worker tries again in 10 s within its usual limit; removal leaves them allocated. The T6050 driver already does this in centauri_t6050_stop_dma(). Fixes: efa93c2 ("wifi: apple: add hardware-qualified N1 driver and J813 workbench") Fixes: 47706b5 ("wifi: apple: centauri: restart a stopped N1 firmware without a reboot") Signed-off-by: Dj <[email protected]>
… both stopped The previous change freed the IPC buffers as soon as the IPC functions had stopped, before the boot DMA's stop was checked. Split stopping the IPC from freeing it, so a failed stop of either keeps every buffer. Signed-off-by: Dj <[email protected]>
|
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. |
|
Verdict at Blockers: none Checked
Not a blocker: if the link has really dropped, the config read returns all-ones, so the stop counts as failed and the restart never runs. Without a link, the function can't write either. Today that leaves Wi-Fi down until a reboot, where before the port cycle might have brought it back. If that shows up in the row, the root port's link state (no Data Link Layer Link Active) could count as stopped. Evidence
|
|
J813 (Apple MacBook Air 13-inch, M5 / T8142) row at exact head
|
|
Non-author review at
|
|
J873g (Apple Mac mini, M6 / T8152) peer row at exact head
|
There was a problem hiding this comment.
Verdict: MERGE at d14a25a3 (once cancelled CI checks are rerun green)
Blockers: none (code and two-generation exact-head hardware rows are ready; rerun the 3 cancelled CI checks before merge).
Checked:
drivers/net/wireless/apple/centauri/centauri_ipc.c:28-66: verifiedcentauri_stop_dma()clears Bus Master, readsPCI_COMMANDback and fails if read fails orPCI_COMMAND_MASTERremains set (covering dead links reading0xffff), and callspci_wait_for_pending_transaction(pdev).drivers/net/wireless/apple/centauri/centauri_pci.c:99-140: verifiedcentauri_free_boot()calls bothcentauri_stop_ipc(c)andcentauri_stop_dma(c->pdev)(withcentauri_stop_dma(c->pdev)first in||so it is never short-circuited), retains all IPC and boot DMA buffers on any stop failure, andcentauri_recover()returns-EBUSYwithout resetting when!centauri_free_boot(c).- Verified exact-head (
d14a25a36d6c) hardware rows on both J813 (M5/T8142, including forced N1 recovery) and J873g (M6/T8152, iperf3 TX/RX PASS).
Evidence
- Diff reviewed at
d14a25a3(all 3 files, 143 lines). - CI at review time: 2 passed, 0 failed, 3 cancelled.
|
Merge-train status at |
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
What: The N1 restart and removal paths freed every buffer the firmware can write right after clearing Bus Master, while the function's earlier writes could still be on their way. Now each function's command register is read back and its pending transactions waited for first, the same way the T6050 driver does it. If a function can't be stopped, all buffers are kept and the restart is retried later.
Tested: The changed objects build with W=1 on an arm64 16K-page config at
d14a25a36d6c. No hardware row yet.Risk: two-way · Macs whose N1 radio runs on the native driver: J813, J815, J873.
Not yet: A row on a J813, J815 or J873: a forced restart, Wi-Fi traffic, then a sleep. The J714s uses the T6050 driver, which never reaches this code.
Details
centauri_stop_dma()clears Bus Master, readsPCI_COMMANDback, checks that Bus Master really is clear, and callspci_wait_for_pending_transaction(). The read returns only after the function's earlier posted writes.centauri_stop_ipc()frees the IPC interrupts, unregisters Wi-Fi, disables MSI and clears Bus Master on all three functions, then stops each one.centauri_free_boot()then disables the boot MSI and stops function 0's boot DMA. Only if both stops succeeded does it free anything: the IPC buffers (centauri_free_ipc()), the firmware image, the boot descriptor and the MSI page. Otherwise it returns false and keeps all of them.centauri_recover()doesn't run the port cycle and warm reset while buffers are still held. It returns-EBUSY, and the worker's existing retry (10 s, at most three restarts in 30 minutes) tries again. A later call starts by stopping the DMA again.centauri_t6050_stop_dma()andcentauri_t6050_ipc_fenced().echo 5 > /sys/kernel/debug/apple_centauri/<pci>/rom_boot(the debugfs stall injection already in the driver).Evidence
./linux-build/build kernel linux-pciewifi-fixes -- -j3 W=1 drivers/net/wireless/apple/centauri/centauri_pci.o drivers/net/wireless/apple/centauri/centauri_ipc.owithCONFIG_ARM64_16K_PAGES=y,CONFIG_APPLE_CENTAURI=m: no warnings.scripts/checkpatch.pl --strict: clean.40e5e29cc915.