On Thu, Apr 09, 2026 at 08:02:29AM -0700, Mike Larkin wrote:

Hello Mike,

> Can you try this diff and see if it fixes things?

This seems to have fixed my issues on a desktop AMD machine, which
hasn't suspended successfully once for at least 2 or 3 weeks -- thanks!
Your patch didn't quite apply cleanly to -current though: I manually
ended up with the version at the end of this email FWIW.

I will keep testing this over the next day or two; if there are any
issues I will update this thread.


Laurie


diff --git sys/arch/amd64/amd64/acpi_machdep.c 
sys/arch/amd64/amd64/acpi_machdep.c
index 6e1f3363f5c..3f421ced0c9 100644
--- sys/arch/amd64/amd64/acpi_machdep.c
+++ sys/arch/amd64/amd64/acpi_machdep.c
@@ -476,12 +476,11 @@ acpi_sleep_cpu(struct acpi_softc *sc, int state)
 void
 acpi_resume_cpu(struct acpi_softc *sc, int state)
 {
-       if (sc->sc_fadt->flags & FADT_USE_PLATFORM_CLOCK) {
-               if (rtcalarm_fired())
-                       sc->sc_wakegpe = WAKEGPE_RTC;
-       }
-
        if (state == ACPI_STATE_S0) {
+               if (sc->sc_fadt->flags & FADT_USE_PLATFORM_CLOCK) {
+                       if (rtcalarm_fired())
+                               sc->sc_wakegpe = WAKEGPE_RTC;
+               }
                rtcalarm_resume();
                return;
        }
@@ -504,7 +503,6 @@ acpi_resume_cpu(struct acpi_softc *sc, int state)
 #endif
 
        i8254_startclock();
-       rtcalarm_resume();              /* i8254 must be running */
        if (initclock_func == i8254_initclocks)
                rtcstart();             /* in i8254 mode, rtc is profclock */
 
@@ -518,6 +516,12 @@ acpi_resume_cpu(struct acpi_softc *sc, int state)
        /* Re-initialise memory range handling on BSP */
        if (mem_range_softc.mr_op != NULL)
                mem_range_softc.mr_op->initAP(&mem_range_softc);
+
+       if (sc->sc_fadt->flags & FADT_USE_PLATFORM_CLOCK) {
+               if (rtcalarm_fired())
+                       sc->sc_wakegpe = WAKEGPE_RTC;
+       }
+       rtcalarm_resume();
 }
 
 #ifdef MULTIPROCESSOR

Reply via email to