linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: "Rafael J . Wysocki" <rjw@rjwysocki.net>, <linux-acpi@vger.kernel.org>
Cc: <Shyam-sundar.S-k@amd.com>,
	Basavaraj Natikar <Basavaraj.Natikar@amd.com>,
	Mario Limonciello <mario.limonciello@amd.com>,
	Bjoren Dasse <bjoern.daase@gmail.com>
Subject: [PATCH 3/3] acpi: sleep: Don't offer s2idle on AMD platforms without LPS0
Date: Wed, 5 Jan 2022 13:39:10 -0600	[thread overview]
Message-ID: <20220105193910.25678-4-mario.limonciello@amd.com> (raw)
In-Reply-To: <20220105193910.25678-1-mario.limonciello@amd.com>

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@gmail.com>
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@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 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


  parent reply	other threads:[~2022-01-05 19:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-05 19:39 [PATCH 0/3] On AMD platforms only offer s2idle w/ proper FW Mario Limonciello
2022-01-05 19:39 ` [PATCH 1/3] PM: suspend: Move some structure declarations around Mario Limonciello
2022-01-05 19:39 ` [PATCH 2/3] PM: sleep: Don't always assume s2idle will be enabled Mario Limonciello
2022-01-05 19:39 ` Mario Limonciello [this message]
2022-01-11 15:52 ` [PATCH 0/3] On AMD platforms only offer s2idle w/ proper FW Rafael J. Wysocki
2022-01-11 16:23   ` Limonciello, Mario
2022-01-11 17:05     ` Rafael J. Wysocki
2022-01-11 17:32       ` Limonciello, Mario
2022-01-11 17:32       ` Deucher, Alexander
2022-01-11 17:44         ` Rafael J. Wysocki
2022-01-11 18:30           ` Deucher, Alexander
2022-01-11 18:36             ` Limonciello, Mario
2022-01-11 19:20               ` Rafael J. Wysocki
2022-01-11 19:35                 ` Limonciello, Mario
2022-01-11 19:48                   ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220105193910.25678-4-mario.limonciello@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=Basavaraj.Natikar@amd.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=bjoern.daase@gmail.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).