Repository navigation
soc: apple: sleep: wait for the debug link's contract on a defined condition - #2402
RyanTheTide wants to merge 4 commits into
Conversation
…ndition
After the port controller's cold reset cuts the debug link, the sleep
waits for the partner to renegotiate its contract. That wait was an
mdelay(50) and then an mdelay(10) loop for up to 1.5 s. Whether the
reset had been taken was inferred from seeing the contract gone (no
answer, or no contract); a contract that never seemed to go counted as
back only after a 1 s floor.
The controller names the boot loader's debug link in its MODE register
("DBMa"), and only the cold reset ends that mode. Read MODE before each
reset. Where it is the debug link's, the reset counts as taken once the
controller has left that mode, so a quick reset is no longer held to the
1 s floor. A controller still waking reads zeros, which say nothing of
its mode and are ignored. Where MODE reads anything else, the old test
is used as before, floor included.
One look at the controller is now a function polled with
read_poll_timeout_atomic(). The look itself bounds the wait in wall
time (1.5 s, as before): its SPMI commands take a while, and the atomic
poll counts only its own delays. The 50 ms after the reset command, in
which the controller still answers as before it, is named
HPM_RESET_STALE_MS.
The stale-read finding and the 50 ms first look are Diljit Singh's.
Fixes: 2a57a36 ("soc: apple: sleep: look for the debug link's contract from 50 ms after its cut")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
APPLE_CLPC_GPU_BACKOFF_MS keeps the GPU floor released for 100 ms after the PMP last limited the DCS. It reads as a fixed delay standing in for an event, so say why it is not one: the PMP's limit is its vote in the PMC floor word, a register it rewrites with no interrupt or message to the AP, and under heavy work that vote goes back to the top between limits. Only sampling sees it; the hold is hysteresis on that sample. No functional change. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Looks good; approve once the Neo deep row below is on 86fea1a. I checked
HW row: Neo J700 with the debug cable, on a fleet kernel plus this head, default command line. Run Assisted-by: LLM (Claude:Opus 5.5) |
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Forward-merged main f02bd68 as d3b238f. Conflict in sleep.c: main (b43e2b0, T8122 deep sleep) moved the contract wait onto the raw counter because the late cut now runs with timekeeping suspended, and made the per-reset log conditional on Still needed: the Neo deep row on this head (debug cable attached, |
The previous merge of main recorded 7b10eb1 as its parent but kept the tree of the merge with the main before it, which dropped #4379 (T6031 fixed refresh rates) from dcp.c, iomfb.c and dcp-firmware-test.c. Take those three files as main has them; nothing else changes. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Hardware row at exact head
How: one combined test kernel for eight PRs, not this PR alone. Kernel |
Problem
Two fixed waits in
drivers/soc/appleread as delays standing in for a handshake.sleep.c:3594/3611(2a57a36, d9b438c): after the port controller's cold reset cuts the debug link, the sleep waited withmdelay(50)and then anmdelay(10)loop for the partner's contract. Whether the reset had been taken was guessed from seeing the contract gone. A contract never seen gone counted as back only after a 1 s floor, spun with interrupts off.clpc.c:68(51350a0):APPLE_CLPC_GPU_BACKOFF_MS, a 100 ms hold on the GPU floor after the PMP limits the DCS.Change
read_poll_timeout_atomic()over one function. That function enforces the 1.5 s limit in wall time, because the atomic poll counts only its own delays. The 50 ms stale-read window after the command is named (HPM_RESET_STALE_MS).Only boards whose DT has
apple,debug-portreach the sleep change, and today that ist8140-j700.dtsalone. SPMI gen 4 SoCs are refused inapple_sleep_map_debug_port(). The stale-read finding and the first-look timing are Diljit Singh's.Testing
make W=1 drivers/soc/apple/sleep.o drivers/soc/apple/clpc.owith the release config: builds, no new warnings.Still to run
echo deep > /sys/power/mem_sleep; rtcwake -d rtc0 -m mem -s 30, three times. Each time, dmesg must showdebug link: contract back N ms after reset 1 (gone at M ms, mode), with nono contract with the partnerwarning, a clean resume, and a working debug link afterwards. Expect N to be at or below the old value; the old floor case was N >= 1000.rtcwake -d rtc0 -m freeze -s 20): no change expected, because this path runs only for deep.apple,debug-port). Their s2idle rows run against rtc1 in the combined kernel, unchanged.Inventory of fixed delays in this area (our authors) and why the rest stay
Delays kept on purpose:
macsmc.cSMC_SLEEP_ARM_MS/SMC_SLEEP_IDLE_MS: both sides of each gap are already acknowledged commands (the MBSE write reply and the AP power ack). There is no known SMC status for "armed" to poll.rtkit.cpolled-mode loops andmailbox.cG17 TX: polled because the IRQ is off or missing.sensor_shim.c: power-rail settle times.sbio.rs/sep.rs: shared-memory polls with no doorbell.Sites that could be converted but are left alone here:
display-gate.c:2884: could use a bus notifier, but it runs on T6041 only.sleep-t6050.h:2024: T6050 only.The full table is in the evidence directory.