Repository navigation
T6050: shorter resume tail after a deep sleep (N1 link watch, SD port, Type-C state) [not yet hardware-tested] - #2031
Conversation
After a firmware sleep the N1's rewake work, which runs once tasks run again, watched the radio's link for a second and then waited 100 ms before it enumerated the functions again, both counted from the moment the work started. The host had trained that link in the wake's noirq resume, so on the M5 Pro the work held the PCI rescan lock for 1.1 s after the thaw at each of three wakes, most of it on a link that had been up for most of a second already. The host now records when its bring-up of the port had the link up, with the 100 ms after the training over (apple_pcie_t6050_link_up_time()), and the work counts both from there: the watch covers the first second after the link trained, and the wait for configuration requests only what is left of its 100 ms. The link is looked at once at least, however late the work runs, and a link found down still has 10 s from the work's start to train again. When the host can't say, and when the work cycles the port itself (a suspend abandoned with the link still up), the times count from the work's start, as before. Compile-checked only; not yet run on the hardware. Signed-off-by: Diljit Singh <[email protected]>
After a firmware sleep the SD card reader's port is back, and its functions are looked for, from the host's PM_POST_SUSPEND notifier. The rescan takes the PCI rescan lock, which the N1's driver holds through its own removal and new enumeration of the radio's functions after the same wake: 1.1 s after the thaw on the M5 Pro. The notifier waited for it, and with it every notifier after it in the chain (the USB controllers' restart, the neural engine's) and the end of the system's resume. In a test run "PM: suspend exit" came 1.2 s after "Restarting tasks: Done" at each of the three wakes; the SD port's own rescan took 15 ms of that. The notifier now queues a freezable work that brings the parked ports back and looks for their functions. The next suspend's PM_SUSPEND_PREPARE flushes it before it parks the ports again, a later sleep's freezer waits for it, and a restart's shutdown cancels it before it holds the ports. A port back up is taken off the parked ports under the host's lock, which the shutdown holds while it reads them. Compile-checked only; not yet run on the hardware. Signed-off-by: Diljit Singh <[email protected]>
After a firmware sleep the SD card reader's port came back in the host's early resume: the reader's power and 150 ms for it, the port's setup, the training and the 100 ms after it. That is 271 ms on the M5 Pro, all of it ahead of the resume's normal phase, where the display processors restart: the internal panel's processor started 0.75 s after the wake, its last 0.27 s spent waiting for the SD card reader. macOS does not hold its display processors back for that port either. The default is now t6050_sd_port_wake=2: the port comes back once the resume is over, from the host's work (previous commit), and its waits hold up nothing else. t6050_sd_port_wake=1 keeps the early resume. The work now runs alongside the N1's new enumeration, whose MSI vectors take the host's lock. The bring-up holds that lock only for its register steps and the training: not through the reader's 150 ms power-up wait, after which the setup is not started if the radio's port went down meanwhile, and not through the 100 ms after the link is up (apple_pcie_t6050_port_train() is split for it, its other callers unchanged). Until now the late path ran only after a suspend abandoned before the radio's reset: the default needs its own run on the hardware. Compile-checked only. Signed-off-by: Diljit Singh <[email protected]>
After a resume the port controller's state is read afresh and applied by the update work, which, as after every plug, runs 500 ms later. On the M5 Pro the Type-C PHYs and the external display's DisplayPort path therefore started 0.55 s after the tasks thawed at every wake, for a cable that had stayed in through the sleep. The resume's first fresh read is now applied at once when it is a quiet one: a plug was in when the sleep began and is in now, no plug event was latched or acknowledged while asleep or since, the status read saw no plug change in any phase, the controller was not set up again, and no retry, lost event or tunnel notification came first. Everything else, a dark wake and every later read keep the debounce. Compile-checked only; not yet run on the hardware. Signed-off-by: Diljit Singh <[email protected]>
"usb: typec: tipd: cd321x: a wake's port state without the plug debounce" adds sleep_plug and wake_apply to struct cd321x, and cd321x_retry_revalidation() and cd321x_retry_held_mux() now clear wake_apply. The physical-disconnect fixture (and fast-replug-bounce and dropped-swap-teardown, which build on it) pastes both functions, but its model struct had no such member, so the three units no longer compiled. Give the model struct the two members. The transition cases now start with wake_apply set and check that the revalidation retry clears it. Signed-off-by: Diljit Singh <[email protected]>
717a516 to
a50357e
Compare
|
Rebased onto the current integration/aurora (c33c5fd). The four commits are unchanged, with the same patch-ids. The new head is a50357e. Added one commit, |
Not yet hardware-tested: compile-checked only. Each commit says so.
Four changes to what happens right after a deep sleep's wake on the J714s (MacBook Pro 14", M5 Pro, T6050), all aimed at the time from the wake to a usable machine. On the J714s's private test stack (the run in #2029), "PM: suspend exit" came about 1.2 s after "Restarting tasks: Done" at each wake, the internal panel's display coprocessor started 0.75 s after the wake (0.27 s of it waiting for the SD card reader's port), and the Type-C PHYs and the external display's DisplayPort path started 0.55 s after the thaw.
wifi: apple: centauri T6050: the N1's rewake work watched the radio's link for a second and then waited 100 ms, both counted from when the work started, although the host had trained the link in the noirq resume long before; the work held the PCI rescan lock for 1.1 s after the thaw. Both are now counted from the host's bring-up of the port (apple_pcie_t6050_link_up_time()); the link is still looked at at least once, a link found down still has 10 s to train again, and without a time from the host everything counts from the work's start as before.PCI: apple: T6050: a parked port's return and the search for its functions run from a freezable work instead of thePM_POST_SUSPENDnotifier, where the rescan waited for the N1's own enumeration and held up every later notifier and the end of the resume. The nextPM_SUSPEND_PREPAREflushes the work, a restart's shutdown cancels it, and a port back up leaves the parked set under the host's lock.PCI: apple: T6050: the SD card reader's port now comes back once the resume is over (t6050_sd_port_wake=2, the new default) rather than in the host's early resume, so its 150 ms power-up and 100 ms post-training waits no longer delay the display coprocessors. The bring-up drops the host's lock across those two waits (the N1's MSI setup needs it meanwhile) and does not start if the radio's port went down meanwhile.t6050_sd_port_wake=1keeps the early resume.usb: typec: tipd: cd321x: the resume's first fresh port read is applied at once, not after the 500 ms plug debounce, when it is a quiet one: a plug was in when the sleep began and is in now, and no plug event, plug change, setup, retry, lost event or tunnel notification came in between. A dark wake and every later read keep the debounce.Scope: the PCIe and centauri changes are on the T6050 sleep path, which is set up only on
apple,j714s. The tipd change is in the cd321x resume path and so reaches every machine with cd321x port controllers, but it only skips the debounce for a quiet wake; every other read behaves as before.Dependencies
None (base
integration/aurora); independent of the display PRs (#2027, #2028, #2029, #2030). To be run on the J714s together with them before merging.Checks
make ARCH=arm64 LLVM=1 Image modules, the M5 kit's configuration) of this head: links (vmlinux, Image, 1774 modules), 0 warnings.--strict): 0 errors; the warnings are the author name against the sign-off's and a few lines over 100 columns.🤖 Generated with Claude Code