Skip to content
This repository was archived by the owner on Oct 18, 2026. It is now read-only.

Enable Neo radios in the shared Aurora kernel with runtime guards - #11

Merged
chriskearney merged 49 commits into
custom/sepfrom
fix/neo-shared-kernel
Oct 3, 2026
Merged

chriskearney merged 49 commits into
custom/sepfrom
fix/neo-shared-kernel

Conversation

@chriskearney

@chriskearney chriskearney commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

The regular Aurora build can include the MacBook Neo bootstrap, Wi-Fi and opt-in Bluetooth with PCIE_APPLE=y, suspend/kexec enabled and BT=m/RFKILL=m. The series remains based on custom/sep 2db5b50, preserving PCIe-C cold initialization, DART ranges, tunnel readiness and IGB. Round 2 adds 11 focused commits above 11160b8, one per review item; each describes why non-Neo behavior is unchanged.

Neo sleep is not supported yet. Default retained radio admission refuses suspend regardless of firmware availability. Lid close and systemctl suspend do not put it to sleep; shut down before bagging it. pcie_apple_piodma_diag.enumerate=0 disables both radios and removes this refusal. Sleep/wake without radios remains unproven.

Wi-Fi scope: station mode, open or WPA2-PSK/CCMP; 2.4 GHz channels 1–13 and 5 GHz 36/40/44/48 subject to regulatory rules, with 20/40/80 MHz layouts in-range. Higher channels, 6 GHz, WPA3/SAE, 802.1X, required MFP, AP/P2P and roaming are outside current support. Bluetooth stays disabled by default.

  • Exact J700/T8140 machine and reciprocal supplier/host DT matching precede admission. Acquire PM/kexec guards before PCI children, veto device prepare during the guarded window, and release prepublication guards only after removing children. Post-child errors never defer. Supplier-owned delayed attachment handles prolonged pre-child contention without another driver-bind event; consumed attempts and shutdown are checked before host setup. Only renewed contention rearms it; no hardware replay or global retry changes.
  • Pin Wi-Fi before its first DMA pointer, so normal unload reports module in use before entering removal, including with bound Bluetooth. Failed reset/shutdown retain ownership; checked probe cleanup alone may retire it. Never unload or reprobe Wi-Fi while Bluetooth is active. Forced removal remains unsupported.
  • Rate-limit missing-policy retries; distinguish malformed local packages from firmware command failures and unsupported capability/per-unit profiles. Installing a missing same-country policy followed by interface up/scan/connect retries without reboot. Malformed policies require replacement and restart; partial submission and terminal calibration remain latched.
  • Clear Neo native AER/DPC ownership and withhold forced-native core/service recovery. Clear unused hotplug notifications. Sysfs removal/reset refusals return EOPNOTSUPP; reset_sensitive names the full recovery/assignment restriction. These guards protect against accidents; raw privileged PCI resets, root-port unbind and link-power overrides remain unsupported.
  • Keep ASPM/L1 substates/Clock PM restricted only on the radio link, including at probe. Global ASPM default remains unchanged. Keep BT enable=0, modular transport and IRQ/MSI retirement. Firmware metadata and selected policy packaging are explicit initramfs prerequisites; collector/packager remains Per-Mac firmware and data in a stock Omarchy install: Touch ID, Neural Engine and the rest #5.
  • Tests exercise the actual queued 5 GHz startup path and check frontend retry before any duplicate helper call. The manual network helper records open/WPA2, restores profile band in finally, and rejects warning/sanitizer/hung-task/refused-FLR evidence. Crash checks remain untraced; KUnit skips finite kexec-load budgets.

