Page MenuHomeFreeBSD

acpi: Forbid requesting S4 when S4BIOS is not supported
ClosedPublic

Authored by olce on Jun 3 2026, 4:54 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jul 9, 2:29 AM
Unknown Object (File)
Sun, Jul 5, 1:03 AM
Unknown Object (File)
Sat, Jul 4, 1:14 PM
Unknown Object (File)
Fri, Jul 3, 5:32 AM
Unknown Object (File)
Sun, Jun 21, 8:23 AM
Unknown Object (File)
Sun, Jun 21, 8:20 AM
Unknown Object (File)
Sat, Jun 20, 11:13 PM
Unknown Object (File)
Sat, Jun 20, 11:11 PM
Subscribers

Details

Summary

Pending the OS-supported hibernate functionality, prevent requesting S4
when S4BIOS is not supported.

To this end, make sure that acpi_supported_stypes[] indicates that
POWER_STYPE_FW_HIBERNATE is not supported if 'acpi_s4bios_supported' is
false, even if S4 is supported by the platform (which is only
a power-down-like state, without any support to save the system image by
itself). This will cause requests to enter S4, which are translated to
POWER_STYPE_FW_HIBERNATE before reaching
acpi_ReqSleepState()/acpi_EnterSleepState(), to fail in this case.

Retire the 'hw.acpi.s4bios' sysctl knob, as having it to 0 by default
(S4BIOS not supported) or setting it to 0 (default is 1 when S4BIOS is
supported) could only lead, on a S4 request, to a power down without any
possibility to restore the system (and, since a recent commit, it has
not been possible anymore to force it to 1 when S4BIOS is not announced
supported in the FACS table, which would cause a failure or a crash).

When OS-supported hibernate is introduced, it will become the default
hibernate method over S4BIOS, as we have not heard of any semi-recent
hardware platform implementing it (and when it is, it usually needs
a sufficiently large dedicated slice/partition, and does not use FreeBSD
swap slices/partitions). Then, for people still wanting to use S4BIOS
on older platforms that support it, the tentative plans are to modify
acpiconf(8) to accept '4BIOS' as an argument to '-s', or modify zzz(8)
so that one can pass a specific suspension method.

Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 73668
Build 70551: arc lint + arc unit

Event Timeline

olce requested review of this revision.Jun 3 2026, 4:54 PM
  • Remove remaining declaration for acpi_s4bios_sysctl() in acpi.c
  • Add a comment in the acpi_sleep_machdep() functions explaining why we are just testing on S4 state before calling AcpiEnterSleepStateS4bios().

my only concern with making S4 BIOS its own ACPI sleep state is that we won't really have a way of making the fw_hibernate sleep type map to it, and we might have to re-add a similar sysctl to s4bios

sys/dev/acpica/acpi.c
648–653

maybe update this comment to mention this is only until we have S4 non-bios support

olce marked an inline comment as done.Sat, Jun 20, 7:27 PM
olce added inline comments.
sys/dev/acpica/acpi.c
648–653

This is intended to stay as is. Actually, OS-initiated hibernate will be requested through POWER_STYPE_OS_HIBERNATE (which I have in some commit somewhere, for a later revision). As said above in the commit message, people using acpiconf -s 4 will get OS-initiated hibernate when it's released, and no more S4BIOS, which will have to be requested through acpiconf -s 4bios or zzz --something. Let's talk about it directly if that isn't clear (or if there's still a problem with or in this frame).

This revision is now accepted and ready to land.Mon, Jun 22, 1:38 PM
This revision was automatically updated to reflect the committed changes.
olce marked an inline comment as done.