Skip to content

wifi: drop board checks the DMA aperture and DT node already decide - #2477

Merged
RyanTheTide merged 2 commits into
integration/aurorafrom
sweep/redundant-gates-wifi
Nov 23, 2026
Merged

RyanTheTide merged 2 commits into
integration/aurorafrom
sweep/redundant-gates-wifi

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

brcmfmac set a 42-bit DMA mask for any BCM4388 on an apple,t8132 machine (brcmfmac/pcie.c:3112, ca550d3). Right after chip attach, brcmf_pcie_set_dma_mask() already raises the mask to 42 bits for BCM4388 revisions 4 and 6, but only when the attached IOMMU aperture starts above 4 GiB. The machine check repeated that decision for one SoC. mt7932 checked apple,j700/apple,t8140 next to the radio's own DT node (pci14c3,7932) and its apple,t8140-pcie host.

Change

  • The T8132 block in brcmfmac is removed. The aperture-derived mask now covers every Apple BCM4388. Nothing between the two points allocates DMA memory.
  • The mt7932 board check is dropped. The DT node and host compatible decide.

Testing

Built with the lane release config (arm64, LLVM=1): W=1 on brcmfmac/pcie.o and mt7932.o, no new warnings.

  • Hardware (one-shot test kernel 7.3.0-aurora-swl1 or -swl2 = integration 0abc2f3 + this and the other open sweep PRs, 2026-11-20):

    • T8112 J413 (swl2, kernel-only): boot + 3 s2idle cycles rc=0, 0 kernel errors, 0 DART errors, Wi-Fi up, 0 brcmfmac DMA / NVMe timeout lines, 0 AVC.
  • Hardware (one-shot test kernel 7.3.0-aurora-swl1 or -swl2 = integration 0abc2f3 + this and the other open sweep PRs, 2026-11-20):

    • T6000 J316s (swl2, kernel-only): boot + 3 s2idle cycles rc=0, 0 kernel errors, 0 DART errors, Wi-Fi up, 0 brcmfmac DMA / NVMe timeout lines, 0 AVC.
  • Hardware (one-shot test kernel 7.3.0-aurora-swl1 or -swl2 = integration 0abc2f3 + this and the other open sweep PRs, 2026-11-20):

    • T6040 J616s (BCM4388): Wi-Fi up, 0 brcmfmac DMA-mask lines, 3 s2idle cycles rc=0, 0 kernel errors from brcmfmac.

Still to run

  • J616s (BCM4388, pci14e4,4434): Wi-Fi associates, dmesg | grep -i 'DMA' shows no brcmfmac mask error. The removed block never ran there, so its behaviour is unchanged. Hardware row: pending.
  • Neo (MT7932): Wi-Fi associates. Hardware row: pending.
  • M1 Pro and M2 have a BCM4387, which is unaffected; boot clean. Hardware rows: pending.
Credit and reach

Eryk Wieliczko and Chris Kearney wrote the aperture helper and the T8132 mask; Chris Kearney wrote the mt7932 admission. Reach: BCM4388 on T6020/T6030/T6040/T8122/T8132 boards. On T8132 the helper sets the same 42-bit mask (J713 has a BCM4388 C2, revision 6). On the others, the removed block never ran, so nothing changes.

Assisted-by: LLM (Claude:Opus 5.5)