Validation of source 5b21e2a:

  • Six ARM64 configurations pass affected-source W=1 KCFLAGS=-Werror; provider-disabled host stubs also pass. Five Kconfig linkage cases pass. Exact production retains host/supplier y, Wi-Fi/BT/core/rfkill m, sleep/kexec y, ASPM default and CRYPTO_CMAC=m with CRYPTO_AES=y.
  • QEMU KUnit: 19 passed, no skips (13 PCI/kexec, 6 driver RF). Python helper: 16 passed. Test objects pass strict builds.
  • Fresh full ARM64 production W=1 Image modules dtbs and final integration/relink pass, including Rust and 1,863 modules. Existing compiler/DTC warnings match the prior archived build; affected sources introduce none. This is not a global -Werror claim.
  • All 113 Apple DTBs are byte-identical to 2db5b50. ARM64/x86 host-bridge sizes and field offsets match base. Off-Neo host flags remain clear, blockers zero and retry unqueued; original sleep/kexec/hotplug/VFIO/Thunderbolt decisions are preserved.

Reported physical M1 Air, M1 13-inch and M1 Pro/dock/suspend/TouchID checks were performed at 11160b8. This round preserves their runtime paths; it has not been booted on every Mac. No hardware tests, merges or releases were performed by this pane.

Needs a Neo boot: default/contended admission, error/slot-control and per-link readback, actual WCAL/OCA2 acceptance, supported-band/open/WPA2 association/DHCP/DNS/HTTPS, missing-policy install/retry, gated BT setup/discovery/coexistence, module-in-use refusal, PM/kexec/PCI vetoes and shutdown with active traffic. The earlier one-off reached NORMAL_STATE/PPR/precal and stopped at missing US policy before WCAL/OCA2; it did not build Bluetooth. Installing files alone does not establish physical qualification.

Bluetooth admission after own-unit inputs: options mt7932_bt_pcie enable=1 for an intentional cold boot, or write 1 to /sys/module/mt7932_bt_pcie/parameters/enable followed by the actual BT BDF to /sys/bus/pci/drivers_probe. Individual bind attributes remain suppressed. Do not reprobe uncertain retained faults. Queue backpressure, SCO/ISO/LE Audio and long-duration reliability remain limitations.

Contracts: Neo radios, T8140 bootstrap. Related: aurora-silicon/linux#151, omacom#153.

Add counted blockers serialized with the kexec lock. Refuse both load APIs and normal or crash execution while a device owns memory that cannot be quiesced; keep image unloading available. Cover balanced/nested ownership, lock contention and safe execution refusal with KUnit.
Allow the built-in bootstrap alongside a modular host and enabled sleep/kexec. Enable only on J700/T8140, install lifetime guards before retaining the arena, and defer probe on transition contention. Restrict link power states to the validated radio link before binding and preserve retained host ownership.
Make the transport tristate, require the retained supplier interlock before DMA publication, and pin activated ownership. Retire software callbacks on unsupported removal without claiming DMA quiescence. Enable the shared radio configuration and document the runtime contracts.
A /dev/snapshot file can send its prepare notifier before the radio supplier probes, then enter device PM through subsequent ioctls without repeating that notification. Add a device prepare veto alongside the notifier so retained DMA remains protected across those transitions.
Failed host validation leaves scanned children that generic PCI rescans can later publish. Publish a separate completed-admission state only after all host checks succeed, and require it before either radio touches hardware and in the host enable callback. Reapply the endpoint link-power restriction on every radio probe so recreated ASPM state cannot inherit an incompatible global policy.
A retained pci_dev reference does not prevent device_del from releasing IOMMU associations during PCI sysfs removal. Let a host permanently prohibit userspace removal before registering its hierarchy, and enable that restriction only for the Neo host with a retained supplier. Read the immutable property through existing bus and bridge references, preserving self-removal and rescan locking order on ordinary hosts. Exercise the actual removal callback with five synthetic-hierarchy KUnit tests; forced platform and IOMMU teardown remain unqualified.
Clearing running alone does not close TX, command or regulatory admission. Reuse the existing host-user join path before disabling bus mastering so no admitted worker republishes DMA or unmasks IRQs after shutdown returns. Retain all device-visible allocations without claiming hardware quiescence.
D7 failures and malformed calibration events now fail pending associations and disconnect an established host link under the same lock that guards success publication. Retain uncertain peer and DMA ownership until checked reset, and prevent late startup from reopening RF admission.

