Skip to content

centauri: scan all 38 channels, free function 1's IRQs before its devres does - #1801

Merged
DjDeveloperr merged 2 commits into
aurora-silicon:integration/aurorafrom
m0d16l14n1:j815/centauri-scan
Nov 14, 2026
Merged

DjDeveloperr merged 2 commits into
aurora-silicon:integration/aurorafrom
m0d16l14n1:j815/centauri-scan

Conversation

@m0d16l14n1

Copy link
Copy Markdown
Contributor
  1. Let each scan chunk run to its end. The scan worker stopped every 13-channel chunk as soon as 8 channels had reported, so a scan covered 24 of the 38 channels: 2.4 GHz 9-13, 5 GHz 100-116 and 153-165 were never scanned, and 149 was the last one kept. A 5 GHz BSS on those channels came and went between scans, and the supplicant joined 2.4 GHz after a boot or a wake (J815: the same AP on 2437 and 5745 MHz). Each chunk now waits for the firmware's own scan event. It's stopped only once all its channels have reported without one, after a second with no progress, at its deadline (twice the dwell per channel, at least 8 s) or on an abort. A chunk that ends early, or whose stop the firmware refuses (status 342: already over), keeps its results instead of failing the whole scan. The finish line reports this scan's counts.
  2. Free another function's IRQs before its devres does. Function 0 requests IRQs on function 1's MSI vectors. Unbinding the PCIe host removes function 1 first, its devres freed the vectors under function 0's handlers (remove_proc_entry: removing non-empty directory 'irq/96', leaking at least 'centauri'), and function 0 then freed IRQs that were gone. A devres action on function 1 now frees function 0's handlers first, and is dropped when function 0 frees them itself.

Tested on J815: every boot since the fix: Wi-Fi scan finished: rc=0 channels=38 of 38 (was 24) and joined 5745 MHz, at boot and again after each pm_test sleep step (before: a 5 GHz / 2.4 GHz coin flip). Function 1 still probes, and in four later boots the sleep test unbound the radio host with no WARN (boot 348f4fee, before the fix, had it at the same unbind).

The T6050 driver (centauri/t6050/) is untouched.

Part of the J815 (MacBook Air 15-inch, M5, T8142) bring-up: board results are summarised in discussion #135. Tested on a J815 with a macOS 27.0 stub (firmware 27.0) through aura Stage 2.

Assisted-by: Claude Opus 5.5

The scan worker stopped every 13-channel chunk once 8 channels had
reported, so a scan covered 24 of the 38 channels: 2.4 GHz 9-13, 5 GHz
100-116 and 153-165 were never scanned and channel 149 was the last one
kept. A 5 GHz BSS on those channels came and went between scans (J815,
same AP on 2437 and 5745 MHz), and the supplicant joined 2.4 GHz after
a boot or a wake.

Wait for the firmware's scan event instead. Stop a chunk only once all
of its channels have reported without one, after a second without
progress, at its deadline (twice the dwell per channel, at least 8 s) or
on an abort, and keep what an early-ended chunk found rather than
failing the scan. The finish line reports this scan's channels and
beacons, not the totals since probe.

A stop the firmware refuses (status 342: the chunk had already ended,
seen when a scan met the start of a suspend, rc=-121) ends that chunk
with its results instead of failing the whole scan.

Assisted-by: Claude Opus 5.5
Signed-off-by: Nick <[email protected]>
… does

Function 0 requests the IRQs of function 1's MSI vectors, which belong
to function 1's managed device. Removing the PCIe host removes function
1 first: its devres freed the vectors under function 0's handlers
("remove_proc_entry: removing non-empty directory 'irq/96', leaking at
least 'centauri'", J815 radio host unbind before a deep sleep), and
function 0 then freed IRQs that were gone. Register a devres action on
that function which frees the handlers first, and drop it when function
0 frees them itself.

Assisted-by: Claude Opus 5.5
Signed-off-by: Nick <[email protected]>

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

Reviewed. Both fixes are correct for the problems they target, so I'm approving. The T6050 transport (apple_centauri_t6050, t6050/) is untouched, and apple_centauri still bails out behind apple,t6050-pcie hosts, so this affects the T8142 and T8152 boards only.

Scan: every wait is bounded. Bringing the interface down still aborts the scan quickly. Partial results are kept instead of failing the whole scan.

IRQs: the devres action on function 1 runs before its pcim MSI release. Function 0's normal teardown removes the action first, and the handler counter keeps either path from freeing twice.

Optional follow-ups, none blocking:

  1. centauri_wifi.c ~958: any non-zero return from the stop is treated as "chunk already over", including -ETIMEDOUT/-EIO. Treating only the firmware's refusal (-EREMOTEIO) that way, and propagating other errors, would be more precise. The next chunk's start still catches a dead firmware.
  2. centauri_wifi.c ~907/914: done is sampled before the chunk's start command. A late scan-done (0x05) from the previous chunk, which can now happen because a refused stop or a quiet chunk continues instead of aborting, could end the next chunk on its first pass. Sampling done/channels after command() returns avoids that.
  3. centauri_wifi_unregister() (existing code) sets stopping but not scan_abort before cancel_work_sync(). With the longer per-chunk deadlines, a remove during a scan can now wait for the whole scan.
  4. centauri_ipc.c ~368: on the existing debugfs-only path where centauri_free_boot() skips centauri_free_ipc(), a later function 1 unbind reaches ref->c->ipc after function 0's devm c is gone. Storing the ipc pointer in centauri_vector_ref, and using c only as the cookie, would close that.

A note in the commit that the chunking hasn't been run on the J813 (scan_tlvs = false, so the firmware picks the chunks' channels) would also help.

@DjDeveloperr
DjDeveloperr merged commit 1b12994 into aurora-silicon:integration/aurora Nov 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants