Repository navigation
Conversation
|
@fbalazsy checking open drafts today. To come out of draft, this still needs:
If it's no longer needed, say so here and we'll close it. Otherwise it stays open as a draft until these are done. |
|
Merged forward without a force push, as suggested: #2215 at 48a9c70 (which carries main) and then main at 00fbe80 are merged in. The merge commit lists the conflicts and how each was resolved. Since then main has moved by 6 commits (t6050 DisplayPort audio DT, macsmc restart priority); they merge without conflicts. f43d634 adapts eight host-test harnesses that stopped compiling because of new hibernation calls and fields (DCP hibernation gates, the in-place IOMFB restart arena, Local results at f43d634:
f43d634 J616s (M4 Pro, T6040), test kernel built from d9b8558 (the same kernel tree; f43d634 only changes test files): cold boot, then 2 suspend/wake cycles, both rc=0 with no new warnings. eDP, DP and HDMI were connected and enabled after each wake, the USB tree was unchanged and dock Ethernet came back. The hibernation Not tested at this head: a real hibernation image (power-off cycle or |
|
Status, still a draft. Head Build and tests at this head
Hardware (J616s, T6040,
Correction to the first version of this comment: I wrote that hibernation stays blocked. That is only so without the fixed layout. With It stays a draft. Next: the full cycles on this head, then the lab row. |
The kernel hibernates on Apple silicon only where the boot object says, in /chosen, that it keeps the same memory layout on every boot, and it reads the device tree of the resuming boot at the address the boot object gives there. Neither property had a binding, and their prefix was not a registered one. Register the prefix and describe the two properties. The prefix is the name of the boot loader that defined them, as u-boot's is: its released versions publish the properties under this name, so a kernel that looked for another one would not hibernate with any of them. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit c2119e1)
A REQ_SYNC write can sit in a volatile device cache, so the signature reset at resume and the end of the image are not on the medium when the write completes. A power loss after the restore then resumes the same image again, or the image is incomplete. Write the signature reset with FUA, flush the image in swap_writer_finish() and fail the hibernation (dropping the signature) when the flush fails. Once the image is in memory, clear the signature again before the devices are restored, so a restore that hangs cannot be resumed into a second time. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit faaf017)
The devices of a kernel restored from an image get PMSG_RESTORE whether the image was loaded by another boot (the firmware and the boot loader reset the hardware) or by the kernel that wrote it (test_resume: the hardware kept its state). Drivers of devices that a boot resets need to tell the two apart. The kernel that loads an image leaves a record in the no-save section, which the image neither saves nor overwrites, and the restored kernel reads it: pm_hibernate_restored_cold() returns 1 after a load by another boot, 0 after a load of the own image. pm_hibernate_is_restored() says whether the kernel was restored at all, and pm_hibernate_is_loading() whether this kernel is loading an image, so freeze callbacks can tell a quiesce for the jump into an image from a freeze for an image of their own. A hibernation aborted before the image exists resumes the devices with PMSG_RECOVER. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit 394d4a1)
Hibernation is refused on every Apple platform, because the drivers of their co-processors have no path to rebuild their state after the cold boot of a restore. Add hibernation_set_platform_check() so platform code can tell when that is handled for the running boot. Without a registered check Apple platforms keep refusing images as before. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit 3891bc4)
Most image pages are loaded straight into their original frames through the cacheable linear map, not through the copy loop. Add an architecture hook, called for every valid image frame once the whole image is loaded and while the list of those frames is still intact, and implement it on arm64 by cleaning and invalidating the page to the PoC. Frames outside the boot kernel's linear map are left to the copy, which cleans them. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit 7089f48)
swsusp_arch_suspend_exit() cleans every copied page to the PoU, which is enough for instruction fetch but not for DMA masters that do not snoop the CPU caches. A later eviction of a dirty line can then overwrite what such a device wrote since the restore. Clean to the PoC instead. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit d98e601)
…ayout The image restores every page to the frame it came from, so the boot that resumes it must give the kernel what the boot that wrote it did: the same RAM, the same CPUs started the same way, and any fixed layout of the boot loader. The kernel build check of the image header cannot see these. Let one platform register hooks: pfn_nosave() keeps ranges that the boot owns out of the image, and layout() mixes the platform's boot facts into a boot layout cookie that is stored in the image header next to the memory regions and the spin-table release addresses. A restore under another layout is refused. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit 54d9b8e)
…ernation Spin-table CPUs cannot be powered off; a parked CPU spins in kernel text that the boot kernel overwrites while it loads an image. Let them wait in a small pen outside the image instead, entered with the image's page tables, and have the restored kernel release them from it. A boot CPU whose node has no enable-method is treated as one that can leave the kernel. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit b6838fb)
… sleep A guest's counters are the physical counter minus an offset fixed when the VM is made. The physical counter starts again across a resume from disk, which is a cold boot, so the guest's counters fall back and its clock stands still until the counter has caught up. Record the counter at syscore suspend and, if it went backwards at resume, move the offsets of every VM by what it lost, so the guest's counters continue as for a VM that was stopped that long. A counter that keeps running through the sleep is left alone. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit ac2fa3d)
A co-processor that stays up across a resume from disk keeps the shared buffers of its session, which the restored kernel has to adopt. Add apple_rtkit_describe_buffers() and a small hand-over area in the no-save section in which the boot kernel leaves, per tagged session, what the restored kernel needs to take it over. Also let the polled power-state exchange used with interrupts off put the co-processor to idle for clients that stay up, and add apple_rtkit_reinit() to the Rust bindings. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit f986895)
The boot kernel of a resume from disk holds RX of an adopted session and hands it over with its buffers; the restored kernel adopts it again in .restore. A self-started session is left for a reload, and a co-processor that the boot left halted is released without a handshake. Add .thaw and .restore callbacks and apple_rtkit_helper_readopted(). Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit c8d3761)
aura publishes /chosen/aura,hibernate-layout on a boot whose memory layout below Linux is the same on every boot, and copies the device tree of each boot to the slot named by /chosen/aura,hibernate-dt. On such a boot, keep every /memreserve/ and non-reusable /reserved-memory range except the kernel image out of the image, add the layout and the boot facts of /chosen to the boot layout cookie, and let hibernation through. Without the property hibernation and resume stay refused on Apple platforms. Also provide this boot's /chosen values and a deferred re-probe for drivers whose co-processor the resuming boot left halted. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit 74accee)
After a resume from disk through a boot the boot loader has cold-restarted the PMP (its image resident in SRAM, the co-processor halted) and nothing replays the probe-time bring-up, so the firmware stays down: the display gate and cpufreq wait for a PMP that never reports running. The module cannot be reloaded, since the power-vote bridge is retained until reboot. Rebuild the session in place on PM_POST_HIBERNATION, the event the restored kernel sends (PM_POST_RESTORE only reaches the loading kernel when it fails to restore), from a notifier registered ahead of every consumer's restore notifier (ANE, DCP, GPU). The decision follows the co-processor's run bit, the state the loading kernel or the boot left: a running firmware (restored by the kernel that wrote the image, or an aborted hibernation) is left alone; a halted one gets its RTKit session reinitialised, its SRAM boot arguments patched again and the boot handshake driven as at probe. The notifier is registered outside pmp_lock, since the notifier chain lock is taken around the callback, which takes pmp_lock. The revocable MMIO guards are held only around the register accesses: they hold an RCU read-side lock, which must not be kept across the sleeping RTKit handshake. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit 0833903)
…m disk A resume from disk through a boot finds every locked DART locked again by the boot loader with fresh firmware-owned roots, while the restored kernel still describes the roots of the image (their mapping, their firmware snapshot and the slots it had published). Every publication then fails with -EBUSY, and with it every DMA mapping through the DART; on the M4 Pro the PMP and every DCP failed their buffer requests with -ENOMEM. Remember the physical address of each mapped locked root and the page table configuration last published into each locked stream. In .restore, read the live roots back: a root that moved is re-imported the way attach maps it, in two passes as attach does (every stream's roots are re-read and snapshotted before any of them is republished, so a root shared by several streams is snapshotted before Linux slots enter it), then the stream's page tables are published into it again. A root that did not move, as when the kernel that wrote the image loads it, is the one the image describes and is kept. Firmware-owned memory is never written: the old roots' published slots are forgotten, not retired. A failed stream is logged and does not fail the whole restore. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit b7fa3a1)
After a resume from disk the RTKit session the restored driver describes is not the one the SMC is in, and every SMC command times out (battery, keyboard and trackpad preflight, power-off). The kernel that loads the image binds this driver like any boot and holds a live session when it jumps into the image; the restored kernel then asks the firmware to start and waits for a HELLO that a firmware already in a session never sends. Following Documentation/driver-api/pm/devices.rst, leave the restored kernel a defined state: - the loading kernel (pm_hibernate_is_loading()) quiesces the SMC in .freeze, the state the normal teardown leaves it in, from which a wake starts a new session. A failed quiesce still enters the image, whose signature is already gone; its restore tries a new session; - .restore reinitialises the RTKit transport, replays probe's bring-up handshake, re-reads the key count and re-arms the notification flag, the same whether the loading kernel wrote the image or was booted; - .thaw after a hand-over that could not enter the image starts a new session the same way. Probe's handshake and key count read move into helpers both use. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit 216072f)
…effect The next power-off handler is PSCI SYSTEM_OFF. Under a boot monitor without a power-off path it resets the machine instead, so a slow or refused off1 must not fall through after only 100 ms: the image written for hibernation would be resumed at once, or the machine would reboot instead of powering off. Retry a refused off1 up to three times, and give an accepted one five seconds before warning and falling through. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit 6ea1f04)
The prepare callback refuses every transition that is neither
suspend-to-idle nor a firmware-driven suspend, because only those keep
a way to bring the alarm back. Hibernation runs the same callback for
its freeze, but with no suspend target set, so it is refused as well:
on the M4 Pro (J616s) a hibernation pm_test run stops at this device
("apple_pmu_rtc_prepare returns -16") before any device is frozen.
A hibernated machine comes back through a cold boot, which needs
nothing from the alarm. Refuse only a suspend state that cannot keep
the alarm, and let a transition without a suspend target through.
Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com>
(cherry picked from commit 0c1fbf5)
…P stops A resume from disk restarts the PMP after it had run. The fast die-temperature wait then reported the PMP as late, measured from the first boot. Start the wait, and its warning, over when the PMP stops. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit 0148e6b)
On post-M4 ANS a resume from disk through a boot is a cold boot: the boot firmware restarted ANS, the boot stages kept it running, and the loading kernel adopted that session to read the image. In the restored kernel anv->rtk describes a firmware instance that no longer exists, and the live session on the mailbox has never been adopted by this kernel. Give the driver explicit hibernation callbacks: freeze and poweroff disable the controller and keep the session like suspend, thaw resumes. A .restore through a boot (pm_hibernate_restored_cold()) stops the controller first (until CC.EN is clear the firmware may fetch from the loading kernel's queues), releases the stale session without a shutdown handshake (the new instance would receive it), checks that a running, booted, enabled-off controller is there and adopts it, as probe adopts the boot loader's session, before the usual resume. A failure quarantines the controller. A .restore from the kernel that wrote the image finds the controller as its .freeze left it and resumes. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit 594d672)
An H16 engine whose firmware has been started refuses hibernation and
restore from its PM notifier, even on a platform that sleeps it cold.
On the M4 Pro (J616s) that refusal is the first thing that stops a
hibernation pm_test run, before the freezer level is reached.
The cold cycle leaves nothing of the old firmware behind: the engine is
powered off with nothing in flight, and after the transition the
firmware boots again from the preload and every open program is
replayed. Across suspend this already runs on the J616s ("powered down
for system sleep", then "resume ok: cold" after every wake). An image
needs no more than that, so on a platform without a warm sleep map
PM_HIBERNATION_PREPARE and PM_RESTORE_PREPARE to the suspend prepare
step and PM_POST_HIBERNATION and PM_POST_RESTORE to the wake step.
A platform that sleeps the engine warm keeps firmware state across the
transition that an image cannot carry; there both stay refused.
Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com>
(cherry picked from commit 78dac96)
The DCPs freeze and thaw through their system sleep callbacks, but the DRM device had only .suspend and .resume. A hibernation freeze therefore stopped the display firmware under an active mode configuration: the HDMI link of the external DCP went down in .freeze, the CRTC was never committed again on .thaw, and the HDMI output stayed disconnected until the next suspend and resume. Use the system sleep callbacks for the hibernation phases as well, so the DRM state is saved before the DCPs stop and committed again after they restart, as for suspend to RAM. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit 1d4dbc5)
Only the H17P handler marked a buffer mapped for piodma. On desktop 26.x the mark was never set, so neither a release nor the session drop after a resume from disk took the translation down, and the second resume from disk in one boot failed every piodma mapping with -EEXIST: no picture on the internal panel. Mark it there too, and refuse an unmap of a buffer that is not mapped, as on H17P, instead of reaching the page table. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit dbbd96e)
…ttached Without a sink the firmware's probing of a DP port fails by design, which logged a warning on every external processor start, including each restart after a resume from disk. Log those at debug level and keep the warning when a sink is attached. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit 4e27f7d)
…from disk A resume from disk is a cold boot: the boot loader restarts the DCP firmware and lights the panel with its boot framebuffer, while the restored driver still holds the session of the previous firmware instance. Until now the driver had no hibernation callbacks, and the display was lost until a reboot. Rebuild the session in place, the way probe builds it, for the desktop 26.x internal DCP and for the T6041 external display processors: - prepare (hibernation only): stop the link work and the HDMI HPD interrupt, stop a merged dual pipe as a pair, and give the external display link and the DP PHYs back as at a runtime unplug, since the cold boot resets the PHY and the image must record it off; - freeze: hold RTKit receive, so whatever the new firmware sends before .restore stays in the mailbox instead of reaching the old session; - restore_early/restore: drop the old session on the host side (mode invalid, endpoints quiesced, IOMFB channels, firmware mappings, retained framebuffers and pending flips released; DMA only after the DARTs are restored). From here the DRM entry points leave the firmware alone and a flip completes without a swap; a shown external display is reported gone so that its return is a hotplug; - PM_POST_HIBERNATION, after the PMP is rebuilt and before the GPU drain, in a work item: run the co-processor, reinitialise RTKit and start the firmware as probe does, power the pipe on and commit the current DRM state. External processors with a display wait until every external processor runs, so a display wider than one pipe finds its peer, and then connect their link through the runtime hotplug path; the HDMI converter is powered again when the link comes back. Every devm allocation, the DMA arena (cleaned to the PoC before the restart), the IOMMU mappings, clocks and registers are reused; no probe primitive runs again. The old endpoint objects stay allocated until unbind (a bounded leak per resume) because their services may still be referenced. Any failing step falls back to the previous behaviour: IOMFB traffic stopped, display left to the boot loader, until the reboot. The teardown at the hibernation power-off is skipped, since the firmware's own power sequence may crash the DCP; the panel keeps the last frame until the machine powers off. If the hibernation fails, PM_POST_HIBERNATION replays the external links once every DCP is thawed. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit 0dfc337)
A sink that drops its link and raises IRQ_HPD after every training (seen with a dual-pipe monitor after a modeset from the kernel console during a hibernation entry) turns each hotplug into a retrain and each retrain into a hotplug, every 0.4-1.2 s, until the Type-C controller gives up on the cable. Retrain at most DCP_HOTPLUG_RETRAIN_MAX times in a DCP_HOTPLUG_RETRAIN_WINDOW that starts with the first retrain and is not extended by refused requests; at the end of the window one more retrain is tried. A real replug resets the bound. Past the limit the link status stays as it is and userspace still gets the hotplug events. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit 1836402)
Hibernation restored the display firmware with a new handshake only, which assumes the boot loader started it anew. A restore by the kernel that wrote the image (test_resume) finds the firmware still in the session it ran on after the image was taken, and the handshake times out on every DCP: RTKit: endpoint discovery failed: -62 hibernation restore: firmware restart failed at start (-62) Per Documentation/driver-api/pm/devices.rst, .restore has to cope with whatever state the loading kernel left. Stop the display firmware at .freeze with the stop the suspend-to-RAM path already uses on the T604x display complex (dcp_t6041_s2r_all(), selected by the apple,display-power node), so the image holds it stopped by Linux, and keep it stopped through the image write, as amdgpu's .thaw does: .thaw brings it back only when the hibernation failed (pm_hibernate_is_recovering()) or the machine suspends instead (pm_hibernation_mode_is_suspend()), and PM_POST_HIBERNATION does when this kernel goes on after anything else. The firmware then is in exactly the state the image describes: - a .restore by the kernel that wrote the image (test_resume), or after a failed power-off, takes the sleep's warm return; - a .restore through a boot (pm_hibernate_restored_cold()) powers the domains and DARTs the same way, then gives the firmware the boot loader started the new handshake after PM_POST_HIBERNATION. A thaw that restarted the firmware for the image write left it in a newer session than the image: the restored kernel's warm return then crashed all three DCPs with ASSERT afk_messenger_common.c:67. The link release at hibernation prepare is not needed then, as the stop takes the external links down itself. Factor the host-side session drop into dcp_hib_drop_session() for both restore paths. Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit 223277a)
A test_resume load restores the image in the kernel that wrote it: the SoC was not powered down and the PHY, its coprocessor and the DP and USB sides its consumers kept are as the image records them. Resetting that state, as after a resume through a boot, made the DP side of a Type-C display look down while the display controller still held it, and the next mode set of that display failed. Only reset the state, and the coprocessor's RTKit session, when pm_hibernate_restored_cold() says the restore went through a boot (or cannot tell), as a resume from a sleep does only after the firmware took the SoC down (pm_resume_via_firmware()). Signed-off-by: fbalazsy <frantisekbalazsy@gmail.com> (cherry picked from commit 2786460)
|
@RyanTheTide Done: |
Conflict in drivers/soc/apple/sep.rs: keep the branch's hibernation endpoint fields (hibe_rx, hibe_wq, hibernating, sep_unusable) and take main's /dev/sep-pnon fields (pnon_serial, pnon_dev, pnon_open, pnon_txn, pnon_signed, pnon_owner).
|
@RyanTheTide Done: |
|
Merge-up check at |
|
@RyanTheTide Thanks for the merge-up check. Agreed on the follow-up: |
|
@RyanTheTide Hardware row at
|
Two files conflicted, both only because each side added code at the same spot; both sides are kept unchanged. drivers/gpu/drm/apple/dcp.c: this branch adds dcp_coproc_assert_run() after dcp_ext26_start_resident() and main adds dcp_read_notch() there (M4 notch rows). Both functions are kept, one after the other. Main's no_fw27_panel_pq flag in the T6030 hardware data merged cleanly into the table's new place on this branch. tools/testing/selftests/drivers/gpu/apple-dcp/boot.py: the test's apple_dcp_hw_data stub gains ready_timeout_ms here and no_fw27_panel_pq on main; both fields are kept. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Forward-merge of current main (3ee509d) into this branch. New head: 1d642b9 (plain merge commit, no rebase, normal fast-forward push). Two files conflicted. In both, each side had added code at the same spot, and both sides are kept unchanged:
Checks run on 1d642b9:
Hardware row: the J616s row at ebfde65 does not carry over. Of the files this PR changes against main, 18 also changed in this merge (git diff ebfde65 1d642b9). They include drivers/gpu/drm/apple/{dcp.c,dcp-internal.h,dptxep.c,iomfb.c}, drivers/gpu/drm/asahi/{g16/sleep.rs,g17/mod.rs,g17/port.rs,g17/queue/render.rs,g17/runtime.rs}, drivers/soc/apple/{sep.rs,mcc.c,diag_shim.c,shim.h}, include/linux/soc/apple/dart.h, drivers/pmdomain/apple/pmp-report.c and brcmfmac/pcie.c. A new J616s hibernation row at 1d642b9 is needed. |
a9e2f46 ("soc: apple-sep: Start the diag attach and ready times again at each bind") resets attach_ns and ready_ns with atomic64_set(), but the host shim in test_diag_sensor.py only defines atomic64_read and atomic64_cmpxchg, so the hosted SEP source diagnostics fail to compile diag_shim.c. Add atomic64_set next to atomic64_read. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Pushed |
|
@fbalazsy This branch now conflicts with
Could you forward-merge |
Three conflicts with main f02bd68: - include/linux/soc/apple/rtkit.h: keep main's IOReport size/snapshot declarations and this branch's buffer description, readopt and hibernation hand-off declarations. - sound/soc/codecs/cs42l84.c: main gates the codec power-down on a firmware sleep or suspend-to-idle; this branch splits the power-down into cs42l84_power_down() (also used for hibernation freeze/poweroff) behind a cs42l84_suspend() gate. Move main's eligibility check into that gate so system sleep follows main and hibernation always powers the codec down. - tools/asahi/bcm4377-resume-tests.py: extract both main's bcm4377_check_sleep_rom and this branch's __bcm4377_suspend. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Merged
Checks run: |
Conflicts resolved: - drivers/bluetooth/hci_bcm4377.c: keep main's post-sleep firmware boot guard in bcm4377_hci_reset() and pass the branch's failure flag to bcm4377_queue_rebind() there and in bcm4377_power_lost_work(). - drivers/gpu/drm/asahi/g17/initdata.rs: keep main's firmware-only protections (FS/FP) on the descriptor stamp pages together with the branch's fixed_kept() backing allocation. - tools/testing/selftests/drivers/apple/bcm4377-state-wait.py: keep both bt_dev_info() (hibernation rebind) and bt_dev_warn() (post-sleep boot timeout).
- accel/ane: move ane_fw_cold_sleep_event() to ane_fw_sleep.h taking a sleep_warm boolean so ane_fw_cold_test.c compiles as a standalone KUnit module without needing private backend definitions. - drm/apple/dcp: move DCP_S2R_PLUG_MS outside #ifdef CONFIG_HIBERNATION so dcp_ext_link_work() compiles under KUnit configs without CONFIG_HIBERNATION. - iommu/apple-dart: pass the adopt flag (false) in apple-dart-test.c calls to apple_dart_hw_sync_locked() and guard apple_dart_hib_defer_reimport() under #ifdef CONFIG_HIBERNATION. - drm/asahi: guard data.g16 in for_each_backend() under #[cfg(CONFIG_DRM_ASAHI_G16)], and drop the unused shared argument from publish_compute_shared() after main removed the compute pool backing. - rust/helpers/suspend.c: provide rust_helper_pm_hibernate_is_restored() under #ifndef CONFIG_HIBERNATION so aop.rs compiles when hibernation is disabled.
|
Merged current Merge conflicts resolved (
KUnit and build fixes (
Local verification at
A fresh J616s hibernation hardware row at |
What: hibernation (suspend-to-disk) on the T6040 (M4 Pro, J616s), on top of the suspend-to-RAM work in #2215 (merged in): the PM core and arm64 restore path, a reset backstop the platform provides for the time the machine is off, and the Apple co-processors, display, GPU, radios and USB brought back after a restore. Current
mainis merged in.Tested: J616s (T6040) at
c06cbf3db847(one cycle after the fourthmainmerge: rc 0, 40.9 s, compositor kept, three displays back, no oops),e5528b627c5b(rc 0, 40.7 s),c80d78247f3d,ee3faca0f8c0and1c1f3522ce39(same tree but the last commit),8d5d52f55c0d(two cycles in a row) and5f4a9facdab3, Stage 2 from aurora-silicon/aura#653 at32ad0c30andf3e85867with this head's DTB, a full power-off cycle (systemctl hibernate, power-off, cold boot, image load): the restore completed (rc 0, 37.9 s from the hibernate call to the restored desktop), the backstop disarmed after the restore and the normal watchdog running, no oops, the SIO firmware booted again (DP and HDMI audio play), OpenGL renders, Wi-Fi, wired network, Bluetooth and the three displays (panel, HDMI, DP over Type-C) back, USB camera frames before and after. The SIO and r8152 changes were also run at the head before the history cleanup (same tree for them). Builds without new warnings,checkpatch.pl --strictclean on the kernel commits,dt_binding_checkanddtbs_checkclean for the watchdog binding and the T604x boards, the host tests fail only wheremainfails on the same toolchain.Risk: one-way (adds DT bindings and properties) · M4 Pro; the shared parts (PM core hibernation, arm64 hibernate, RTKit, DART, DCP, SIO, GPU, brcmfmac, hci_bcm4377, xhci, the Apple watchdog) run on all Macs. The Apple watchdog's T6041/T6050/T8142 match-data fallback for the reconfig and deadline registers is gone: they now come only from the DT, so a DT without them keeps the old watchdog behaviour and has no hibernation backstop. The SIO firmware comes back after a restore only when the boot that loads the image did not bind the SIO (it has no users there); otherwise the SIO stays off until the next boot, with one warning.
Not yet:
Details
PM core / arm64.
get_safe_page()trampoline);PM: hibernate: take the reset backstop from the platform: a platform driver registers arm/disarm callbacks for a reset backstop that covers the power-off and the image load; arming failures are logged and the hibernation continues;test_resumeclears a latched wakeup before the restore and frees the image's swap pages when a restore fails;Watchdog (restore backstop). The Apple watchdog provides the backstop: before the image is written it programs the SMC AP deadline (150 s), which resets the machine if the restored kernel never comes back, and disarms it after the restore. The reconfig and deadline registers are described in the DT (
reg-names"reconfig" and "deadline" inapple,wdt, set int604x.dtsi) instead of per-SoC match data; the deadline is used only with the reconfig register present. The backstop is kept running only across.freeze/.poweroff; a suspend-to-RAM stops the watchdog as before.Apple SoC. A fixed boot layout under aura (DT binding
aura,hibernate); RTKit sessions handed over or re-adopted after a resume; PMP, DART locked roots, SMC, macsmc-reboot, RTC, cpufreq, ANS NVMe, ANE, AOP (started again after a resume from disk).Display (DCP). DRM state suspended for hibernation, in-place firmware restart, bounded retrains, T604x displays taken down for hibernation, PHY state kept in a restore without power loss; a DCP's DART restore is deferred to its firmware restart.
GPU and SIO. The GPU firmware is started again by the restored kernel. On T6040 (
hib_keep_clients) the client VMs carry over that cold boot: only the firmware-side context slots and queue records are dropped, and each queue is rebuilt on its VM, with its originalQUEUE_CREATEarguments, before its next submit. Running clients such as the compositor carry on without seeing a lost device. Other SoCs still report a lost device. The SIO firmware boots after a restore only when the boot loader staged it and left it halted: a firmware that the loading kernel started does not take a second boot, so that kernel idles it before the jump and leaves its run bit set, and the restored kernel then leaves the SIO off. The kernel-window tables are copied in one pass after the restore.Camera (ISP). A firmware that can restart (
apple,dapf-rangeson its DART) is no longer marked dead by hibernation; the text CRC of the resident firmware is recorded at the freeze and the restore starts it again unless the loading boot left different firmware text there.Sleep after a restore. aura's S2R mailbox moves with the boot object on every boot; after a resume from disk the sleep driver takes the running boot's mailbox from aura's DT, or refuses deep sleep until the next boot.
Radios and USB. brcmfmac PCIe keeps the D3 handshake on freeze and probes the chip again on restore; hci_bcm4377 quiesces and rebinds; r8152 stops resubmitting rx on
-ESHUTDOWN; xhci skips the ep0 max-packet check while a slot is only enabled (theinvalid context state for evaluate context commandWARN on every restore is gone).Merges of
main.mainis merged in four times. The second merge had one conflict, in the display26 host test, where both sides' new assertions are kept. The third had conflicts in clk-apple-nco (the hibernation save/restore now uses main's register helpers), tas2764, hci_bcm4377, DCP, asahi mmu/pgtable and three host tests, all keeping both sides. The fourth had one conflict, in the g17 init data build, where the branch's split of the graph build is kept and main's coarse base OPP flag fromactive_effort()is taken.Since the last push.
dmaengine: apple-sio: boot the firmware after a restore only if staged(see above);net: usb: r8152: treat -ESHUTDOWN like -ENODEV on tx and interrupt resubmission: no morefailed tx_urb -108andcan't resubmit intrfloods when the hosts stop for the image;usb: hub: stop resetting a port once its host controller is gone(nocannot reset (err = -108)bursts when the hosts stop for the image);HID: dockchannel: resynchronise the receive ring after a restore from disk(noReceive ring failed: -71after a restore).Known. Touch ID matching is unavailable after a restore as after any cold boot on this branch (it is not a hibernation change). A UAS disk on a Type-C port logs
Synchronize Cache(10) failed: ... DID_ERROR(info level) when the hosts stop for the image, as for a cable unplug of that disk.This series includes #2215 and the commits from #1664 by @AxxzyWasTaken and the PHY commit by @RyanTheTide that #2215 carries, with their original authorship.
Evidence (earlier rows,
test_resume).test_resumetest_resumeafter S2R (with the CTXR fix)8e9af804)test_resume(6cf6a028)test_resume(6cf6a028)test_resume, S2R 5/5,test_resumeagain (718c3ceb)