diff options
| author | Aymeric Wibo <obiwac@FreeBSD.org> | 2026-09-14 18:14:54 +0000 |
|---|---|---|
| committer | Aymeric Wibo <obiwac@FreeBSD.org> | 2026-09-16 16:21:41 +0000 |
| commit | 5f68acc931a4814c4ee46124aaa5afff22402f61 (patch) | |
| tree | 7787b4df64f1bc67c3c1805b7a4906e6580ed9f5 | |
| parent | c6728cf5850da500af177b2bb326dc29a32fc450 (diff) | |
acpi: Warn if no amdsmu(4) loaded after suspend-to-idle resume
If amdsmu(4) is not loaded when entering suspend-to-idle and on an AMD
CPU, emit a warning.
FreeBSD currently only supports S0ix on AMD CPUs through the SMU. When
Intel support is completed, we should check the equivalent for Intel
(intelpmc).
Reviewed by: olce
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D59672
| -rw-r--r-- | sys/dev/acpica/acpi.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 7f9e637c25f9..33d4572b1d2e 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -3660,6 +3660,36 @@ do_idle(struct acpi_softc *sc, enum acpi_sleep_state *slp_state, } #endif +static void +check_post_suspend_to_idle(device_t dev) +{ + devclass_t dc; +#if defined(__x86_64__) + u_int vendor_id = cpu_vendor_id; +#else + u_int vendor_id = 0; +#endif + + switch (vendor_id) { + case CPU_VENDOR_AMD: + case CPU_VENDOR_HYGON: + dc = devclass_find("amdsmu"); + + if (dc != NULL && devclass_get_count(dc) > 0) + break; + device_printf(dev, + "Resumed from suspend-to-idle on AMD processor but " + "amdsmu(4) is not attached; unable to verify S0i3 entry. " + "It is unlikely the system entered a deep sleep state.\n"); + break; + default: + device_printf(dev, + "Resumed from suspend-to-idle on a processor FreeBSD does " + "not yet support for this. It is unlikely the system " + "entered a deep sleep state.\n"); + } +} + /* * Enter the desired system sleep state. * @@ -3836,6 +3866,9 @@ backout: EVENTHANDLER_INVOKE(power_resume, stype); + if (stype == POWER_STYPE_SUSPEND_TO_IDLE) + check_post_suspend_to_idle(sc->acpi_dev); + /* Allow another sleep request after a while. */ callout_schedule(&acpi_sleep_timer, hz * ACPI_MINIMUM_AWAKETIME); |
