Repository navigation
Boot chain: wait on hardware state instead of fixed delays, and fail closed on ignored errors - #479
RyanTheTide wants to merge 41 commits into
Conversation
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 a halted CPU in CPU_STATUS: STOPPED (bit 1) with IDLE (bit 5) clear. STOPPED alone is not enough: an IOP waiting in its idle loop reads STOPPED|IDLE (0x22) while RUN is still set, as asc_cpu_idle() and the inherited-DCP check already treat it, and it can still send its acknowledgement. Poll for STOPPED with IDLE clear, with the same 1 ms bound named RTKIT_STOP_TIMEOUT_US, then drain. A CPU that stays in its idle loop gets the whole window, as before. A CPU that is neither halted nor idle at the bound is reported with its status word. The caller's reset follows either way, as before. tests/python/test_rtkit_stop.py runs rtkit_stop() on a fake ASC: 0x22 on the first read with a late message, idle then halted, halted at once, and a CPU that never stops. 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>
dt_set_aop_firmware() reserves the DRAM segments the ADT lists for the AOP (its external code and log on T6040/T6041, its external code and data on T8112 27.2 firmware) for every AOP that is not a T8132 one and whose DART is not locked. The OS maps those reservations in the AOP's DART. When the 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. An AOP that is already running when the reservation fails is handled by a later commit. 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>
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>
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…reserved dt_set_aop_firmware() reaches the segment reservation for every AOP that is not a T8132 one, whose ADT lists firmware segments and whose DART is not locked. When that reservation failed (or reserved only some segments), it disabled the AOP node. That is safe only for an AOP that has not been started: the OS would start it from those pages. An AOP that iBoot already started runs from them now, and a disabled node does not stop it, so the kernel would hand out pages the AOP still uses. Read the AOP's CPU_CONTROL.RUN first, as the T8132 path does. A halted AOP is still disabled. A running one, or one whose ASC cannot be read, refuses the handoff. A successful reservation is unchanged. Also move the J713/J604 comment back above dt_set_t8132_aop(), which it describes. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
There was a problem hiding this comment.
Verdict: FINISH, then merge at 8ca4213537a307059c0c02932dac6a7ca99d0c54
Blockers: GCC, Fedora and Nix checks are failing at this head. Show a green current-head run or link the same failures at the base and the prerequisite fix. An M1 Pro smoke row does not exercise the conflict-resolved T8142 endpoint reset and link path. Please post targeted T8142 boot/radio evidence for the resolved file.
Checked: Compared both parents of the resolution. It retains main's endpoint lookup and early failure handling while preserving the branch's timing change. The follow-up removes the duplicate host link input/stub and moves the AOP helper out of the runner's extraction interval without changing the helper body. This is a resolution review. The independent PR-wide gate still applies to the rest of the stack.
There was a problem hiding this comment.
Verdict: HOLD at 8ca4213537a3
Blockers: Required CI and the targeted T8142 endpoint-reset and radio evidence from the prior review. Owner disposition remains needed for Stage 1.
Checked: The exact CI merge parent also fails GCC, Fedora and Nix. Fedora and Nix match the parent at 4,008 B and 3,152 B of Stage 1 release headroom, respectively. GCC secure headroom also matches. GCC release fails to link at this PR while the parent produces a below-floor measurement, so the parent failure alone does not explain the additional PR release-link failure.
|
Stage 1 disposition: use hardware state for the readiness checks and keep the failure paths safe. If a live coprocessor cannot be handed off, reserve its pages or refuse the handoff before Linux can allocate them. Measure against the #551 baseline and fix the extra GCC release-link failure. Before landing, verify the authorized installed Stage 1 and exact T8142 endpoint-reset/radio and shared regression rows. |
There was a problem hiding this comment.
Verdict: HOLD at 21d28c03 — clean main forward-merge (MERGEABLE); awaiting queued CI (Stage 1 size / GCC link verification post-#551) and the targeted T8142 endpoint-reset and radio boot row.
Blockers:
- Queued CI at
21d28c03(17jobs, including GCC release link and Stage 1 headroom checks on currentmain) must complete green. - Targeted T8142 boot/radio verification exercising the T8142 endpoint-reset and link path remains open from the prior
8ca42135review (alongside Stage 1 owner disposition).
Checked: Clean main forward-merge commit 21d28c03 (MERGEABLE, overlap only in src/kboot.c), queued CI status, and open blockers carried from 8ca42135.
Evidence
21d28c03bringsprfix7/rtkit-stop-stackup to currentmain(MERGEABLE) with17CI jobs queued.- Note: merge commit
21d28c03has noSigned-off-by:trailer; confirmpolicyCI passes on the merge commit.
|
Status at
@DjDeveloperr code-owner ping on the plan above. Please object here if the T8142 row has to come before the merge. |
src/kboot.c: keep this branch's dt_disable_aop() (in-place "fail" on a full DT) and main's board-free dt_set_t8132_aop() comment from #418. Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
There was a problem hiding this comment.
Verdict: FINISH at bb2d013.
Checked: The kboot.c conflict resolution preserves dt_disable_aop and main's T8132 handoff contract. The #570 merge recreates cleanly. The existing Stage 1 owner disposition explicitly calls for authorized installed Stage 1 and exact T8142 endpoint-reset/radio and shared regression rows before landing. Please provide those receipts or a revised disposition from that owner, plus current hosted CI.
Conflict resolutions (main's newer behaviour kept, this branch's intent carried on top): - src/dcp/dptx_port_ep.c: main's DPTX v2 behaviour as is (GET_DRIVE_SETTINGS, drive settings validation and echo, reply zeroing, T8103 link fault and tiled hint answers, unhandled-call log). This branch only named the raw IOReturn codes, so main's new returns use the same IORETURN_* names. No behaviour change against main. - src/kboot.c: main's reset vector relay reservation stays, and the trial watchdog step keeps this branch's fail-closed check (dt_set_trial_watchdog() returns an error that stops the DT preparation instead of being ignored). The earlier AOP resolution is unchanged: dt_disable_aop() and main's board-free handoff contract. - src/kboot_audio.c: main's amp family table (SN012776 and TAS5770L) as is. This branch's fix, that a group whose DT update fails part way has its properties removed from all of its amps, is ported onto the family structure: amp_group_clear() removes the family's properties and a failed lookup or write jumps to it instead of returning with a half-written group. - src/uartproxy.c: main's T6040 DockChannel carrier branch kept; the T8140 schedule call keeps this branch's named delay and flag constants. - src/usb_cdc.c: main's USB2 full speed flag kept; the delay bounds use this branch's USB_CDC_SCHEDULE_MIN_MS/MAX_MS (1000/15000, same values). Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
The T6050 DPTX PHY harness needs the poll32() helper main's driver now calls, and the T8132 AOP gate test expects dt_disable_aop()'s in-place "fail" status instead of a rewritten "disabled" string. Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
|
Row at head aafe8aa (code = 0596c0c; the head adds tests only): J616s M4 Pro (T6040), method-T Stage 1 chain, mode full: PASS. Stage 1 ring 1.0.0b17-g0596c0c6 + aura-trial, live ANS session handed on, Stage 2 g0596c0c6, Enforcing, 0 failed/AVC/kernel errors, DART 0, NVMe errors 0, AVE md5 = production, s2idle 3/3. Restored and verified. |
|
Could you update |
Replaces #441
Problem
Boot-chain fixes from a sweep for fixed waits, ignored errors and unnamed constants (first #368, then #416, then #441). Two review blockers from #441 were still open.
rtkit_stop()treatedCPU_STATUS.STOPPEDalone as halted, which an idle IOP also reads. And after the rebase, the AOP fallback indt_set_aop_firmware()could disable the node of an AOP that iBoot had already started, leaving it running from pages the OS treats as free.Change
The same 29 commits on today's main (cec4a10), with no bot or unsigned commits, and these review fixes:
rtkit_stop()waits for STOPPED with IDLE clear (asc_cpu_halted()). An IOP still in its idle loop (STOPPED|IDLE, 0x22, RUN still set) gets the whole 1 ms window before the last drain, as before the series. "CPU not halted" is printed only for a CPU that is neither halted nor idle. This is folded into the rtkit commit (190da50).dt_set_aop_firmware(): when the AOP's firmware segments cannot be reserved, the AOP'sCPU_CONTROL.RUNis read first. A halted AOP is disabled as before. A running AOP, or one whose ASC cannot be read, refuses the handoff (40d0b3a). The AOP commit (c141a4c) is retitled and its text now covers what reaches this code on main: every AOP that is not a T8132 one, hassegment-rangesand an unlocked DART, including T8112.dt_set_t8132_aop()again.The rest is unchanged. One-line summary of each commit:
Testing
test_rtkit_stop.pyruns the realrtkit_stop()on a fake ASC with 0x22 on the first read and a late message at 400 us, idle then halted, halted at once, and a CPU that never stops (4 cases). The first two fail on the old STOPPED-only check.test_aop_segments_unreserved.pyruns the real fallback: halted gives "fail" in place (or "disabled" without a status), running refuses, unknown CPU state refuses, a node that cannot be disabled refuses, and every unreserved-segment path goes through the CPU check (6 cases).run-t6030-display.sh, which this series fixes.make format-check(clang-format 20.1.8) is clean. Stage 2 (RELEASE=1 CHAINLOADING=1 ESP_STAGE2=1) and the default build both build with gcc. The Stage 2 is 3997696 bytes.AOP firmware segments reserved(the unlocked-DART path), and the AOP was ready with its four iio sensors as on production. s2idle 3/3. Restored afterwards.Still to run
AOP firmware segments reservedorpreserving firmware mappings in locked DART), the AOP bound and its sensors as on production, s2idle 3/3 on the J616s, and 0 AVC denials, 0 failed units, 0 new kernel errors.tps6598x: application firmware ready N ms after resetwith N > 0, then Gen1 enumeration. Someone has to be at the Mac to turn the cable.Review notes for this replacement
Signed-off-by. Thegfyaandagent-policy: syncbot commits and the policy-file restore are dropped. Four commits had a noreply author address, which is now the same as the rest.asc_cpu_stopped()becomesasc_cpu_halted(), which is STOPPED && !IDLE. It has no other caller. If a truly halted ASC also kept IDLE set, the wait would just run the full 1 ms bound, which is the pre-series behaviour, so the change cannot shorten the drain.segment-rangesand an unlocked DART. A running AOP is handled by 40d0b3a.dt_aop_segments_unreserved(). It runsasc_init("/arm-io/aop")andasc_cpu_running(), asdt_set_t8132_aop()does, then callsbail()for a running or unreadable AOP, anddt_disable_aop()(in-place "fail") for a halted one. It is read-only on the ASC: nothing is written to the AOP. kboot: reserve an AOP's firmware pages in Linux's RAM when its DART is locked, so Linux cannot reuse pages the AOP still uses #474 applies the same rule (refuse a running AOP, keep a halted one off) on the locked-DART branch of the same function. Whichever lands second takes a small rebase indt_set_aop_firmware().base + 4ULL * perst.pinin pcie.c, an upper bound forrefclk_to_perst_usin j813_n1.c, and a comment on the CMD1-before-reset assumption in tps6598x_command_core.c.rtkit: wait for the coprocessor's CPU to halt, 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 a halted CPU inCPU_STATUS(STOPPED with IDLE clear). An IOP waiting in its idle loop reads STOPPED|IDLE with RUN still set and can still send, so STOPPED alone is not enough.Change
Poll for STOPPED with IDLE clear (
asc_cpu_halted()) within the same 1 ms bound, nowRTKIT_STOP_TIMEOUT_US, then drain. A CPU still idle at the bound got the whole window, as before. A CPU that is neither halted nor idle by then is reported with its status word. The caller's reset follows either way.Testing
tests/python/test_rtkit_stop.py(4 cases, see above);tests/python/test_nvme_adoption.pypasses.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 bits used: STOPPED bit 1, IDLE bit 5 (as
asc_cpu_idle()reads them).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 a halted AOP whose firmware segments are not reserved, refuse a running one
Problem
dt_set_aop_firmware()reserves the DRAM segments the ADT lists for the AOP: external code and log on T6040/T6041, external code and data on T8112 27.2 firmware. It does this for every AOP that is not a T8132 one and whose DART is not locked. When that reservation failed, kboot logged it and left the AOP enabled, so those pages were free RAM to the OS.Change
Testing
tests/python/test_aop_segments_unreserved.py(6 cases, see above).Scope
Every non-T8132 AOP with ADT
segment-rangesand an unlocked DART, and only when the reservation fails. Segments in the AOP's own SRAM are skipped on purpose and are not a failure. The T8132 path (dt_set_t8132_aop()) already refuses a running AOP.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.