brcmf_pcie_probe() set a 42-bit DMA mask for any BCM4388 on an
apple,t8132 machine, before the chip was attached. Right after the chip
attach, brcmf_pcie_set_dma_mask() already raises the streaming and
coherent masks to 42 bits for BCM4388 revisions 4 and 6 whenever the
attached IOMMU domain's aperture starts above 4 GiB and ends within 42
bits, which is the T8132 case (the radio's aperture starts above 1 TiB).
Nothing between the two allocates DMA memory.

So the machine check repeated, for one SoC, a decision the aperture
already makes for every Apple BCM4388. Remove it. Other Apple machines
with a BCM4388 (T6020/T6030/T6040/T8122 boards) keep their behaviour:
their apertures start below 4 GiB, and the helper leaves the mask alone.

Fixes: ca550d3 ("wifi: brcmfmac: use the T8132 radio DMA aperture")
Suggested-by: Eryk Wieliczko <[email protected]>
Signed-off-by: Ryan Murray <[email protected]>
mt_probe() required the machine to be apple,j700 and apple,t8140, and
also required the function's DT node to be pci14c3,7932 behind an
apple,t8140-pcie host bridge. The DT node and host checks already decide
where the radio is; the board check only blocks another board with the
same radio and host. Drop it.

Today only the J700 device tree has a pci14c3,7932 node, so nothing
changes on any machine.

Suggested-by: Chris Kearney <[email protected]>
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide marked this pull request as ready for review November 20, 2026 02:21
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

J700 (MacBook Neo, MT7932) row: one combined test kernel (integration b4cd7b3 + this PR + #2474 + #2370 + #2299, release config), one-shot boot, compared against the same rows on the production kernel.

  • Wi-Fi associates (mt7932-fullmac), the gateway answers, and there are 0 DMA-mask / board-check lines. All of this holds before and after a 30 s s2idle, exactly as on the base.
  • 0 kernel errors and 0 AVC before the sleep. After it there is 1 error, the known dwc3 genpd_prepare returns -11, which the base logs too.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

The J413, J316s and J700 rows are clean. Still needed: one J713 Wi-Fi row on this head (associates, traffic, back after s2idle, no DMA-mask errors), since T8132 is the only machine where the removed check ran.

@niteria

niteria commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

J713 (MacBook Air 13", M4, T8132, BCM4388 rev 6 14e4:4434) Wi-Fi row on PR head 521a6bf80912 (zero extra patches on top; built with nixos-neo's J713 config, CONFIG_BRCMFMAC=m, no extra Wi-Fi/DMA command-line or module parameters, one-shot boot + Stage 2 trial with 521a6bf80912's t8132-j713.dtb), with an A/B against PR base 0abc2f385e54 (0abc2f385e54's brcmfmac.ko on the identical 521a6bf80912 image, since 0abc2f38..521a6bf8 only modifies brcmfmac/pcie.c and mt7932/mt7932.c).

  • Firmware / loader: macOS OS firmware 26.6.2, system firmware 27.2, Aura 1.0.0b13 (Stage 1 + Stage 2), U-Boot 2026.07, BCM4388/6 firmware 23.50.20.2.41.51.209 (FWID 01-fa2c3dc1).
  • DMA mask & probe:
    • dma_mask_bits=42, consistent_dma_mask_bits=42 on 0000:01:00.0 (both head and base).
    • Head drops the removed T8132-only brcmfmac 0000:01:00.0: using 42-bit DMA addresses line; brcmf_pcie_set_dma_mask() sets the 42-bit mask from the IOMMU aperture and dma-iommu logs brcmfmac 0000:01:00.0: Using 41-bit DMA addresses.
    • 0 DMA-mask errors and 0 brcmfmac errors/warnings across cold boot, 20 s s2idle, and 20 s deep sleep (both head and base).
  • Regression check: 0 AVC (NixOS without SELinux), 0 failed units at boot (0 unexpected failed units across sleep cycles; air-boot-bless.service failed on the one-shot test entry by design), and 0 new kernel errors — all unrelated kernel errors were identical on head and base (hid-generic at boot, USB Ethernet asix on suspend, and apple-sleep / apple-dcp on deep sleep).

Results (all traffic explicitly bound to wlp1s0f0, verified via interface byte counters and SHA-256)

Run Kernel / brcmfmac State Assoc (5500 MHz) Ping gw / 1.1.1.1 (5 pkts) 128 MiB DL (SHA-256) 32 MiB UL (SHA-256) DMA-mask / brcmfmac errors
PR head 521a6bf80912 (stock in-tree) Cold boot Yes (-57 dBm) 0% loss (4.29 / 4.70 ms) 23.16 MB/s (185.3 Mbps, exact) 6.91 MB/s (55.3 Mbps, exact) 0
PR head 521a6bf80912 (stock in-tree) After 20 s s2idle (rtc1) Yes (-56 dBm) 0% loss (6.59 / 6.10 ms) 25.98 MB/s (207.8 Mbps, exact) 10.97 MB/s (87.8 Mbps, exact) 0
PR head 521a6bf80912 (stock in-tree) After 20 s deep (rtc1, resumes 0 -> 1) Yes (-57 dBm) 0% loss (5.53 / 5.98 ms) 31.80 MB/s (254.4 Mbps, exact) 12.08 MB/s (96.7 Mbps, exact) 0
Base A/B 0abc2f385e54 brcmfmac.ko Cold boot Yes (-60 dBm) 0% loss (5.81 / 7.12 ms) 34.15 MB/s (273.2 Mbps, exact) 7.50 MB/s (60.0 Mbps, exact) 0
Base A/B 0abc2f385e54 brcmfmac.ko After 20 s s2idle (rtc1) Yes (-58 dBm) 0% loss (4.87 / 4.52 ms) 38.04 MB/s (304.3 Mbps, exact) 12.91 MB/s (103.3 Mbps, exact) 0
Base A/B 0abc2f385e54 brcmfmac.ko After 20 s deep (rtc1, resumes 0 -> 1) Yes (-58 dBm) 0% loss (9.61 / 4.58 ms) 36.31 MB/s (290.5 Mbps, exact) 12.90 MB/s (103.2 Mbps, exact) 0
dmesg Wi-Fi probe excerpt (521a6bf80912 vs 0abc2f385e54 base)

PR head (521a6bf80912):

pci 0000:01:00.0: [14e4:4434] type 00 class 0x028000 PCIe Endpoint
pci 0000:01:00.0: Adding to iommu group 16
pci 0000:01:00.0: BAR 2 [mem 0xb80000000-0xb80ffffff 64bit]: assigned
pci 0000:01:00.0: BAR 0 [mem 0xb82000000-0xb8200ffff 64bit]: assigned
brcmfmac 0000:01:00.0: enabling device (0000 -> 0002)
brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4388c2-pcie for chip BCM4388/6
hci_bcm4377 0000:01:00.1: Using 41-bit DMA addresses
brcmfmac 0000:01:00.0: Using 41-bit DMA addresses
brcmfmac 0000:01:00.0: using bidirectional receive DMA
brcmfmac: brcmf_c_process_txcap_blob: TxCap blob found, loading
brcmfmac: brcmf_c_process_cal_blob: Calibration blob provided by platform, loading
brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4388/6 wl0: Jul 10 2026 02:04:56 version 23.50.20.2.41.51.209 FWID 01-fa2c3dc1
brcmfmac 0000:01:00.0 wlp1s0f0: renamed from wlan0

On the 0abc2f385e54 base A/B, the probe log is identical except for the single removed line immediately before enabling device:

brcmfmac 0000:01:00.0: using 42-bit DMA addresses

Assisted-by: LLM (Google:Gemini 4 Neon)

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The source ordering is sound for the BCM4388 revisions the aperture helper covers. Probe attaches and identifies the chip before deriving its DMA mask. The early path performs PCI/register setup; DMA ring allocation occurs later. The MediaTek path still requires the device's firmware node and the matching host controller.

The decisive Broadcom comparison is J713 or J715 with a revision-6 BCM4388 and its forced high aperture, where the removed block actually ran. Please record association and the derived streaming/coherent mask on a patched boot there. The J413 and M1 Pro s2idle rows cover the retained legacy path. A Neo association row should cover the MediaTek admission change. The proposed J616s row is a useful control for the revision helper.

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

Formal §1–§6 pre-PR checklist review at 521a6bf80912e97287a4d60bc806bce7cb0285bf:

  • §1 No model gating: Pass. Actively removes two redundant machine/SoC gates (of_machine_is_compatible("apple,t8132") in brcmfmac/pcie.c and apple,j700/apple,t8140 in mt7932.c) in favor of IOMMU aperture geometry (brcmf_pcie_set_dma_mask()) and hardware DT node + host controller compatibles (pci14c3,7932 behind apple,t8140-pcie). Both checks are still present on integration/aurora (not superseded).
  • §2 Production-ready, no hacks: Pass. Verified in brcmf_pcie_probe() that no DMA allocations occur between probe entry and brcmf_pcie_set_dma_mask() (only kzalloc_obj and brcmf_chip_attach() PCI BAR/register setup). <linux/of.h> remains in use in pcie.c (of_property_*). Default command line, no hacks.
  • §3 Safety: Pass. DMA mask is derived from the device's attached IOMMU domain aperture (force_aperture, > 32-bit, <= 42-bit), and mt_probe() retains supplier/PIODMA, translated DMA domain, BAR size, and DT MAC checks.
  • §4 Clean-room and attribution: Pass. Both commits (34ffc9fdc3d9, 521a6bf80912) have human author/committer (Ryan Murray <[email protected]>) and human Signed-off-by: / Suggested-by: trailers only, with zero AI trailers in commits; PR body includes Assisted-by:.
  • §5 Evidence: Pass. All affected hardware families have passing rows:
    • T8132 J713 (BCM4388 rev 6 — the removed brcmfmac gate path): standalone run on PR head 521a6bf80912 + A/B vs base 0abc2f385e54 across cold boot, 20 s s2idle, and 20 s deep sleep with dma_mask_bits=42/consistent_dma_mask_bits=42, 128 MiB DL and 32 MiB UL SHA-256 verified, 0 DMA-mask/brcmfmac errors, 0 failed units, 0 new kernel errors.
    • T8140 J700 (MT7932 — the removed mt7932 gate path): boot + association + 30 s s2idle, 0 DMA-mask/board-check lines, 0 AVC, 0 new kernel errors.
    • Controls: T6040 J616s (BCM4388), T8112 J413, and T6000 J316s (BCM4387) clean across boot and 3 s2idle cycles.
    • Live CI: host-tests green on 521a6bf80912 (mt7932-kunit workflow was added after this head was pushed).
  • §6 Naming: Pass.

Note (non-blocking): the Still to run list in the PR description is stale now that the J713, J700, J616s, J413, and J316s rows have been completed. Ready to merge.

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide
RyanTheTide merged commit 9d89a6b into integration/aurora Nov 23, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the sweep/redundant-gates-wifi branch November 27, 2026 13:21
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.

3 participants