Name local firmware and policy inputs on load/validation errors, expose fixed Wi-Fi firmware metadata, and document actual Bluetooth variants, modular CMAC providers and post-startup calibration dependencies.
Reject terminal errors before data/BSS startup and again before interface readiness publication. Keep pre-policy interface-up behavior while refusing a failed epoch. Publish regulatory completion under the same response lock as RF failure and recheck scan abortion before transferring the request to cfg80211.
Query the Wi-Fi connection's IPv4 DNS servers over a device-bound UDP socket, reject malformed or mismatched answers, and use the verified A address for direct interface-bound HTTPS. Keep KDE qualification as the default while allowing an explicit network-only test, and stop qualification on RF_FAILED. Add local parser and real loopback socket regression tests.
@chriskearney
chriskearney force-pushed the fix/neo-shared-kernel branch from df75e67 to 21c471b Compare October 3, 2026 08:33
@chriskearney

Copy link
Copy Markdown
Owner Author

Rebased fix/neo-shared-kernel onto custom/sep 2db5b50997e0.

Conflict: arch/arm64/configs/asahi.config placed the upstream Intel/IGB additions at the Neo Wi-Fi insertion point. Kept CONFIG_NET_VENDOR_INTEL=y, CONFIG_IGB=m, and CONFIG_MT7932_FULLMAC=m. There were no other conflicts. pcie-apple.c rebased cleanly; reviewed the combined source to preserve the PCIe-C cold-init/tunnel-wait paths and the J700-only radio admission/ASPM paths.

Also addressed calibration failure/reporting races and missing-input diagnostics found during review, added actual-driver RF regression tests, and corrected the manual network validation helper.

Validation: exact requested production flags including PCIE_APPLE=y, PM_SLEEP=y, KEXEC_FILE=y, KEXEC=n, BT/RFKILL=m, CRYPTO_CMAC=m, and both radio modules=m; clean arm64 Image/modules/DTBs build passed. Five affected-C W=1/-Werror variants passed; QEMU KUnit passed 9 lifecycle/removal tests plus 3 ARM64 radio tests; 11 local network-helper tests passed. All 113 Apple DTBs are byte-identical to the new base. Whole-tree W=1 retains warnings from unchanged code; changed files are warning-free. Neo boot/calibration/association and non-Neo hardware regression testing remain required. No merge or release.

Clearing bus mastering and disabling the interrupt is insufficient when PCI devres releases MSI device data at unbind. Free the synchronized threaded IRQ before releasing its vectors, after HCI and queued TX callbacks have been retired. Keep the device-visible arena and its owners retained because hardware DMA quiescence remains unqualified.
The admission API is specific to the Apple SoC bootstrap provider rather than generic PCI. Move its public declaration under soc/apple and update all in-tree clients without changing runtime behavior.
A queued 5 GHz D7 request has three logical completions, while startup draining previously waited for four and latched a terminal timeout. Use the runtime band-dependent contract in both paths before waiting for replies.
The driver cannot probe without the retained J700 supplier. Express that dependency and ARCH_APPLE in Kconfig, and depend on cfg80211 instead of selecting it across its own dependency constraints. This also prevents a built-in radio driver calling modular cfg80211.
Fixed metadata already names all seven fixed Wi-Fi inputs. Add a country-policy glob so compatible initramfs builders (including mkinitcpio) retain installed policy packages for later regulatory hints. It cannot create absent per-unit packages; builders without glob support must explicitly include the requested country policies.
An unpublished coherent arena does not expose pointers to hardware. Leave sleep and kexec available while the supplier waits for its host, and acquire the existing nonblocking lifecycle interlocks in prime before consuming its hardware attempt. Release both guards on pre-publication failures; retain them once initialization makes ownership irreversible. Propagate host deferral and drop its provisional module hold before publication.
A policy lookup that fails before any SET leaves RF blocked but recoverable. Record only a completed ENOENT attempt, then let interface up, scan, or connect consume that state and reschedule the current country. In-flight attempts and terminal calibration or partial policy failures remain excluded; normal admission can return EAGAIN while the new lookup runs.
PCI function-scoped FLR does not establish that the radio functions share no firmware or fabric state. Hold the Bluetooth sibling device lock across Wi-Fi reset and reject bound, bus-mastering, or concurrently probed peers. A refusal follows the existing failure path retaining Wi-Fi DMA ownership rather than inventing a cross-function quiescence guarantee.
Build the KUnit fixture separately and exercise the same host-policy lookup used by sysfs. Allocate the flexible-array host bridge independently, verify root/descendant and independent-host decisions, and avoid logging or kernfs callbacks on synthetic devices. Rate-limit repeated userspace-removal refusals.
A transient kexec load or sleep transition need not produce another deferred-probe trigger. Retry both nonblocking admissions for up to 50 attempts separated by 20ms, releasing every acquired transition lock before sleeping. This remains bounded under the host device lock and never consumes the hardware attempt on contention.
Permit unprivileged reading of the boot-time enumerate setting for diagnostics. Keep it immutable at runtime: changing admission after a retained bootstrap cannot undo hardware publication or release ownership.
Keep the conservative crash-image veto, including for preloaded images, but emit an emergency diagnostic rather than silently skipping the dump. The existing NMI-safe kexec lock remains the only admission synchronization.
The qualified RXV decoder supports bounded HT/VHT/HE widths, but a stale 20 MHz guard suppressed all wider RX rates. Bound telemetry by the negotiated chandef and the existing 2 GHz 20 MHz ceiling instead. Reject 5 GHz CCK and widths beyond the current association without changing RF admission.
Exercise the real calibration completion machine with the shared startup/runtime reply-count helper. Assert that three 5 GHz replies finish the procedure while 2 GHz requires four; the prior startup count would instead remain active and time out.
Carry the requested section tag through every startup, association, and D7 planner. Missing sections now identify the exact oca2.bin tag and phase; malformed sections and container/profile failures have separate diagnostics. No calibration payload or unit identity is logged, and planners still validate all dependencies before transmitting fragments.
Make the accepted release boundaries explicit: Neo sleep and wake are unproven, retained radio admission refuses suspend regardless of installed firmware, Wi-Fi exposes only the current channel and authentication scope, and Bluetooth remains opt-in. Separate checked probe-reset recovery, retryable missing policy and latched startup faults. Record exact Bluetooth probing/address order, mandatory country packages, privileged link-power overrides and retained PCI reset restrictions.
Place interface-up recovery in the actual ndo_open entry point, not scan completion. Exercise open, scan and connect with the real retry helper and a hardware-free work callback; repeated admission requests consume one retry, RF stays blocked, and partial policy or terminal calibration errors do not replay.
The source accepts qualified open networks as well as WPA2-PSK with CCMP. Describe both in the configuration help without claiming wider security or RF support.
Use a builtin-only guard handle with an immutable boot-lifetime reason and balanced per-guard acquisitions. Drop unused module exports, retain lock-free releases and the existing atomic execution lock, and report the first interlock reason in each nonzero interval without a lifetime-sensitive registry. Permanent kexec and Neo sleep refusals return EOPNOTSUPP; transient admission contention remains EBUSY.
User function and subordinate-bus resets can invalidate retained bootstrap/radio ownership. Add an immutable per-host reset policy checked before reset or runtime-PM work, keeping driver-owned checked resets available. Disable native PCIe/SHPC hotplug only on the matched Neo host, and withhold their service/probe even when native port handling is forced. Other hosts retain their default policy. Extend standalone hierarchy-policy tests and rate-limit reset refusals.
The runtime country filename is dynamic. Its MODULE_FIRMWARE pattern helps image builders discover installed inputs but does not guarantee they include every match. Keep deployment explicit about the selected mandatory country package so an early load does not rely on root filesystem availability.
Exercise the actual legacy and file loader implementations with deliberately invalid inputs while a retained-memory guard is active, and unload only empty image slots. Share the crash selector with tests without installing fake global images or executing a transition. Keep these tests builtin-only and rate limit repeated sleep and normal-kexec refusal diagnostics; crash diagnostics remain emergency messages.
A closed Neo Bluetooth function can otherwise be assigned to vfio-pci, whose open and hot-reset paths bypass the PCI sysfs reset veto. Honor the immutable host reset restriction before VFIO registration, reset-method probing or power management. Other hosts leave the flag clear and retain the existing assignment path.
Invalid descriptors fail safely only when the test task has a file table. Skip the file-loader case in an unusual kernel-thread context without one, so a regressed guard cannot enter fd lookup with a null files_struct.
Native error-recovery services can reset the radio link independently of the protected sysfs reset attributes. Suppress AER and DPC service creation when the host forbids user reset, including native and dpc-native overrides. The matched Neo host sets this immutable policy before enumeration; other hosts keep their existing services.
VFIO and native AER/DPC recovery can reach reset operations outside the sysfs controls. Document the additional Neo-only admission exclusions and require external reset on a hardware fault instead of suggesting an unqualified bus or link reset.
Record open versus WPA2 from the saved profile instead of declaring every successful connection WPA2. Restore its original band in finally even when selection or activation times out, and reject warning, sanitizer, hung-task and refused-reset diagnostics. Add local tests for restoration failures and both authentication modes.

