Skip to content

nvme: T6050: adopt a live session an earlier stage passed on - #159

Merged
DjDeveloperr merged 1 commit into
mainfrom
fix/t6050-adopt-earlier-ans
Nov 11, 2026
Merged

DjDeveloperr merged 1 commit into
mainfrom
fix/t6050-adopt-earlier-ans

Conversation

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Problem

On the M5 Pro (J714s, T6050), an ESP Stage 2 built from main loses NVMe and drops to its proxy:

nvme: entry RUN=1 BOOT_STATUS=0xde71ce55 saved SART entries=0
nvme: entry CC=0x470000 CSTS=0x0 AQA=0x3f003f ...
rtkit(nvme): IOP power transition timed out
nvme: ANS didn't acknowledge idle, stopping it anyway
nvme: ANS powered off, 10 SART entries kept
rtkit(nvme): did not receive HELLO
nvme: ANS didn't start from off; it stays down until a reboot
No valid payload found

The installed Stage 1 hands its ANS session on running (controller disabled, nvme.adopt). Main
treats that as an earlier stage's session and powers it off before starting it from off. Behind
Stage 2's 15 s host window, the firmware acknowledged AP idle but not IOP idle. With no idle there
was nothing to warm-start from.

Evidence (this M5's recorded consoles)

  • That power-off ran 15 times on the host kick path, each about 7.5 s after Stage 1's hand-on.
    Every one was acknowledged and every warm start came up. The one run as a real ESP Stage 2
    reached NVMe 15.7 s after the hand-on and failed as above. Why the firmware stops acknowledging
    later isn't known.
  • Adopting the session as it is (the M5's default Stage 2 does this on every boot): 245 of 251
    boots came ready, 155 of 156 at the ~22 s timing. The rare CSTS.RDY timeouts are what main's
    existing T6050 restart from off covers.

Change (src/nvme.c)

  • T6050: a healthy session from an earlier stage (BOOT_STATUS OK, no CSTS.CFS) is adopted as it
    is. The SART is read for kboot's reservations, there's no RTKit instance or mailbox traffic, and
    the controller is set up again.
  • If the adopted controller doesn't come ready, main's existing restart from off runs.
    nvme_ans_power_off() now makes the RTKit instance itself when the session had none.
  • A setup failure of an adopted session keeps its queues.
  • Other chips, unhealthy sessions and kboot are unchanged. Linux still gets controller and RTKit
    running, with no apple,sart-entries.

Validation (M5 Pro J714sAP, 2026-11-11)

Built USE_CLANG=1 BUILDSTD=1 CHAINLOADING=1 ESP_STAGE2=1 DEBUGUSB_PROXY=1. Installed as the
ESP Stage 2 with the M5's current kernel set:

  • Debug-cable reset, the failing path: Stage 1, then this Stage 2 with its 15 s window. At
    22.19 s it logged nvme: adopting the live post-M4 ANS session, nvme: initialized 10 ms
    later, then reads verified and leaving controller and RTKit running for Linux adoption.
    Linux 7.3.0 mounted its root on nvme0n1p5. A 64 MiB O_DIRECT read of /dev/nvme0n1 ran at
    4.8 GB/s with no nvme errors.
  • Soft reboot of the same set: back on SSH from a new boot, root on nvme0n1p5, 64 MiB direct
    read at 3.0 GB/s. This boot's console wasn't captured.
  • Not exercised on hardware: the restart-from-off fallback after an adopted RDY timeout.
  • The host NVMe adoption model compiles with -Werror; CI runs the tests. clang-format 20.1.8 is
    clean.

🤖 Generated with Claude Code

The installed M5 Stage 1 hands its ANS session on running, controller
disabled. An ESP Stage 2 built from main powered that session off and
started it from off, as it does for its own session after use. Behind
the Stage 2 host window, 16 s after Stage 1's hand-on, the firmware
acknowledged AP idle but not IOP idle, and the warm start then got no
HELLO: no NVMe, no payload. Every earlier power-off of such a session
ran about 7.5 s after the hand-on and was acknowledged.

Adopt a healthy session as it is (RTKit untouched, controller set up
again), as the M5's default Stage 2 does on every boot. If its
controller doesn't come ready, the existing restart from off still
runs, now with an RTKit instance made for it then.

Signed-off-by: Diljit Singh <hey@djdev.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant