Repository navigation
kboot, pcie, smp: T8103 (G13G) GPU 27.2 handoff and S2R wake PCIe/exception restore - #529
Merged
Merged
Conversation
Recognize the headerless T8103 (G13G) firmware 27.2 (26B131) image in firmware.c and extend the G14G 27.2 handoff in kboot_gpu26.c to cover T8103: - Allow the 3-segment preloaded firmware layout on T8103 where the __DATA segment flags word is 0 (0x10 on G14/G15). - Make ADT perf-states-sram optional on T8103 (which has no perf-states-sram property and derives SRAM voltage from apple,min-sram-microvolt in the device tree). - Mark the GPU power domain both apple,no-auto-pm and apple,sleep-retained when publishing the 27.2 handoff so Linux PMGR does not auto power-gate or suspend-gate ps_gfx under the live ASC. Signed-off-by: Erik Bourget <erik@ebourget.net>
Once the S2R mailbox is published, a core reset brings the cores back through this image on their way back to the OS that slept. That OS owns every interrupt source by then, so exception_initialize() keeps debug, SError, IRQ and FIQ masked instead of unmasking them on the boot core. At EL2 it now writes VBAR_EL2 by name, before any other register access, instead of VBAR_EL1. VBAR_EL1 reached EL2's vector base only through the E2H alias, which a core reset need not have set up yet; VBAR_EL2 is the same register wherever that alias was in place, so nothing changes for a normal boot. smp_s2r_return_to_os() keeps its explicit mask; its comment now says why. Signed-off-by: Erik Bourget <erik@ebourget.net>
… the OS A system sleep takes the PCIe complex's power with the rest of the SoC. Where kboot hands the OS the ADT's APCIe tables (pcie_apcie_tables_fdt(), an ANS with nvme-secure-bar: M4 on), the OS brings the block back itself. Elsewhere, T8103 among them, only aura's boot-time setup describes the complex, and after an S2R wake the M1 MacBook Air (J313) resumed into a complex that was no longer set up. The gate is what the ADT says and what aura actually did, not a chip. The boot core, back from the sleep and on its way to the OS, sets the complex up again only if all of these hold (pcie_needs_sleep_reinit()): - a controller came up at boot through pcie_init_controller(), so a SoC whose PCIe comes up another way (T6050) is never replayed; - kboot did not hand the OS the APCIe tables (it records whether it did, pcie_set_os_restores_apcie()); - the ADT has an ANS without nvme-secure-bar (pcie_sleep_reinit_possible()), so an M4 or later Mac is never replayed, even if its table export failed. The saved J313 ADT has no nvme-secure-bar; the J713, J714s and J716c ADTs have it. pcie_reinit_after_sleep() replays only the controllers that came up at boot, each from the ADT node it came up from (recorded in its slot), and fails if any one of them fails or none came up. pcie_init() tries /arm-io/apcie and /arm-io/apcie0 against the same slot, and the replay does not repeat that. On the replay the APCIe controller's RC word at +4, which boot clears, is read first and written only if the sleep left it set; boot is unchanged. smp_s2r_pcie_reinit(): - turns the console off first: nobody drains it now, and a full FIFO holds the core; - runs under a watchdog, wdt_s2r_guard_enter()/exit(). It reads the watchdogs before any write. If the OS left one of the two it uses armed (the primary with its reset enable, as Linux's T8103 sleep does, or the third, at +0x2c of the primary block, with its enable), that covers the step and nothing is written. Otherwise, on the ADT's version 2 layout with the secondary watchdog off, it borrows the primary for 30 s (Linux's default period), reads it back, and afterwards restores the control, count and alarm it read. The secondary is never written. Without a watchdog either way, the step doesn't run and the Mac reboots; - powers ANS's domains before the PHY comes up, as they already are at boot; - reboots if the complex doesn't come back, rather than resuming the OS into a state it doesn't know. So that a reboot from that step always works, the S2R mailbox is published only where the step is ruled out by the ADT or the watchdog layout it needs is there (wdt_s2r_guard_supported(), which also keeps the primary's base in memory for wdt_reboot()). Otherwise aurora,s2r-unavailable says why. kboot publishes the mailbox before it sets PCIe up, so that check uses the ADT part of the gate. The PCIe sequence host test covers the replay: the same MMIO accesses and polls as boot for the one controller that came up, the RC word read first and cleared only when set, failure propagation, nothing to replay when nothing came up, and the gate's cases (tables handed over, an ANS with nvme-secure-bar, no ANS, PCIe up without a replayable controller). The SMP handoff gate host test stubs the new kboot call. Signed-off-by: Erik Bourget <erik@ebourget.net>
In smp_s2r_pcie_reinit(), only exit the borrowed S2R watchdog guard on the success path before returning to the OS, keeping the watchdog armed across reboot() if PCIe re-initialization fails. Signed-off-by: Erik Bourget <erik@ebourget.net>
Contributor
|
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. |
DjDeveloperr
approved these changes
Nov 25, 2026
DjDeveloperr
left a comment
Contributor
There was a problem hiding this comment.
LGTM — audited the full diff across exception/VBAR_EL2 EL2 S2R handling, G13G GPU 27.2 handoff (3-segment zero-data flag, optional SRAM, apple,sleep-retained), wake PCIe replay gating (up_path tracking + !nvme-secure-bar), WDT v2 ADT guard/restore + PoC cache clean, and SMP wake ordering/tests, with 2-gen physical S2R verification on J313 (M1) and J713 (M4).
This was referenced Dec 3, 2026
DjDeveloperr
added a commit
that referenced
this pull request
Dec 3, 2026
pcie_os_restores_host_fdt() took an apple,pcie-host claim from any node whose own status was enabled. A claimant that is enabled itself but sits below a disabled bus never gets a device: Linux's OF platform population stops at the disabled bus. aura still skipped the #529 wake-time replay for that host, and no OS driver brought it back. Count a claim only when the claimant and every node above it are enabled, with the same status rule as pcie_fdt_node_enabled(). A tree lookup error counts as no claim, so the replay runs as before. The host test adds an enabled claimant below a disabled simple-bus, and below a disabled group under an enabled bus. Both must leave the replay on; the claim counts once every ancestor is enabled. Signed-off-by: DjDeveloperr <hey@djdev.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What: Publish the T8103 (G13G) GPU firmware 27.2 DT handoff and harden the S2R wake return path (masked DAIF +
VBAR_EL2setup, PCIe complex re-initialization on pre-M4 SoCs withoutnvme-secure-bar, and watchdog coverage through failure reboot).Tested: J313 (M1 MacBook Air,
f5ddfff2with combined Linux exact heads3577ce0e4885+697fc879d990atc808a9c12341, live accelerated Hyprland): boot + GPU 27.2 handoff + 3 consecutive physical S2R wakes (0 -> 1 -> 2 -> 3), Wi-Fi/BT/audio/Borealis compute & render passing every wake. J713 (M4 MacBook Air,f5ddfff2on7.3.0-ewb-daily+): boot + 2 consecutive physical S2R wakes (0 -> 1 -> 2), NVMe + PCIe/radio intact, 0 failed units, 0 new kernel errors. Host tests (test_pcie_sequence.py,test_smp_handoff_gate.py,test_smp_timeouts.py) andclang-format --dry-run --Werrorpass.Risk: two-way door · M1 (T8103) GPU 27.2 handoff and shared S2R wake return / PCIe complex replay path (other Macs gated by ADT
nvme-secure-barand controller boot state).Not yet: M1 Pro/Max/Ultra (T600x) and M2/M3 (T8112/T8122) S2R wake PCIe replay; J713 tested on non-27.2 firmware.
Details
kboot: gpu: publish the T8103 (G13G) firmware 27.2 handoff(a1f20632) — adds the T8103struct gpu26_targetentry selected by ADT compatibility (sgx,t8103/sgx,g13g), publishesapple,firmware-compat = <27 2 0>, reserves the coredump copy buffer, and enables the DT GPU node on firmware 27.2+.exception: keep DAIF masked and set VBAR_EL2 when returning from S2R(3526be04) — installsVBAR_EL2and leaves DAIF masked across the S2R wake return into the OS.pcie, smp: re-initialize PCIe complex on S2R wake before returning to the OS(8893cb58) — replayspcie_init_controller()on wake for boot-initialized controllers when the OS does not own APCIe tables and the ADT has nonvme-secure-bar, powering ANS domains first as at boot.smp: keep S2R PCIe watchdog armed until failure reboot(f5ddfff2) — keeps the hardware watchdog armed across the wake PCIe replay and failure-reboot path so a stalled replay cannot hang indefinitely.Evidence
ewb-m1, M1 MacBook Air) atf5ddfff2(BIOS aura 1.0.0b17-gf5ddfff2, Linux combined mergec808a9c12341of3577ce0e4885+697fc879d990):G13 firmware 27.2 running; DRM device registered), live accelerated Hyprland onApple M1 (G13G B1).compute-check 54460 runs / 0 bad,render-check 200200/200;s2idle4459/0;pm_test=core4497/0.boot object resumes 0 -> 1 -> 2 -> 3):MGMT ver 1.23, audio OK, GPU back in 5071 us, Borealis 4203/0 + 200/200, same Hyprland PID4646.MGMT ver 1.23, audio OK, GPU back in 4031 us, Borealis 4167/0 + 200/200, same Hyprland PID4646.MGMT ver 1.23, audio OK, GPU back in 2800 us, Borealis 4174/0 + 200/200, same Hyprland PID4646.aurora-sep.servicefailed (expected before first password unlock after cold boot, same as daily boot); 0 new S2R/PCIe/GPU kernel errors.ewb-m4, M4 MacBook Air) atf5ddfff2(BIOS aura 1.0.0b17-gf5ddfff2, Linux7.3.0-ewb-daily+):/boot/efi/aura-tryboot clean; 2 consecutive physical S2R wakes (boot object resumes 0 -> 1 -> 2); NVMe (nvme0n1) + PCIe (00:00.0, BCM4388 Wi-Fi/BT) intact; 0 failed units; 0 new kernel errors.build/aura.bin(3,932,160 bytes) andbuild/aura-boot.machobuild clean;clang-format --dry-run --Werrorclean on all touched C/H files;test_pcie_sequence.py,test_smp_handoff_gate.py, andtest_smp_timeouts.pypass.