All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>,
	linux-acpi@vger.kernel.org
Cc: Julian Sikorski <belegdol@gmail.com>,
	teohhanhui@gmail.com, Shyam-sundar.S-k@amd.com,
	Mario Limonciello <mario.limonciello@amd.com>
Subject: [PATCH 5/5] ACPI: PM: Adjust behavior for field problems on AMD systems
Date: Thu, 17 Jun 2021 11:42:12 -0500	[thread overview]
Message-ID: <20210617164212.584-5-mario.limonciello@amd.com> (raw)
In-Reply-To: <20210617164212.584-1-mario.limonciello@amd.com>

Some AMD Systems with uPEP _HID AMD004/AMDI005 have an off by one bug
in their function mask return.  This means that they will call entrance
but not exit for matching functions.

Other AMD systems with this HID should use the Microsoft generic UUID.

AMD systems with uPEP HID AMDI006 should be using the Microsoft method.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/acpi/x86/s2idle.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
index 3f2a90648ec9..816bf2c34b7a 100644
--- a/drivers/acpi/x86/s2idle.c
+++ b/drivers/acpi/x86/s2idle.c
@@ -371,12 +371,27 @@ static int lps0_device_attach(struct acpi_device *adev,
 		return 0;
 
 	if (acpi_s2idle_vendor_amd()) {
+		/* AMD0004, AMDI0005:
+		 * - Should use rev_id 0x0
+		 * - function mask > 0x3: Should use AMD method, but has off by one bug
+		 * - function mask = 0x3: Should use Microsoft method
+		 * AMDI0006:
+		 * - should use rev_id 0x0
+		 * - function mask = 0x3: Should use Microsoft method
+		 */
+		const char *hid = acpi_device_hid(adev);
 		rev_id = 0;
 		lps0_dsm_func_mask = validate_dsm(adev->handle,
 					ACPI_LPS0_DSM_UUID_AMD, rev_id, &lps0_dsm_guid);
 		lps0_dsm_func_mask_microsoft = validate_dsm(adev->handle,
 					ACPI_LPS0_DSM_UUID_MICROSOFT, rev_id,
 					&lps0_dsm_guid_microsoft);
+		if (lps0_dsm_func_mask > 0x3 && (!strcmp(hid, "AMD0004") ||
+						 !strcmp(hid, "AMDI0005"))) {
+			lps0_dsm_func_mask = (lps0_dsm_func_mask << 1) | 0x1;
+			acpi_handle_debug(adev->handle, "_DSM UUID %s: Adjusted function mask: 0x%x\n",
+					  ACPI_LPS0_DSM_UUID_AMD, lps0_dsm_func_mask);
+		}
 	} else {
 		rev_id = 1;
 		lps0_dsm_func_mask = validate_dsm(adev->handle,
-- 
2.25.1


  parent reply	other threads:[~2021-06-17 16:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17 16:42 [PATCH 1/5] ACPI: PM: s2idle: Use correct revision id Mario Limonciello
2021-06-17 16:42 ` [PATCH 2/5] ACPI: PM: s2idle: Refactor common code Mario Limonciello
2021-06-17 18:28   ` Julian Sikorski
2021-06-17 16:42 ` [PATCH 3/5] ACPI: PM: s2idle: Add support for multiple func mask Mario Limonciello
2021-06-17 18:28   ` Julian Sikorski
2021-06-18 16:30   ` Rafael J. Wysocki
2021-06-18 16:34     ` Limonciello, Mario
2021-06-18 16:41       ` Rafael J. Wysocki
2021-06-17 16:42 ` [PATCH 4/5] ACPI: PM: s2idle: Add support for new Microsoft UUID Mario Limonciello
2021-06-17 18:28   ` Julian Sikorski
2021-06-17 16:42 ` Mario Limonciello [this message]
2021-06-17 18:28   ` [PATCH 5/5] ACPI: PM: Adjust behavior for field problems on AMD systems Julian Sikorski
2021-06-18  8:05   ` Kai-Heng Feng
2021-06-17 18:28 ` [PATCH 1/5] ACPI: PM: s2idle: Use correct revision id Julian Sikorski

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=20210617164212.584-5-mario.limonciello@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=belegdol@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=teohhanhui@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.