]> git.proxmox.com Git - pve-kernel.git/blame - patches/kernel/0022-ACPI-x86-s2idle-Stop-using-AMD-specific-codepath-for.patch
backport some fixes-fixes from v6.1.4
[pve-kernel.git] / patches / kernel / 0022-ACPI-x86-s2idle-Stop-using-AMD-specific-codepath-for.patch
CommitLineData
4d1db308
TL
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Mario Limonciello <mario.limonciello@amd.com>
3Date: Thu, 15 Dec 2022 13:16:16 -0600
4Subject: [PATCH] ACPI: x86: s2idle: Stop using AMD specific codepath for
5 Rembrandt+
6
7commit e555c85792bd5f9828a2fd2ca9761f70efb1c77b upstream.
8
9After we introduced a module parameter and quirk infrastructure for
10picking the Microsoft GUID over the SOC vendor GUID we discovered
11that lots and lots of systems are getting this wrong.
12
13The table continues to grow, and is becoming unwieldy.
14
15We don't really have any benefit to forcing vendors to populate the
16AMD GUID. This is just extra work, and more and more vendors seem
17to mess it up. As the Microsoft GUID is used by Windows as well,
18it's very likely that it won't be messed up like this.
19
20So drop all the quirks forcing it and the Rembrandt behavior. This
21means that Cezanne or later effectively only run the Microsoft GUID
22codepath with the exception of HP Elitebook 8*5 G9.
23
24Fixes: fd894f05cf30 ("ACPI: x86: s2idle: If a new AMD _HID is missing assume Rembrandt")
25Cc: stable@vger.kernel.org # 6.1
26Reported-by: Benjamin Cheng <ben@bcheng.me>
27Reported-by: bilkow@tutanota.com
28Reported-by: Paul <paul@zogpog.com>
29Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2292
30Link: https://bugzilla.kernel.org/show_bug.cgi?id=216768
31Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
32Reviewed-by: Philipp Zabel <philipp.zabel@gmail.com>
33Tested-by: Philipp Zabel <philipp.zabel@gmail.com>
34Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
35Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
36(cherry picked from commit e6d180a35bc0efd614b0df45f92a08550143555d)
37Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
38---
39 drivers/acpi/x86/s2idle.c | 87 ++-------------------------------------
40 1 file changed, 3 insertions(+), 84 deletions(-)
41
42diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
43index 422415cb14f4..c7afce465a07 100644
44--- a/drivers/acpi/x86/s2idle.c
45+++ b/drivers/acpi/x86/s2idle.c
46@@ -28,10 +28,6 @@ static bool sleep_no_lps0 __read_mostly;
47 module_param(sleep_no_lps0, bool, 0644);
48 MODULE_PARM_DESC(sleep_no_lps0, "Do not use the special LPS0 device interface");
49
50-static bool prefer_microsoft_dsm_guid __read_mostly;
51-module_param(prefer_microsoft_dsm_guid, bool, 0644);
52-MODULE_PARM_DESC(prefer_microsoft_dsm_guid, "Prefer using Microsoft GUID in LPS0 device _DSM evaluation");
53-
54 static const struct acpi_device_id lps0_device_ids[] = {
55 {"PNP0D80", },
56 {"", },
57@@ -369,27 +365,15 @@ static int validate_dsm(acpi_handle handle, const char *uuid, int rev, guid_t *d
58 }
59
60 struct amd_lps0_hid_device_data {
61- const unsigned int rev_id;
62 const bool check_off_by_one;
63- const bool prefer_amd_guid;
64 };
65
66 static const struct amd_lps0_hid_device_data amd_picasso = {
67- .rev_id = 0,
68 .check_off_by_one = true,
69- .prefer_amd_guid = false,
70 };
71
72 static const struct amd_lps0_hid_device_data amd_cezanne = {
73- .rev_id = 0,
74 .check_off_by_one = false,
75- .prefer_amd_guid = false,
76-};
77-
78-static const struct amd_lps0_hid_device_data amd_rembrandt = {
79- .rev_id = 2,
80- .check_off_by_one = false,
81- .prefer_amd_guid = true,
82 };
83
84 static const struct acpi_device_id amd_hid_ids[] = {
85@@ -397,7 +381,6 @@ static const struct acpi_device_id amd_hid_ids[] = {
86 {"AMD0005", (kernel_ulong_t)&amd_picasso, },
87 {"AMDI0005", (kernel_ulong_t)&amd_picasso, },
88 {"AMDI0006", (kernel_ulong_t)&amd_cezanne, },
89- {"AMDI0007", (kernel_ulong_t)&amd_rembrandt, },
90 {}
91 };
92
93@@ -407,68 +390,7 @@ static int lps0_prefer_amd(const struct dmi_system_id *id)
94 rev_id = 2;
95 return 0;
96 }
97-
98-static int lps0_prefer_microsoft(const struct dmi_system_id *id)
99-{
100- pr_debug("Preferring Microsoft GUID.\n");
101- prefer_microsoft_dsm_guid = true;
102- return 0;
103-}
104-
105 static const struct dmi_system_id s2idle_dmi_table[] __initconst = {
106- {
107- /*
108- * ASUS TUF Gaming A17 FA707RE
109- * https://bugzilla.kernel.org/show_bug.cgi?id=216101
110- */
111- .callback = lps0_prefer_microsoft,
112- .matches = {
113- DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
114- DMI_MATCH(DMI_PRODUCT_NAME, "ASUS TUF Gaming A17"),
115- },
116- },
117- {
118- /* ASUS ROG Zephyrus G14 (2022) */
119- .callback = lps0_prefer_microsoft,
120- .matches = {
121- DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
122- DMI_MATCH(DMI_PRODUCT_NAME, "ROG Zephyrus G14 GA402"),
123- },
124- },
125- {
126- /*
127- * Lenovo Yoga Slim 7 Pro X 14ARH7
128- * https://bugzilla.kernel.org/show_bug.cgi?id=216473 : 82V2
129- * https://bugzilla.kernel.org/show_bug.cgi?id=216438 : 82TL
130- */
131- .callback = lps0_prefer_microsoft,
132- .matches = {
133- DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
134- DMI_MATCH(DMI_PRODUCT_NAME, "82"),
135- },
136- },
137- {
138- /*
139- * ASUSTeK COMPUTER INC. ROG Flow X13 GV301RE_GV301RE
140- * https://gitlab.freedesktop.org/drm/amd/-/issues/2148
141- */
142- .callback = lps0_prefer_microsoft,
143- .matches = {
144- DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
145- DMI_MATCH(DMI_PRODUCT_NAME, "ROG Flow X13 GV301"),
146- },
147- },
148- {
149- /*
150- * ASUSTeK COMPUTER INC. ROG Flow X16 GV601RW_GV601RW
151- * https://gitlab.freedesktop.org/drm/amd/-/issues/2148
152- */
153- .callback = lps0_prefer_microsoft,
154- .matches = {
155- DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
156- DMI_MATCH(DMI_PRODUCT_NAME, "ROG Flow X16 GV601"),
157- },
158- },
159 {
160 /*
161 * AMD Rembrandt based HP EliteBook 835/845/865 G9
162@@ -504,16 +426,14 @@ static int lps0_device_attach(struct acpi_device *adev,
163 if (dev_id->id[0])
164 data = (const struct amd_lps0_hid_device_data *) dev_id->driver_data;
165 else
166- data = &amd_rembrandt;
167- rev_id = data->rev_id;
168+ data = &amd_cezanne;
169 lps0_dsm_func_mask = validate_dsm(adev->handle,
170 ACPI_LPS0_DSM_UUID_AMD, rev_id, &lps0_dsm_guid);
171 if (lps0_dsm_func_mask > 0x3 && data->check_off_by_one) {
172 lps0_dsm_func_mask = (lps0_dsm_func_mask << 1) | 0x1;
173 acpi_handle_debug(adev->handle, "_DSM UUID %s: Adjusted function mask: 0x%x\n",
174 ACPI_LPS0_DSM_UUID_AMD, lps0_dsm_func_mask);
175- } else if (lps0_dsm_func_mask_microsoft > 0 && data->prefer_amd_guid &&
176- !prefer_microsoft_dsm_guid) {
177+ } else if (lps0_dsm_func_mask_microsoft > 0 && rev_id) {
178 lps0_dsm_func_mask_microsoft = -EINVAL;
179 acpi_handle_debug(adev->handle, "_DSM Using AMD method\n");
180 }
181@@ -521,8 +441,7 @@ static int lps0_device_attach(struct acpi_device *adev,
182 rev_id = 1;
183 lps0_dsm_func_mask = validate_dsm(adev->handle,
184 ACPI_LPS0_DSM_UUID, rev_id, &lps0_dsm_guid);
185- if (!prefer_microsoft_dsm_guid)
186- lps0_dsm_func_mask_microsoft = -EINVAL;
187+ lps0_dsm_func_mask_microsoft = -EINVAL;
188 }
189
190 if (lps0_dsm_func_mask < 0 && lps0_dsm_func_mask_microsoft < 0)