]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
platform/x86: amd-pmc: Fix S0i3 wakeup with alarmtimer
authorMario Limonciello <mario.limonciello@amd.com>
Thu, 21 May 2026 04:37:14 +0000 (23:37 -0500)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Thu, 25 Jun 2026 12:42:54 +0000 (14:42 +0200)
commitf7ecfc3fe5753d10e9c4d0d7955c160ea8cbf0ea
tree0274d756e195f3e709cd28a0195c4d478077d5b3
parent50ccdc31010ed623e68e496aebd4b1d3d8430664
platform/x86: amd-pmc: Fix S0i3 wakeup with alarmtimer

It was reported that suspend-then-hibernate stopped working with modern
systemd versions on AMD Cezanne systems. The reason for this breakage
was because systemd switched to using alarmtimer instead of the wakealarm
sysfs file.

On AMD Cezanne systems, amd_pmc_verify_czn_rtc() programs a secondary
timer with the alarm time. This was introduced by
commit 59348401ebed ("platform/x86: amd-pmc: Add special handling for
timer based S0i3 wakeup"). However, this function uses rtc_read_alarm(),
which only reads the aie_timer, not the next expiring timer from the
timerqueue.

When both alarmtimer and wakealarm are active, the first expiring timer
might be the alarmtimer, but amd_pmc_verify_czn_rtc() would only see
the aie_timer, potentially missing the earlier alarm.

Switch to rtc_read_next_alarm() to read whichever timer will fire next.
Also handle -ENOENT (no alarm pending) explicitly as a non-error case.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3591
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://patch.msgid.link/20260521043714.1022930-3-mario.limonciello@amd.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/platform/x86/amd/pmc/pmc.c