Repository navigation
Hibernation pm_test dry runs on Apple silicon - #1814
Draft
RyanTheTide wants to merge 6 commits into
Draft
RyanTheTide wants to merge 6 commits into
RyanTheTide wants to merge 6 commits into
Conversation
The freeze and poweroff callbacks refused hibernation with -EOPNOTSUPP. That also aborted every hibernation pm_test dry run at this device, so the other drivers' freeze and thaw paths could not be exercised on the machines that carry this chip. Freeze and poweroff now stop the host interface the way suspend-to-RAM does: DMA stops and the firmware takes ownership before the image is made, so nothing writes to memory while it is saved. Thaw and restore use the resume path. After a dry run or an aborted hibernation the firmware is still running and the host interface restarts. After a restored image the rings are gone, mt_hif_restart() reports it, and the radio goes to the platform radio recovery as after a failed suspend-to-RAM. Real images stay disabled on Apple silicon by hibernation_available(). Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
Drivers that refuse a hibernation freeze because their firmware state cannot be rebuilt from an image need to tell a real hibernation from a pm_test dry run, which never makes an image. hibernation_available() answers that: on Apple silicon it stays false and hibernate() only runs dry runs. Export it so modular drivers can use it. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
The M4-class DCP, an adopted RTKit helper session and a retained T8140 radio bootstrap refuse the hibernation freeze, because an image cannot carry their live firmware sessions across the boot that restores it. They also refused pm_test dry runs, so the freeze and thaw paths of every other driver on the J616s and the Neo could not be exercised. Keep the refusal when hibernation_available() is true. While it is false, only dry runs reach these callbacks and nothing loses power: the DCP takes its suspend-to-idle power-down and thaw resumes the same session, and the helper and the bootstrap stay as they are. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
The prepare callback refuses any sleep state that is neither suspend-to-idle nor firmware-driven, because such a state cannot bring the PMU alarm back. It runs for hibernation too, where pm_suspend_target_state stays PM_SUSPEND_ON, so it refused every hibernation transition, including the pm_test dry runs. On the M2 every devices and platform dry run stopped here with -EBUSY. Refuse only real suspend states. Hibernation needs no wake alarm. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
The H16 and H17 backends refuse hibernation from their PM notifiers while the firmware is retained, because an image would carry firmware state the restored kernel cannot match. That also refused every hibernation pm_test dry run, so on the J616s each one stopped at the ANE notifier with "system sleep not supported yet". While hibernation_available() is false only dry runs reach the notifiers. They make no image and keep the power on, so handle PM_HIBERNATION_PREPARE and PM_POST_HIBERNATION like the suspend pair: the engine is powered off for the freeze and booted again from the preload afterwards, as for suspend. PM_RESTORE_PREPARE and real hibernation stay refused. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
With WoWLAN configured, the D3 entry refuses every sleep state other than suspend-to-idle with -EOPNOTSUPP. Hibernation keeps pm_suspend_target_state at PM_SUSPEND_ON, so it was refused too, and every hibernation pm_test dry run on the M1 Pro stopped at this device while WoWLAN was set. Hibernation cannot wake on a packet. Leave WoWLAN out of the freeze and take the plain D3 path, the one used without WoWLAN. Suspend states are unchanged. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
Contributor
Author
|
Blockers: 4.
Nit: ane_fw_sleep.h now has two block comments in a row. The existing one (:10-20) describes ane_fw_sleep_refused_cycle(), so move it back above that function. HW row: rebased head on M2, M1 Pro (WoWLAN set), J616s and Neo J700. Pass criteria: Assisted-by: LLM (Claude:Opus 5.5) |
Contributor
Author
|
Closing for now: real hibernation stays off and the dry-run fixes need a rebase and CI fixes; they can come back with the hibernation work. |
Contributor
Author
|
Reopened and kept as a draft; the comment above lists what it still needs before review. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hibernation pm_test dry runs now complete on Apple silicon.
linux#1250 keeps real hibernation off on these machines (
hibernation_available()is false and/sys/power/diskstays[disabled]) and only letshibernate()run whilepm_testis set, so no image is made. Even so, every dry run was refused somewhere:.preparewith -EBUSY. Its check for "a suspend state that cannot bring the alarm back" also fires for hibernation, becausepm_suspend_target_statestaysPM_SUSPEND_ONthere. On the M2 this stopped 20 of 20 dry runs on the current kernel.PM_HIBERNATION_PREPAREwhile the firmware is retained. This stopped every dry run on the J616s.Changes:
rtc: apple-pmu: refuse only real suspend states in
.prepare. Hibernation needs no wake alarm.mt7932: freeze and poweroff stop the host interface as suspend-to-RAM does (DMA stops and the firmware takes ownership). Thaw and restore use the resume path, which restarts the host interface. If the rings are gone after a power cycle, it hands the radio to the platform radio recovery.
hibernation_available()is exported.The DCP, rtkit-helper and the T8140 bootstrap still refuse when an image could be made. When it can't, the DCP takes its suspend-to-idle power-down and resume brings back the same session; the helper and the bootstrap stay as they are.
accel/ane: while
hibernation_available()is false, a dry run is handled like suspend: the engine is powered off for the freeze and booted again from the preload. Restore and real hibernation stay refused.brcmfmac: hibernation leaves WoWLAN out and takes the plain D3 path. Suspend states are unchanged.
Real images stay disabled. Cold restore of each coprocessor and the resume path come in later changes with their own tests.
A dry run resumes devices with
PMSG_RESTORE(in_suspendis 0 at that point), so these runs exercise.restoreon warm hardware.Results, M2 (T8112), test kernel built from this branch on integration/aurora ac601ea, SELinux enforcing:
After every run Wi-Fi was associated with the gateway reachable in 2 to 4 s, Bluetooth was powered, every device freeze and restore callback returned 0 (both DCPs, apple-drm, nvme-apple, brcmfmac, hci_bcm4377), and there were no call traces, DART faults or AVC denials.
The M1 Pro and J616s rows on the earlier test kernel (without the last two commits) stopped at brcmfmac and the ANE respectively, with no other refusal and both machines back on their defaults. Rows on the full branch for M1 Pro, J616s and J700 to follow.