Round-2 S2. This manual helper checks both apple,j700 and apple,t8140 before NetworkManager mutations. No production kernel path changes; all non-Neo behavior remains unchanged.

Round-2 S2. Non-Neo runtime behavior remains unchanged.
A live, pinned Bluetooth sibling makes Wi-Fi FLR inadmissible. Refuse normal Wi-Fi unload before it can enter a removal wait holding the function lock and obstruct reboot. Acquire the module hold before the first ring-address write, retain it for live or failed-reset epochs, and release it only after checked FLR while probe/remove framework ownership still protects the callback. The existing exact Neo supplier/host gate remains ahead of this path; off-Neo probing and unload behavior are unchanged. Forced module removal is not supported.

Round-2 R2. Non-Neo runtime behavior remains unchanged.
Acquire bounded PM/kexec admission before pci_host_common_init can create
children. Publish guarded state for device prepare; remove every child
before releasing temporary vetoes on pre-retained failure. Prime performs
no late dependency admission and post-child errors cannot defer probing.

A supplier-owned delayed attachment retries pre-child contention even when
no unrelated driver binds. Only renewed contention rearms it. The matched
host reference and supplier stay alive until reset; cancellation never
waits while holding device locks. Recheck consumed attempts and shutdown
before host setup, and keep irreversible ownership guarded until reset.

Round-2 R1. All admission, unwind and retry paths require the exact Neo
supplier and reciprocal host. Non-Neo behavior remains unchanged.
Repeated interface admission or country hints may safely retry a missing policy before submission. Bound the named loader failure, regulatory refusal and accompanying request logs so ordinary userspace retry loops cannot flood the kernel log. request_firmware_direct already suppresses its core warning; the first driver diagnostics remain visible. Retry and admission semantics are unchanged. These are existing Neo-only driver paths; off-Neo behavior is unchanged.

Round-2 R3. Non-Neo runtime behavior remains unchanged.
Retry Wi-Fi's Bluetooth sibling trylock for at most 480 ms without ever
blocking across function locks or retrying hardware resets. Once acquired,
bound or mastering Bluetooth remains an immediate FLR veto. Clear
HPIE/CCIE/DLLSCE before withholding retained-host hotplug service, including
forced-native handling.

Round-2 S3. Radio changes follow exact Neo admission; slot writes require
the Neo-only removal flag. Non-Neo behavior remains unchanged.
…ailures

