Page MenuHomeFreeBSD

acpi: Suspend-to-idle support (S0i)
AbandonedPublic

Authored by obiwac_gmail.com on Wed, Jan 29, 8:53 PM.

Details

Reviewers
None
Summary

Borrow the idea to abstract over ACPI Sx sleep types with enum sleep_type from Ben's s2idle patch, D17675, but use this everywhere it makes sense to.

Also factor out do_standby, do_sleep, and do_idle (new) routines.

I decided against going with the name "s2idle" as I'm afraid users might confuse this with the S2 standby state, when in reality the system stays in S0 but idles the CPU. So I think S0i is a better name.

I will end up breaking this patch up into:

  • A patch which serves only to replace all the uses of ACPI S-states with enum sleep_type.
  • A patch which actually implements suspend-to-idle on top of that.
  • A patch which calls the SPMC hooks before/after idling, with D48387 and the suspend-to-idle patch as parents.
Test Plan

I have tested this on the Framework 13 AMD Ryzen 7040 series (Phoenix). Because of spurious interrupts, it exits the suspended-to-idle state every minute or so even with the SPMC notifications and AMD SMU hints. A follow up patch will be needed to implement a suspend-to-idle loop, which immediately idles the CPU again if the interrupt reason was not a wake event.

With this patch:

% sysctl hw.acpi.supported_sleep_state
hw.acpi.supported_sleep_state: S4 S5 S0i

To test this out, you can set a press of the power button to suspend to idle e.g.:

% sysctl hw.acpi.power_button_state=S0i
hw.acpi.power_button_state: S5 -> S0i

Diff Detail

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