Index | Thread | Search

From:
Mike Larkin <mlarkin@nested.page>
Subject:
Re: suspend/resume fix
To:
Mark Kettenis <mark.kettenis@xs4all.nl>
Cc:
tech@openbsd.org, laurie@tratt.net
Date:
Thu, 9 Apr 2026 16:45:36 -0700

Download raw body.

Thread
On Thu, Apr 09, 2026 at 08:44:14PM +0200, Mark Kettenis wrote:
> This is a reworked diff from mlarkin@ that should fix resume from S3
> on some machines where this got broken a few weeks ago.
>

ok mlarkin

>
> Index: arch/amd64/amd64/acpi_machdep.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/amd64/amd64/acpi_machdep.c,v
> diff -u -p -r1.114 acpi_machdep.c
> --- arch/amd64/amd64/acpi_machdep.c	15 Mar 2026 11:16:36 -0000	1.114
> +++ arch/amd64/amd64/acpi_machdep.c	9 Apr 2026 18:24:41 -0000
> @@ -476,15 +476,8 @@ acpi_sleep_cpu(struct acpi_softc *sc, in
>  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) {
> -		rtcalarm_resume();
> -		return;
> -	}
> +	if (state == ACPI_STATE_S0)
> +		goto rtc_check;
>
>  	cpu_init_msrs(&cpu_info_primary);
>  	cpu_fix_msrs(&cpu_info_primary);
> @@ -504,7 +497,6 @@ acpi_resume_cpu(struct acpi_softc *sc, i
>  #endif
>
>  	i8254_startclock();
> -	rtcalarm_resume();		/* i8254 must be running */
>  	if (initclock_func == i8254_initclocks)
>  		rtcstart();		/* in i8254 mode, rtc is profclock */
>
> @@ -518,6 +510,13 @@ acpi_resume_cpu(struct acpi_softc *sc, i
>  	/* Re-initialise memory range handling on BSP */
>  	if (mem_range_softc.mr_op != NULL)
>  		mem_range_softc.mr_op->initAP(&mem_range_softc);
> +
> +rtc_check:
> +	if (sc->sc_fadt->flags & FADT_USE_PLATFORM_CLOCK) {
> +		if (rtcalarm_fired())
> +			sc->sc_wakegpe = WAKEGPE_RTC;
> +	}
> +	rtcalarm_resume();
>  }
>
>  #ifdef MULTIPROCESSOR
>