Do not blame config-original.bin or OCA2 formatting for timeouts in submitted firmware commands. Report explicit file-format, host allocation, command/completion, and capability-profile phases, preserving exact missing-section diagnostics. Unsupported board/calibration capability predicates now identify their observed non-identity metadata before refusing admission. Firmware download phases likewise separate local parser rejection from transport/start failures. All changed calls remain in the existing supplier-gated Neo driver; off-Neo paths are unchanged.

Round-2 R4. Non-Neo runtime behavior remains unchanged.
Exercise the actual startup queue-drain and calibration procedure with synthetic version-12 containers and a test-only transport delivering three logical band-1 completions. A restored hardcoded four-credit startup wait fails the test before touching hardware. Assert open, scan and connect queued missing-policy recovery before invoking the retry helper a second time, so the test cannot mask a missing frontend hook. The production drain is the same bounded serialized path; transport injection is omitted unless RF KUnit is enabled. Existing Neo admission gates remain ahead of runtime entry; off-Neo behavior is unchanged.

Round-2 S1. Non-Neo runtime behavior remains unchanged.
Mark crash-visible interlock accessors notrace and force the selector inline. Skip regression cases when either load-attempt budget is finite, and compare crash selection with the blocker state under the same kexec lock rather than assuming no real guard appeared.

The production interlock remains active only through the Neo supplier; these annotations do not change non-Neo transition admission. Budget checks and revised expectations compile only into the builtin KUnit suite.

Round-2 S5. Non-Neo runtime behavior remains unchanged.
Rename no_user_reset to reset_sensitive because the immutable host flag
also protects assignment and recovery. Return EOPNOTSUPP for permanent
PCI sysfs policy and test that actual errno without unregistered callbacks.
Describe sleep/kexec refusal as an active interlock during admission or
retained ownership, so the temporary window is not mislabeled permanent.

Round-2 S4. Changed refusals require Neo flags or an active Neo interlock;
default-clear hosts keep original policy and transition admission.
Non-Neo behavior remains unchanged.
Describe pre-child lifecycle admission, self-pinned Wi-Fi ownership, permanent PCI refusal errno and malformed-policy recovery. Treat teardown guards as accident protection: privileged raw resets, root-port unbind and ASPM changes remain outside the contract. Use desktop-session wording and explicit Hyprland test options, remove misleading country fallback wording and track the moved public header.

Round-2 S6 and updated R1/R2 contracts. Documentation and MAINTAINERS only: non-Neo runtime behavior is unchanged.

Round-2 S6. Non-Neo runtime behavior remains unchanged.
Clear native_aer and native_dpc before creating Neo PCI children, keeping
core error reporting consistent with withheld recovery services. Reject
forced native AER ownership for this host in pcie_aer_is_native and log
once when native/dpc-native recovery forcing is withheld.

Round-2 R5. Bridge changes require the matched Neo supplier; core/service
refusals require its reset_sensitive flag. Default-clear hosts keep their
existing expression; non-Neo behavior remains unchanged.
@chriskearney
chriskearney merged commit 5b21e2a into custom/sep Oct 3, 2026
chriskearney added a commit that referenced this pull request Oct 3, 2026
linux-aurora 7.1.12.aurora2-11.31, built from fd04a98:
 - PCIe over Thunderbolt on M1 Pro/Max and M2 Pro/Max by default (#10)
   with the T600x DART window and dock readiness fixes;
 - igb and igc for Thunderbolt 3 and 4 dock Ethernet;
 - the MacBook Neo radios in the shared kernel (#11);
 - Neural Engine runtime PM (aurora-silicon/linux#155) and the ANE
   enabled on the M1, M1 Pro and M2 Pro.

The installer checks a MacBook Neo for its own Wi-Fi firmware, calibration
and country files and prints the Neo's sleep, Wi-Fi and Bluetooth limits.
The test plan covers dock PCIe on the Pro/Max chips with exact log lines,
the Neural Engine on the newly enabled chips, and a MacBook Neo step.

libfprint, aurora-touchid and m1n1-aurora are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FwdG63dRaMrRbYrUBkSa1i
Signed-off-by: Chris Kearney <303316+iconidentify@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant