From: Antheas Kapenekakis lkml@antheas.dev
[ Upstream commit f945afe01c6768dcfed7868c671a26e1164c2284 ]
The Lenovo Legion Go 2 takes a long time to resume from suspend. This is due to it having an nvme resume handler that interferes with IOMMU mappings. It is a common issue with older Lenovo laptops. Adding it to that quirk list fixes this issue.
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4618 Suggested-by: Mario Limonciello mario.limonciello@amd.com Signed-off-by: Antheas Kapenekakis lkml@antheas.dev Reviewed-by: Mario Limonciello (AMD) superm1@kernel.org Link: https://patch.msgid.link/20251008135057.731928-1-lkml@antheas.dev Reviewed-by: Ilpo Järvinen ilpo.jarvinen@linux.intel.com Signed-off-by: Ilpo Järvinen ilpo.jarvinen@linux.intel.com Signed-off-by: Sasha Levin sashal@kernel.org ---
LLM Generated explanations, may be completely bogus:
## Comprehensive Analysis
### 1. Commit Message Analysis The commit "platform/x86/amd: pmc: Add Lenovo Legion Go 2 to pmc quirk list" addresses a specific hardware issue on the Lenovo Legion Go 2. The device experiences long resume times from suspend due to an NVMe resume handler interfering with IOMMU mappings. This is identified as a firmware bug common to several Lenovo laptops. The fix explicitly closes a reported issue on GitLab (#4618) and includes `Reviewed-by` tags from subsystem maintainers.
### 2. Deep Code Research & Mechanism **Code Change:** The commit modifies `drivers/platform/x86/amd/pmc/pmc-quirks.c` by adding two new entries to the `fwbug_list` array. These entries target the "Lenovo Legion Go 2" with product IDs `83N0` and `83N1`.
**Mechanism:** The entries are associated with `quirk_s2idle_bug`. - **The Bug:** On certain AMD platforms, the firmware executes a System Management Interrupt (SMI) handler during the resume transition (D3 -> D0). If IOMMU is enabled, this handler triggers page faults or timeouts, resulting in the "long time to resume" symptom. - **The Fix:** The `quirk_s2idle_bug` callback triggers the `amd_pmc_skip_nvme_smi_handler` function. This function performs a specific MMIO write (typically to the FCH PM scratch register) to disable the problematic SMI handler during the resume phase, bypassing the conflict.
**Infrastructure Context:** This uses existing quirk infrastructure (`quirk_s2idle_bug` and `amd_pmc_skip_nvme_smi_handler`) which was introduced in kernel v6.6. The change itself is purely data—adding IDs to an existing table—rather than introducing new logic.
### 3. Stable Kernel Rules Compliance This commit falls squarely under the **"QUIRKS and WORKAROUNDS"** exception category, which is explicitly allowed in stable trees. - **Criteria Check:** - **Obviously correct:** It strictly adds DMI matches to a table using an existing, proven handler. - **Fixes real bug:** Addresses a significant usability regression (broken/slow suspend) for end users. - **No new features:** It is a hardware enablement/fix, not a feature addition. - **Small scope:** Touch is limited to 17 lines of data addition in one file.
### 4. Risk Assessment - **Regression Risk:** **Extremely Low**. The change is guarded by specific DMI matches (Vendor "LENOVO", Product "83N0"/"83N1"). It will only trigger on the exact hardware specified. It cannot negatively impact other devices. - **User Impact:** High for owners of the device. Without this fix, suspend/resume is effectively broken or frustratingly slow.
### 5. Dependencies and Backporting - **Dependencies:** The commit depends on the AMD PMC quirk infrastructure (`quirk_s2idle_bug`). This infrastructure is present in current stable branches like 6.6.y, 6.12.y, and 6.1.y (where the driver has been updated). - **Applicability:** It should apply cleanly to any stable tree containing the `drivers/platform/x86/amd/pmc/pmc-quirks.c` file and the associated quirk definitions.
### Conclusion This is a textbook stable backport candidate. It is a low-risk, hardware-specific quirk that fixes a real user-visible bug using established kernel infrastructure. It perfectly matches the exception for hardware workarounds.
**YES**
drivers/platform/x86/amd/pmc/pmc-quirks.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
diff --git a/drivers/platform/x86/amd/pmc/pmc-quirks.c b/drivers/platform/x86/amd/pmc/pmc-quirks.c index d63aaad7ef599..0fadcf5f288ac 100644 --- a/drivers/platform/x86/amd/pmc/pmc-quirks.c +++ b/drivers/platform/x86/amd/pmc/pmc-quirks.c @@ -204,6 +204,23 @@ static const struct dmi_system_id fwbug_list[] = { DMI_MATCH(DMI_PRODUCT_NAME, "82ND"), } }, + /* https://gitlab.freedesktop.org/drm/amd/-/issues/4618 */ + { + .ident = "Lenovo Legion Go 2", + .driver_data = &quirk_s2idle_bug, + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "83N0"), + } + }, + { + .ident = "Lenovo Legion Go 2", + .driver_data = &quirk_s2idle_bug, + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "83N1"), + } + }, /* https://gitlab.freedesktop.org/drm/amd/-/issues/2684 */ { .ident = "HP Laptop 15s-eq2xxx",