ACPI: x86: s2idle: Stop using AMD specific codepath for Rembrandt+
authorMario Limonciello <mario.limonciello@amd.com>
Thu, 15 Dec 2022 19:16:16 +0000 (13:16 -0600)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 22 Dec 2022 16:39:31 +0000 (17:39 +0100)
After we introduced a module parameter and quirk infrastructure for
picking the Microsoft GUID over the SOC vendor GUID we discovered
that lots and lots of systems are getting this wrong.

The table continues to grow, and is becoming unwieldy.

We don't really have any benefit to forcing vendors to populate the
AMD GUID. This is just extra work, and more and more vendors seem
to mess it up.  As the Microsoft GUID is used by Windows as well,
it's very likely that it won't be messed up like this.

So drop all the quirks forcing it and the Rembrandt behavior. This
means that Cezanne or later effectively only run the Microsoft GUID
codepath with the exception of HP Elitebook 8*5 G9.

Fixes: fd894f05cf30 ("ACPI: x86: s2idle: If a new AMD _HID is missing assume Rembrandt")
Cc: stable@vger.kernel.org # 6.1
Reported-by: Benjamin Cheng <ben@bcheng.me>
Reported-by: bilkow@tutanota.com
Reported-by: Paul <paul@zogpog.com>
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2292
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216768
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Philipp Zabel <philipp.zabel@gmail.com>
Tested-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/x86/s2idle.c

index 422415c..c7afce4 100644 (file)
@@ -28,10 +28,6 @@ static bool sleep_no_lps0 __read_mostly;
 module_param(sleep_no_lps0, bool, 0644);
 MODULE_PARM_DESC(sleep_no_lps0, "Do not use the special LPS0 device interface");
 
-static bool prefer_microsoft_dsm_guid __read_mostly;
-module_param(prefer_microsoft_dsm_guid, bool, 0644);
-MODULE_PARM_DESC(prefer_microsoft_dsm_guid, "Prefer using Microsoft GUID in LPS0 device _DSM evaluation");
-
 static const struct acpi_device_id lps0_device_ids[] = {
        {"PNP0D80", },
        {"", },
@@ -369,27 +365,15 @@ out:
 }
 
 struct amd_lps0_hid_device_data {
-       const unsigned int rev_id;
        const bool check_off_by_one;
-       const bool prefer_amd_guid;
 };
 
 static const struct amd_lps0_hid_device_data amd_picasso = {
-       .rev_id = 0,
        .check_off_by_one = true,
-       .prefer_amd_guid = false,
 };
 
 static const struct amd_lps0_hid_device_data amd_cezanne = {
-       .rev_id = 0,
        .check_off_by_one = false,
-       .prefer_amd_guid = false,
-};
-
-static const struct amd_lps0_hid_device_data amd_rembrandt = {
-       .rev_id = 2,
-       .check_off_by_one = false,
-       .prefer_amd_guid = true,
 };
 
 static const struct acpi_device_id amd_hid_ids[] = {
@@ -397,7 +381,6 @@ static const struct acpi_device_id amd_hid_ids[] = {
        {"AMD0005",     (kernel_ulong_t)&amd_picasso,   },
        {"AMDI0005",    (kernel_ulong_t)&amd_picasso,   },
        {"AMDI0006",    (kernel_ulong_t)&amd_cezanne,   },
-       {"AMDI0007",    (kernel_ulong_t)&amd_rembrandt, },
        {}
 };
 
@@ -407,70 +390,9 @@ static int lps0_prefer_amd(const struct dmi_system_id *id)
        rev_id = 2;
        return 0;
 }
-
-static int lps0_prefer_microsoft(const struct dmi_system_id *id)
-{
-       pr_debug("Preferring Microsoft GUID.\n");
-       prefer_microsoft_dsm_guid = true;
-       return 0;
-}
-
 static const struct dmi_system_id s2idle_dmi_table[] __initconst = {
        {
                /*
-                * ASUS TUF Gaming A17 FA707RE
-                * https://bugzilla.kernel.org/show_bug.cgi?id=216101
-                */
-               .callback = lps0_prefer_microsoft,
-               .matches = {
-                       DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "ASUS TUF Gaming A17"),
-               },
-       },
-       {
-               /* ASUS ROG Zephyrus G14 (2022) */
-               .callback = lps0_prefer_microsoft,
-               .matches = {
-                       DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "ROG Zephyrus G14 GA402"),
-               },
-       },
-       {
-               /*
-                * Lenovo Yoga Slim 7 Pro X 14ARH7
-                * https://bugzilla.kernel.org/show_bug.cgi?id=216473 : 82V2
-                * https://bugzilla.kernel.org/show_bug.cgi?id=216438 : 82TL
-                */
-               .callback = lps0_prefer_microsoft,
-               .matches = {
-                       DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "82"),
-               },
-       },
-       {
-               /*
-                * ASUSTeK COMPUTER INC. ROG Flow X13 GV301RE_GV301RE
-                * https://gitlab.freedesktop.org/drm/amd/-/issues/2148
-                */
-               .callback = lps0_prefer_microsoft,
-               .matches = {
-                       DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "ROG Flow X13 GV301"),
-               },
-       },
-       {
-               /*
-                * ASUSTeK COMPUTER INC. ROG Flow X16 GV601RW_GV601RW
-                * https://gitlab.freedesktop.org/drm/amd/-/issues/2148
-                */
-               .callback = lps0_prefer_microsoft,
-               .matches = {
-                       DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "ROG Flow X16 GV601"),
-               },
-       },
-       {
-               /*
                 * AMD Rembrandt based HP EliteBook 835/845/865 G9
                 * Contains specialized AML in AMD/_REV 2 path to avoid
                 * triggering a bug in Qualcomm WLAN firmware. This may be
@@ -504,16 +426,14 @@ static int lps0_device_attach(struct acpi_device *adev,
                if (dev_id->id[0])
                        data = (const struct amd_lps0_hid_device_data *) dev_id->driver_data;
                else
-                       data = &amd_rembrandt;
-               rev_id = data->rev_id;
+                       data = &amd_cezanne;
                lps0_dsm_func_mask = validate_dsm(adev->handle,
                                        ACPI_LPS0_DSM_UUID_AMD, rev_id, &lps0_dsm_guid);
                if (lps0_dsm_func_mask > 0x3 && data->check_off_by_one) {
                        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 if (lps0_dsm_func_mask_microsoft > 0 && data->prefer_amd_guid &&
-                               !prefer_microsoft_dsm_guid) {
+               } else if (lps0_dsm_func_mask_microsoft > 0 && rev_id) {
                        lps0_dsm_func_mask_microsoft = -EINVAL;
                        acpi_handle_debug(adev->handle, "_DSM Using AMD method\n");
                }
@@ -521,8 +441,7 @@ static int lps0_device_attach(struct acpi_device *adev,
                rev_id = 1;
                lps0_dsm_func_mask = validate_dsm(adev->handle,
                                        ACPI_LPS0_DSM_UUID, rev_id, &lps0_dsm_guid);
-               if (!prefer_microsoft_dsm_guid)
-                       lps0_dsm_func_mask_microsoft = -EINVAL;
+               lps0_dsm_func_mask_microsoft = -EINVAL;
        }
 
        if (lps0_dsm_func_mask < 0 && lps0_dsm_func_mask_microsoft < 0)