On some OEM platforms a BIOS option is offered that will set the sleep mode between S3 and S2idle. This option will change certain HW behaviors. When in S2idle mode, Linux works properly. However when S3 mode is picked but the user chooses S2idle in Linux the platform may not be properly resumed. To avoid users getting into this situation, don't offer s2idle on AMD systems missing the LPS0 device either by a BIOS option or by using the acpi "no_sleep_lps0" module parameter. Reported-by: Bjoren Dasse <bjoern.daase@xxxxxxxxx> BugLink: https://gitlab.freedesktop.org/drm/amd/-/issues/1824 BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=215387 Reviewed-by: Basavaraj Natikar <Basavaraj.Natikar@xxxxxxx> Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx> --- drivers/acpi/x86/s2idle.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c index a1626737e5e0..c3d35a42ac2f 100644 --- a/drivers/acpi/x86/s2idle.c +++ b/drivers/acpi/x86/s2idle.c @@ -363,6 +363,13 @@ static int validate_dsm(acpi_handle handle, const char *uuid, int rev, guid_t *d static bool acpi_s2idle_valid(void) { + /* AMD systems must have low level firmware support */ + if (acpi_s2idle_vendor_amd()) +#if IS_ENABLED(CONFIG_AMD_PMC) + return lps0_device_handle && !sleep_no_lps0; +#else + return false; +#endif return true; } @@ -450,6 +457,9 @@ static int lps0_device_attach(struct acpi_device *adev, if (!acpi_s2idle_vendor_amd()) acpi_ec_mark_gpe_for_wake(); + /* reset these so we update valid */ + s2idle_set_ops(&acpi_s2idle_ops_lps0); + return 0; } -- 2.25.1