Repository navigation
Boot chain: wait on hardware state instead of fixed delays, and fail closed on ignored errors - #416
RyanTheTide wants to merge 29 commits into
Conversation
…ed 1 ms rtkit_stop() clears RUN on an IOP that never acknowledged a power transition, waited a fixed millisecond for messages still in flight, and drained the mailbox. The ASC reports when its CPU has halted in CPU_STATUS.STOPPED (bit 1, the bit aura already reads for an idle DCP), and nothing the CPU sends can follow that. Poll that bit instead, with the same 1 ms bound named RTKIT_STOP_TIMEOUT_US, and say so with the status word when the CPU does not halt in time. The caller's reset follows either way, as before. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
On an aura-try trial every aura stage arms the trial watchdog, and kboot marks the watchdog node u-boot,noautostart so that U-Boot leaves it alone; a U-Boot that waits forever then still resets into the configured Stage 2. When that property could not be set, kboot logged it and handed off anyway: U-Boot would take the watchdog over and feed it, and a trial that hangs in U-Boot would never be reset, with nobody at the Mac. Fail closed instead: kboot_prepare_dt() refuses the payload, and the trial path reboots into the configured Stage 2 as for any trial that cannot start its payload. Non-trial boots are unchanged. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
… reserved On T6040 and T6041 the OS starts the AOP from the DRAM segments iBoot left (__ETEXT and __OS_LOG), mapped through the AOP's DART from the asc-mem reservations kboot adds. When that reservation failed, kboot logged it and left the AOP enabled: those pages, or the ones after a partial failure, were free RAM to the OS, and the AOP would be started on code in pages the kernel reuses. Disable the AOP node instead, as the T8132 AOP handoff already does for the same failure, and refuse the handoff only if the node cannot be disabled. A successful reservation is unchanged. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The trap delay was described as a workaround knob. It is a default-off bisection aid: sptm_virt_trap_delay_ns is 0 and only run_guest_sptm.py writes it. Say so, and record what the bisection found since: only the sysreg traps matter (t106-t110), SPTM's rare EL2 control writes alone do not (t115), and the last guest writes before every stall power up the camera ISP; with the ISP and its DART hidden the guest runs on without a delay (t121, eb66562). The race itself stays open and is tracked in its own issue. No code change. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The J700 CDC transition reset HPM0 with Gaid and then slept a fixed second before talking to it again. Gaid never completes like other commands: the controller resets, which clears CMD1, and then boots its application firmware, which reports itself in the MODE register. Wait on that instead. tps6598x_wait_ready() first sees CMD1 lose Gaid (or the transport drop while the controller is in reset), so the old firmware's MODE cannot pass as ready, then polls MODE until it reads APP or APP1. Transport errors during the reset are expected; on SPMI the controller is woken again before the next poll. The wait is bounded by TPS6598X_RESET_READY_MS (2000 ms: TI's 1000 ms reset to ready, Linux tipd TPS_SETUP_MS, inside the 2000 ms Linux allows the reset command) and fails the transition, loudly, when the firmware does not come back, instead of carrying on into a controller that is not there. Name the MODE values and the !CMD reply as four-character tags. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
When the port controller reports a failed command before the DebugUSB LOCK, it is reset with Gaid and given 20 ms before LOCK. Gaid reboots the controller's firmware, which TI allows up to 1000 ms; polling CMD1 for the reset to complete also fails as soon as the transport drops during the reset. Write Gaid without waiting for a reply and wait for the application firmware with tps6598x_wait_ready(), as the CDC transition does, before LOCK. The DebugUSB setup now fails, with the controller's MODE in the log, when the firmware does not come back within TPS6598X_RESET_READY_MS. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The CDC schedule flags were bare bits (BIT(0) lane swap, BIT(1) Gen1, BIT(2) HPM cold reset) checked as 7u/2u masks, and the schedule window and re-advertise budget were literals repeated in three places. Give them names in usb_cdc_state.h and use them in usb_cdc.c, the state machine and the Stage 1 proxy window. No change in behaviour. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The T8140 CDC ATC path kept its own copy of the USB2 PHY and PIPE handler offsets and wrote their bits as bare numbers, and the T8152 USB0 path used raw offsets for the USB2 PHY, the PIPE handler and the DWC3 core (0xc200, 0xc2c0, 0xc120, 0xc704). The T6050 path compared the PIPE mux against 0x73/0x42/0x22. Move the USB2 PHY, PIPE handler and USB2 event counter registers out of usb.c into usb_atc_regs.h, named and laid out as in Linux drivers/phy/apple/atc.c, add the per-generation MUX_CTRL field helpers, and use them, and the existing DWC3 register names, in all three paths. The PSD/AON power registers of the T8152 path have no public names and stay as they are. No functional change: usb.o, usb_t8152.o and usb_cdc_atc.o disassemble identically before and after. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
j813_n1_reset() was a copy of smc_adt_function_reset() with the SMC key and value of pci-bridge0's function-reset (pKW4 'gP13', 0x800000) hard-coded. Use the helper on the bridge's ADT node instead, as the T6050 and J873 N1 paths already do: same writes (level 0, then 1, 50 ms each), but taken from the ADT, and a missing or non-SMC function-reset now stops the bring-up instead of writing a key the board may not have. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The J813 N1 and T6050 GP bring-ups slept a bare 100 ms after the SMC function-reset release and again after link-up, then read the endpoint's ID once. Both waits are spec times, and the single read is where a readiness poll belongs: - After the function-reset release: PCIe CEM T_PVPERL, at least 100 ms with the endpoint powered before PERST# is deasserted (PCIE_CEM_T_PVPERL_MS). - After link-up: PCIe Base 6.6.1, at least 100 ms after link training before the first Configuration Request on a port faster than 5 GT/s. Every apcie bridge in the ADT states this as perst-to-config (100 on J813, J873, J873s, J700, J773s); pcie_adt_perst_to_config_ms() takes the longer of it and the spec value. - Then the endpoint has until 1.0 s after reset to complete config requests (Base 6.6.1). pcie_wait_config_ready() polls its vendor ID past all-ones and Request Retry Status for up to that long, and fails loudly if it never answers, instead of judging the endpoint by one early read. No change to the time either path spends on a healthy endpoint. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
j813_n1.c drove PERST# through a hard-coded pad address (0x39a000300, AP GPIO 192) and waited a fixed 1 ms for refclk-to-PERST#. pci-bridge0 gives both: function-perst = GPIO(0xc0) of /arm-io/gpio0 and t-refclk-to-perst = 100 (us). pcie_t6050.c already resolved its pads that way, inline. Move that resolver to pcie.c as pcie_adt_perst_gpio() and use it from both, and resolve J813's pad and refclk time before anything is powered, so a board whose ADT lacks them stops cleanly. The 1 ms floor both paths keep over the ADT's 100 us is named APCIE_REFCLK_TO_PERST_MIN_US: it is what every bring-up has used, and nothing shorter has been tried. The J813 pad resolves to the same address (gpio0 0x18a000000 + arm-io 0x210000000 + 4 * 0xc0); no change in what is written. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
0bbd6f3 reworded two of j813_n1.c's comments; the file header and five step comments still named macOS driver classes and methods, and the T8142 ANS gate comment in pcie.c named the macOS driver. Say what each step does instead. No code changes. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
pcie_ans_power_off()'s whole-block path (post-M4 SoCs without a storage
gate table: T8132, T8140, T6040, T6041) drops each PHY's CLK1 and CLK0
requests and polls for the acknowledges to fall, but ignored the poll
result and powered the gates off regardless, the same way whether the
PHY let go of its clocks or not.
Check both polls. On a timeout, log the PHY control value and return
-1 before any gate is touched; nvme already treats a failed ANS
power-off as fatal for this boot ("stays down until a reboot") rather
than continuing on a half-stopped PHY.
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
j873_usb_phy_host() slept 1 ms and then read the UTMI clock event counter once to decide whether the PHY started. The counter is the readiness signal: poll it for up to that same 1 ms and go on as soon as it moves, failing as before if it never does. The three remaining waits (10 ms power-up settle, 1 ms after the PHY reset release, 5 ms before the mode switch) have no status bit we know of; name them, with a pointer to the tracking issue, instead of leaving bare numbers. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…fails part way kboot_audio hands each SN012776 amp group's configuration (brownout prevention, DC blocker, per-amp speaker and sense slot rows) to every amp of the group, and documents that the kernel gets either the whole group's configuration or none of it. That held for a group whose amps could not be matched, but not for a DT write that failed part way (no room left in the tree): the amps written before the failure kept the new properties, the rest did not, and the amps of one speaker group were set up differently. On a failed write, remove every one of these properties from all of the group's amps again (removing a property never needs room in the tree) and say so. A group that is written in full is unchanged. The host test gains a sweep over the free space left in the tree: with the old code 0 bytes free leaves a partial group; now each of 129 sizes gives either the whole group (116) or none of it (13). Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
kboot_atc.c now reads #address-cells/#size-cells through libfdt's fdt_address_cells()/fdt_size_cells() and matches ADT compatibles with adt_is_compatible(). The host test linked neither, so it no longer built; nothing noticed because no CI job runs it. Link libfdt's fdt_addresses.c and add an adt_is_compatible() stand-in that matches any entry of the compatible list, as aura's ADT reader does. All checks pass again with gcc and clang. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Eight tests/run-*.sh host tests (speaker amp configuration and speaker ID, logo, payload profile, T6030 display facts, T8122 PMP, full start and GPU diagnostics, and the M3 start.S move gate) were never run by CI, and one of them had stopped building unnoticed. Run them on the ubuntu-latest jobs, with dtc and qemu-user installed; the start.S move gate runs on the LLVM job, which has clang and the LLVM binutils. run-smbios.sh stays out: it needs a Mac's ADT and DTB. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The T8152 HDMI phy activation logged an impedance calibration timeout and then programmed the termination from 0x1c24 anyway, which holds no calibration result until the completion bit is set. A missing phy node likewise skipped every tunable and carried on. Poll the completion bit with poll32() and a named 1 s bound (the old loop's 100000 x 10 us), and return an error from both cases so DPTX_APCALL_ACTIVATE reports kIOReturnError instead of training a link on an uncalibrated phy. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The T8152 USB-C (ATC) and HDMI (dptx-phy) bring-up waits between control steps with bare udelay()/mdelay() literals. None of these steps has a known status bit; the ones that do (CFG status, crossbar acks, PSD, PLL ack/lock, impedance calibration) are already polled. Name each wait and say what it separates: ATC_STEP_DELAY_US for the clamp/power/isolation/sleep steps, ATC_DPTX_DISABLE_SETTLE_US, ATC_ALT_MODE_POLL_MS for the alternate-mode poll interval, and ATC_ROUTE_SETTLE_MS and DPTX_T8152_POWER_SETTLE_MS, whose cause is not known and which carry tracking references. The lane enable loop waited twice in a row after the last step; that duplicate is dropped (2 us -> 1 us per lane). No other timing changes. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The DPTX port service replies used 22 bare 0xe00002xx literals, only some of them commented. Name the four codes after the public IOKit IOReturn.h values and give apcall 26 an enum entry instead of a bare case label. No functional change. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Some comments in atc_phy.c and dptx_port_ep.c named another driver's build, its internal tables and function names, and an attribute field name. Describe what each step does instead. Comment changes only. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…out helpers test_pcie_sequence.py compiles src/pcie.c without its includes against host stand-ins. pcie.c now names its reset waits in pcie.h and polls config readiness with timeout_calculate()/timeout_expired(), so the harness no longer built. Take the PCIE_/APCIE_ defines from pcie.h itself (so they cannot drift) and add max() and poll-counting timeout stand-ins. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
USB_CDC_FLAGS_ALL is too long to align with the flag definitions above it, and clang-format 20 and 22 disagree about how to lay it out inside that block. Give it its own comment and paragraph. No code change. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The config-readiness timeout message printed a u64 with %lx. On aura u64 is unsigned long, but the PCIe sequence host test builds pcie.c with the host's uint64_t, which is unsigned long long on macOS, and -Werror=format stops it there. Cast the address to unsigned long. No change on aura. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
qemu-user-static is only a virtual package on the current ubuntu-latest image, so apt refused it. qemu-user ships the qemu-aarch64 binary the start.S move gate looks for. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
RyanTheTide
left a comment
There was a problem hiding this comment.
No blockers. I read every hunk, mainly to check that each new wait is bounded and fails to a safe state. All of them are bounded. rtkit_stop polls for up to 1 ms. tps6598x_wait_ready has a 2 s budget, and the SPMI register select inside it is bounded by that same budget, so a stuck select cannot outlast it. pcie_wait_config_ready polls for up to 1 s. The J873 UTMI clock poll and the T8152 impedance calibration poll keep their old bounds of 1 ms and 1 s. The failure paths lead to safe states: the CDC transition fails to the existing "VDM recovery required" state with the watchdog still armed, ANS stays down until a reboot, the AOP is disabled (iBoot leaves it stopped on T6040/T6041), and a trial boot refuses its payload. The kboot_audio change only ever removes the apple,* amp properties, which is the same "none" outcome the file already produces when the ADT lacks a group property. It does not weaken any speaker limit. Three things are worth fixing:
-
src/tps6598x_command_core.c:76-80: when CMD1 reads
!CMD, meaning the controller rejected Gaid, the code counts it as "reset seen". MODE then still readsAPPfrom the firmware that never reset, and tps6598x_wait_ready() returns success and logs "application firmware ready". In the debugusb path (tps6598x.c:392) this is a regression. The oldtps6598x_command(dev, "Gaid", ...)returned -1 on!CMD, but now LOCK goes ahead on a controller that was never reset. Fix: return -1 when CMD1 reads TPS_CMD_INVALID, and add a host test next to test_reset_wait_fails_when_reset_never_happens. -
src/pcie.c:1104-1108: pcie_adt_perst_to_config_ms() puts a lower bound on the ADT's perst-to-config but no upper bound, and the value goes straight into mdelay() in j813_n1.c and pcie_t6050.c stage_e. A corrupt or unexpected property would turn into an unbounded stall in the boot chain. Fix: clamp it, for example to PCIE_RESET_READY_MS, and log when the clamp applies.
-
src/kboot.c:9281-9284 (also the T8132 path at 9153-9156): if this reservation fails because the DT has no room left, growing
statusfrom "okay" to "disabled" will most likely fail too. bail() then refuses the whole handoff, so a J616s with a full DT stops booting instead of booting without AOP. Fix: ifstatusis "okay", overwrite it in place with "fail" (same length, fdt_setprop_inplace, needs no extra room; Linux treats it as unavailable), and only fall back to fdt_setprop_string or bail when that is not possible.
Minor: the body says "CI green (16/16)", but on this head (f0f6868) the checks are still pending after the rebase. Please re-confirm once they finish.
Hardware rows that lab Macs can cover:
- Neo (J700): CDC transition with HPM reset (flags GEN1|HPM_RESET). Cold and warm boot, both cable orientations, 3 or more runs each. Pass:
tps6598x: application firmware ready N ms after resetwith N well under 2000, then Gen1 enumeration and theCDC ATC: lane=line, andnot readynever appears. - M2 (I2C) and J616s (SPMI): a debug/USE_DEBUG_USB boot with the LOCK status check forced to fail once. Pass: the reset-wait line, then DBMa mode entered. After fix 1, a forced
!CMDshould fail cleanly. - The ANS power-off clock-ack timeout and the rtkit_stop "not halted" path do not run on a normal boot of any lab Mac, as the body says. The four PASS rows show no regression there; they do not exercise those paths.
Assisted-by: LLM (Claude:Opus 5.5)
DjDeveloperr
left a comment
There was a problem hiding this comment.
Reviewed f0f6868. Each new wait is bounded, and most failure paths land in a safe state. I confirmed Ryan's three findings in the code, so I'm requesting changes:
src/tps6598x_command_core.c:79: any CMD1 value other thanGaidcounts as "reset seen", including!CMD(the controller rejectedGaid). MODE then still readsAPPfrom firmware that never reset,tps6598x_wait_ready()returns 0, and the debugusb path (src/tps6598x.c:392) goes on to LOCK on a controller that was never reset. The oldtps6598x_command()returned -1 there. Return -1 onTPS_CMD_INVALID, and add the host test next totest_reset_wait_fails_when_reset_never_happens.src/pcie.c:1108:max(ms, PCIE_RESET_TO_CONFIG_MS)sets a floor on the ADT'sperst-to-configbut no ceiling, and the value goes straight intomdelay()inj813_n1.candpcie_t6050.c. Clamp it, toPCIE_RESET_READY_MSfor example, and log when the clamp applies.src/kboot.c:9283(and the T8132 twin at:9155): when the reservation failed because the DT is full, growingstatusto"disabled"will likely fail too, andbail()then refuses the whole boot. Overwrite"okay"in place with"fail"(fdt_setprop_inplace, same length, which Linux treats as unavailable), and only bail if that isn't possible.
Also:
- This overlaps several open PRs: #377 rewrites the same
dt_set_aop_firmware()block, #398 touchesj813_n1.c, and #394 and #371 touchrtkit.c. Expect a rebase after those. - The M2, J700, M1 Pro and J616s rows were run on #368's tree (976da6f), not this rebased head, which has a different 2.6k-line diff on
src/. Before merge, re-run on the fixed head merged with main:- M2 (T8112), M1 Pro (T6000) and J616s (T6040): aura-try Stage 2, Enforcing, 0 failed units/AVC/kernel errors, NVMe, Wi-Fi, s2idle 3/3, the
amp configuration for N ampsline, andU-Boot leaves the watchdog to the trial budget. The J616s also needsAOP firmware segments reservedwith the AOP bound. - J700 (A18 Pro): the same, plus the CDC transition with the HPM reset, cold and warm, both cable orientations, 3 runs each:
tps6598x: application firmware ready N ms after resetwith N well under 2000, then Gen1 enumeration, andnot readynever appears. - A J813/J815, J775D or J873g row for the N1 PCIe, T6050 PCIe and T8152 USB2/display hunks, as you listed. Those paths have no lab coverage, so they gate the commits that touch them.
- M2 (T8112), M1 Pro (T6000) and J616s (T6040): aura-try Stage 2, Enforcing, 0 failed units/AVC/kernel errors, NVMe, Wi-Fi, s2idle 3/3, the
Assisted-by: Claude Opus 5.5
tps6598x_reset_wait_execute() took any CMD1 value other than Gaid as the reset having started, including !CMD, the controller's answer to a command it refused. MODE then still reads APP from the firmware that never reset, the wait returned 0, and the debugusb path went on to LOCK a controller that was not reset. The old tps6598x_command() returned -1 there. Return -1 when CMD1 reads !CMD. The host test answers Gaid with !CMD and APP in MODE and expects -1 after the single CMD1 read. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
pcie_adt_perst_to_config_ms() raised the ADT bridge's perst-to-config to the 100 ms minimum but passed any larger value through, straight into mdelay() on the N1 and T6050 paths. A function completes configuration requests within 1.0 s of a conventional reset (PCIe Base r6.0 6.6.1, PCIE_RESET_READY_MS), so a longer value is bad data: use the bound and say so in the log. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
When reserving the AOP's firmware segments or DAPF windows failed, the loader grew the node's status to "disabled" and refused the whole boot if that failed too. The reservation usually fails because the DT is full, so growing the property is likely to fail the same way. Overwrite "okay" in place with "fail" (same length, no new space; Linux treats any status other than "okay" as unavailable), and grow the property only when there is no "okay" to overwrite. The boot is refused only if neither works. Both AOP paths (T8132 and the ADT-segment path) share the helper. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Pushed three commits for the 01:49 review (no force push; head 0d5dca0):
Checks: Still to run: the rows from your list on this head merged with main (M2, M1 Pro, J616s, J700 with the HPM reset in both orientations x3), and an outside J813/J815, J775D or J873g row for the N1 PCIe, T6050 PCIe and T8152 hunks. The overlap with #377/#398/#394/#371 doesn't conflict with main today: Assisted-by: LLM (Claude:Opus 5.5) |
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
RyanTheTide
left a comment
There was a problem hiding this comment.
Re-review of f0f6868..50c21b0 (4 new commits). No blockers in the code. All three points from our earlier review and Dj's CHANGES_REQUESTED are resolved. The hardware rows are still open.
Resolved:
- src/tps6598x_command_core.c:78-82: CMD1 reading
!CMDnow returns -1 beforereset_seencan be set, so a controller that rejected Gaid no longer reaches "application firmware ready" and LOCK. A CMD1 transport error still counts as "in reset", as it did before.test_reset_wait_fails_when_gaid_is_rejectedchecks for -1, for MODE never being read (reads == [0x08]) and formode == 0. - src/pcie.c:1108-1114:
perst-to-configis now capped atPCIE_RESET_READY_MSwith a log line, and the 100 ms floor is still applied after the cap. The mdelay() in j813_n1.c and pcie_t6050.c is now bounded at 1 s. The pcie.h comments match the new behaviour. - src/kboot.c:9114-9124 (
dt_disable_aop(), used at 9171 and 9298):"okay"(len 5) is overwritten in place with"fail"(len 5), so a full DT no longer refuses the handoff. The code only grows the property when there is no"okay". Ifstatusis already"disabled", setprop keeps the same length and needs no new space. Only a node with nostatusat all still needs room, and on a full DT that path still bails. I think that's acceptable, since the ADT-derived AOP nodes carry a status.
New in these commits: nothing that blocks. Every wait is still bounded and fails to a safe state, I found no new magic delays, and no new knobs or cmdline params.
Nits (non-blocking):
- src/kboot.c:9099-9113: the new
dt_disable_aop()was inserted between the J713/J604 comment block ("iBoot leaves the AOP halted ...") anddt_set_t8132_aop(), so that comment now sits above the wrong function. Move the helper above it. - Follow-up outside this diff: the J614s AOP fallback (kboot.c:12328-12333) still grows
statusto"disabled"and returns -1 if that fails. That is the same full-DT failure mode this PR just fixed. It could use the same in-place overwrite later.
Still open before merge (Dj's list, unchanged): most CI jobs on 50c21b0 are still pending (pytest arm, format-check and policy pass). The rows also need a re-run on this head merged with main:
- M2 (T8112), M1 Pro (T6000), J616s (T6040): aura-try Stage 2, Enforcing, 0 failed units/AVC/kernel errors, NVMe, Wi-Fi, s2idle 3/3,
amp configuration for N amps,U-Boot leaves the watchdog to the trial budget. J616s also needsAOP firmware segments reservedwith the AOP bound. - J700 (A18 Pro): the same rows, plus the CDC transition with the HPM reset, cold and warm, both cable orientations, 3 runs each. Pass:
tps6598x: application firmware ready N ms after resetwith N well under 2000, Gen1 enumeration, andnot readynever appears. - The J813/J815, J775D or J873g row for the N1 PCIe, T6050 PCIe and T8152 hunks still gates those commits. No lab Mac covers them.
Assisted-by: LLM (Claude:Opus 5.5)
|
J616s (M4 Pro, T6040) row on 0d5dca0 merged with main a752152 (Stage 2
M1 Pro and M2 rows on the same merge follow. Assisted-by: LLM (Claude:Opus 5.5) |
|
M1 Pro (J316s, T6000) row on 0d5dca0 merged with main a752152 (Stage 2
Assisted-by: LLM (Claude:Opus 5.5) |
|
M2 (J413, T8112) row on 0d5dca0 merged with main a752152 (Stage 2
With the J616s and M1 Pro rows above, that covers the three lab Macs on this head. The A18 Pro (J700) CDC/HPM-reset row isn't run yet: our J700 is down. Assisted-by: LLM (Claude:Opus 5.5) |
|
A18 Pro (J700) row on 50c21b0 merged with main 6affb8e (Stage 2
Assisted-by: LLM (Claude:Opus 5.5) |
|
Blockers: 1. The earlier points (Gaid
Nit: HW row: still needed before the commits that touch these paths merge:
Assisted-by: LLM (Claude:Opus 5.5) |
|
Superseded by #441: the same commits rebased onto current main. Assisted-by: LLM (Claude:Opus 5.5) |
Replaces #368, rebased onto current main (conflicts in src/usb.c: the register defines still move to usb_atc_regs.h, main's usb_adt_node_path() kept; src/kboot.c: main's dt_find_aop() rework dropped the
nodelocal the AOP-disable commit used, so that commit now declares it).Boot-chain fixes from a sweep for fixed waits, ignored errors and unnamed constants. Each commit stands alone; they are stacked in one PR to keep review and CI in one place. Summary:
Testing (all commits)
Rebased branch, locally:
make format-check(clang-format 20.1.8) andmake rustfmt-checkclean; clang builds of Stage 1 and the ESP Stage 2 and both esp-stage2-size configs OK (ESP vital region 745480 B of 1179648 B); pytest tests/python + T8122 tests 832 passed, 27 skipped (gcc), 831 passed, 28 skipped (USE_CLANG=1); the seven CI host tests pass with gcc and clang (kboot audio 28 scenarios, DT-full 116 whole / 13 none), M3 start.S move gate pass under qemu, run-pmp-boot-data.sh OK. The local GCC 16 cannot link aura (missing__popcountdi2, main too), so the gcc image builds were not rerun here.Release build (
RELEASE=1 CHAINLOADING=1 ESP_STAGE2=1 USE_CLANG=1) of the full stack OK; clang-format clean on every changed file.Host tests: tps6598x command tests (4 new), kboot audio scenarios (new DT-full sweep), nvme adoption, kboot extraction tests pass; the eight tests/run-*.sh host tests now wired into CI pass locally with gcc and clang.
M2 (T8112) aura-try, ESP Stage 2
1.0.0b13-g976da6f1: PASS. Enforcing, 0 failed units, 0 AVC, 0 kernel errors; NVMe, Wi-Fi, AVE h264/h265 encode md5 identical to production; s2idle 3/3;amp configuration for 4 amps;U-Boot leaves the watchdog to the trial budget. Same rows again with the U-Boot from apple: bound power-state changes in their real unit, name the T8140 eUSB2 settle u-boot#64. Production restored, Stage 2 hash unchanged.Neo (T8140 J700) aura-try, same Stage 2: PASS. Enforcing, 0 failed units/AVC/kernel errors; NVMe, 31 USB devices, Wi-Fi; s2idle 3/3. This boot adopts the live ANS session, so the ANS power-off and rtkit_stop paths did not run here (no-regression only). Same rows with the U-Boot from apple: bound power-state changes in their real unit, name the T8140 eUSB2 settle u-boot#64.
M1 Pro (T6000) aura-try, same Stage 2: PASS. Enforcing, 0 failed units/AVC/kernel errors; NVMe, Wi-Fi; s2idle 3/3; amp configuration for 6 amps and speaker ID as on production. Same rows with the U-Boot from apple: bound power-state changes in their real unit, name the T8140 eUSB2 settle u-boot#64.
J616s (T6040) aura-try, same Stage 2: PASS. Enforcing, 0 failed units/AVC/kernel errors;
AOP firmware segments reserved(success path of the new AOP check), AOP driver bound and ready; NVMe, 8 USB devices, eDP, Wi-Fi; s2idle 3/3; amp configuration for 6 amps and speaker ID as on production. Same rows with the U-Boot from apple: bound power-state changes in their real unit, name the T8140 eUSB2 settle u-boot#64.CI green (16/16), including the newly wired host tests (kboot audio 28 scenarios with the DT-full sweep, T6030 display, start.S move gate under qemu). Locally: full pytest 783 passed, 27 skipped.
Still to run
rtkit: wait for the coprocessor's stop bit, not a fixed 1 ms
Problem
rtkit_stop()clears RUN on a coprocessor that never acknowledged a power transition, then waits a fixed 1 ms before draining the mailbox. The ASC reports when its CPU has halted (CPU_STATUS.STOPPED), so the fixed wait is either too long or, if the CPU has not halted, silently too short.Change
Poll
CPU_STATUS.STOPPED(newasc_cpu_stopped()) with the same 1 ms bound, nowRTKIT_STOP_TIMEOUT_US. If the CPU has not halted by then, print the status word. The caller's reset follows either way, as before.Testing
RELEASE=1 CHAINLOADING=1 ESP_STAGE2=1 USE_CLANG=1) OK; clang-format clean.tests/python/test_nvme_adoption.pypasses.Still to run
Where this runs
Only the rare ANS sleep-timeout paths in nvme.c (M1-M3 shutdown after a sleep timeout, T8140 cold handoff). The worst case is still 1 ms. Status bit layout used: RUNNING bit 0, STOPPED bit 1, IDLE bit 5 (aura already reads bit 1 for an idle DCP).
kboot: refuse a trial payload whose watchdog U-Boot would take over
Problem
On an aura-try trial, kboot marks the watchdog node
u-boot,noautostartso U-Boot leaves the trial watchdog alone. If that property could not be set, kboot logged it and handed off anyway: U-Boot would take the watchdog over and feed it, and a trial that hangs in U-Boot would never reset back to the configured Stage 2.Change
dt_set_trial_watchdog()returns an error when the property cannot be set, andkboot_prepare_dt()refuses the payload. The trial path then reboots into the configured Stage 2, as for any trial that cannot start its payload. Non-trial boots are unchanged.Testing
Still to run
Scope
Every chip, trial boots only, and only when the FDT write fails (e.g. no space left in the DT buffer).
kboot: disable the T6040/T6041 AOP when its firmware segments are not reserved
Problem
On T6040 and T6041 the OS starts the AOP from the DRAM segments the boot loader left, mapped through the AOP's DART from the reservations kboot adds. When that reservation failed, kboot logged it and left the AOP enabled: those pages were then free RAM to the OS, and the AOP would be started on code in pages the kernel reuses.
Change
Disable the AOP node instead, as the T8132 AOP handoff already does for the same failure, and refuse the handoff only if the node cannot be disabled. A successful reservation is unchanged.
Testing
Still to run
Scope
T6040 (J614s, J616s, J773s) and T6041 (J614c, J616c, J575c), only on reservation failure. Segments in the AOP's own SRAM are skipped on purpose and are not a failure.
sptm_virt: call AURA_TRAP_DELAY_NS a diagnostic
Problem
AURA_TRAP_DELAY_NSin sptm_virt_gl.c is described as "a workaround knob, not a fix". It is off by default, but nothing says what it is for or what it found, so it reads like a hidden fix.Change
Comment and tool help text only: call it a diagnostic, record what the trap-delay bisection showed (only sysreg traps move the guest stall; the stall follows ISP power-up; hiding isp + dart-isp removes it), and point at the tracking issue (#342). The environment variable name is kept because existing run scripts use it. No behaviour change.
Testing
Still to run
tps6598x: wait for the HPM firmware after a reset instead of fixed sleeps
Problem
On J700 the CDC transition resets HPM0 with
Gaidand then sleeps a fixed 1000 ms.Gaidnever completes like other commands: the controller resets (clearing CMD1) and boots its firmware. The fixed sleep is too long when the firmware is back quickly, and the code carries on even when it is not back. The debugusb path does the same with a fixed 20 ms.Change
tps6598x_wait_ready()(with a host-testable coretps6598x_reset_wait_execute()): wait until CMD1 no longer readsGaid(or the transport drops), then until MODE readsAPPorAPP1. On SPMI, wake the controller again after a transport error.TPS6598X_RESET_READY_MS= 2000 (TI's reset-to-ready is 1000 ms, LinuxTPS_SETUP_MS; Linux allows 2000 ms for its reset command). On timeout, log MODE and the elapsed time and fail the transition.mdelay(1000)) and after the debugusb reset (replacesmdelay(20)).!CMDreply become four-character tags.Testing
tests/python/test_tps6598x_command.py; the existing tps/HPM/CDC tests pass (39 total).test_cdc_reconnect.pyneeds pyserial, not run.Still to run
tps6598x: application firmware ready N ms after reset, Gen1 enumeration and theCDC ATC: lane=line.Detail
HPM0 is
/arm-io/nub-spmi-a0/hpm0(usbc,sn201202x,spmi). The wait runs in the same session as theGaidwrite; SPMI register selection uses the 2 s budget so a stuck select cannot run past it. After success the session ends with the normal SPMI shutdown. The CDC path only runs on T8140 (J700) from the proxy window; the debugusb path runs on every SoC in debug/USE_DEBUG_USBbuilds, and only when the status check before LOCK fails.usb: name the CDC schedule flags and the ATC USB2 PHY/PIPE fields
Problem
The CDC schedule flags, the recovery budget and the ATC USB2 PHY / PIPE register writes in the CDC paths were bare numbers.
Change
Name them: schedule flags and recovery budget in usb_cdc_state.h, and the ATC USB2 PHY and PIPE fields in a new
src/usb_atc_regs.h(names as in Linuxdrivers/phy/apple/atc.c), used by the T6050, T8140 and T8152 paths. Values with no public name (lane mode, crossbar, PSD/AON/GATE power registers) stay raw. No functional change.Testing
usb.o,usb_t8152.oandusb_cdc_atc.odisassemble identically before and after.Still to run
pcie: poll endpoint config readiness, PERST#/refclk timing from the ADT
Problem
The J813 N1 and T6050 endpoint bring-ups slept bare 100 ms intervals and judged the endpoint by one config read. j813_n1.c also carried its own copy of the SMC function-reset release with the key hard-coded, a hard-coded PERST# pad and a fixed refclk time, all of which the ADT provides. Some comments named macOS driver internals.
Change
smc_adt_function_reset()onpci-bridge0(the 50 ms hold is namedN1_RESET_SETTLE_MS, as on T6050).PCIE_CEM_T_PVPERL_MS) and PCIe Base 6.6.1 (taken from the bridge's ADTperst-to-config, spec value as the floor).pcie_wait_config_ready(): polls past all-ones and Request Retry Status for up to 1.0 s (PCIE_RESET_READY_MS) and fails loudly.function-perst,t-refclk-to-perst) through a sharedpcie_adt_perst_gpio()moved from pcie_t6050.c into pcie.c.Testing
perst-to-configandt-refclk-to-perstare 100 on every apcie bridge in the J813, J873, J873s, J700 and J773s ADTs.Still to run
j813-n1: link up ... endpoint 106b:and Wi-Fi in Linux.port N upfor ports 2, 3 and 0, plus one boot that adopts an already-up link.What can change
On a healthy endpoint the register writes and delays are unchanged. New: if the J813 ADT lacks
function-reset,function-perstort-refclk-to-perst, N1 bring-up stops and the ECAM host is disabled (fail closed). A slow endpoint now gets up to 1 s to answer config space instead of being judged by one read. Remaining fixed waits without a known status bit are tracked in #344.pcie: stop the ANS power-off if a PHY clock does not drop
Problem
The whole-block ANS power-off (post-M4 chips) cleared each PHY's clock requests and polled for the acks to drop, but ignored the poll results: if a clock never dropped, the ANS gates were cut anyway.
Change
Check both polls. On timeout, log the PHY control word and return -1 before any gate is touched; the caller reports "couldn't power ANS off".
Testing
Still to run
pcie: Timeout dropping PHYnever appears, NVMe comes up in U-Boot and Linux.Scope
T8132, T8140, T6040, T6041 whole-block ANS power-off. Behaviour only changes when a clock ack does not drop within 50 ms; before, that case cut power with the PHY clock still running.
j873: poll for the eUSB2 PHY's UTMI clock
Problem
j873.c slept 1 ms after enabling the eUSB2 PHY and then checked the UTMI clock once.
Change
Poll the UTMI clock event counter within the same 1 ms bound and fail as before if it never runs; name the three other settle waits (
EUSB2_POWER_SETTLE_MS,EUSB2_RESET_SETTLE_US,EUSB2_MODE_SETTLE_MS, tracked in #344).Testing
Still to run
kboot: whole speaker amp group configuration or none
Problem
kboot hands each speaker amp group's configuration (brownout prevention, DC blocker, per-amp speaker and sense slot rows) from the ADT to every amp of the group, and the file promises that the kernel gets either the whole group's configuration or none of it. A DT write that fails part way (no room left in the tree) broke that: the amps written before the failure kept the new properties and the rest did not, so the amps of one speaker group were set up differently.
Change
On a failed write, remove every one of these properties from all of the group's amps again (removing a property never needs room in the tree) and log it. A group written in full is unchanged; nothing here stops the boot, as before.
Testing
tests/run-kboot-audio.shgains a sweep over the free space left in the tree (0..2048 bytes, step 16). Old code: 0 bytes free leaves a partial group (test fails). New code: each of 129 sizes gives the whole group (116) or none of it (13); all 28 scenarios pass.Still to run
kboot: audio: ... amp configuration for N ampsis unchanged.T8152 display: fail closed on calibration, name the waits
Problem
The T8152 HDMI PHY activation kept going after an impedance-calibration timeout and then programmed the termination from a register that holds no result until calibration completes. A missing PHY node silently skipped every tunable. The T8152 ATC and dptx-phy bring-up used bare delay literals (one duplicated), the DPTX port service 22 unnamed IOReturn literals, and some comments named another driver's internals.
Change
poll32, same 1 s bound) or a missing PHY node.Still to run
Host tests in CI
Nine tests/run-*.sh host tests were never run by CI; one (T6030 display) had stopped linking because kboot_atc.c gained libfdt address-cell and ADT compatible calls. Fixed the test, and run eight of them on the ubuntu-latest jobs (dtc + qemu-user installed; the start.S move gate on the LLVM job). run-smbios.sh needs a Mac's ADT/DTB and stays out.
Tracking issues for the waits that still lack a status bit: #342, #343, #344, #372.
Assisted-by: LLM (Claude:Opus 5.5)