Fix s2idle resume on HP 15s-eq2xxx
cover Fix s2idle resume on HP 15s-eq2xxx
HP 15s-eq2xxx has problems resuming from s2idle when IOMMU is enabled. This is the same root cause as some Lenovo laptops had where IOMMU enabled caused issues with NVME during s2idle resume from a problematic SMI.
To series fixes the issue by re-using the same quirk developed from the older Lenovo laptops.
Mario Limonciello (2):
platform/x86: Move s2idle quirk from thinkpad-acpi to amd-pmc platform/x86/amd: pmc: Apply nvme quirk to HP 15s-eq2xxx
drivers/platform/x86/amd/Makefile | 2 +- drivers/platform/x86/amd/pmc-quirks.c | 172 ++++++++++++++++++++++++++ drivers/platform/x86/amd/pmc.c | 30 +---- drivers/platform/x86/amd/pmc.h | 43 +++++++ drivers/platform/x86/thinkpad_acpi.c | 143 --------------------- 5 files changed, 222 insertions(+), 168 deletions(-) create mode 100644 drivers/platform/x86/amd/pmc-quirks.c create mode 100644 drivers/platform/x86/amd/pmc.h
Signature · 1 line
2.34.1
PATCH 1/2 platform/x86: Move s2idle quirk from thinkpad-acpi to amd-pmc
It turns out that some-non Lenovo systems can benefit from the quirk introduced for Lenovo systems in commit 455cd867b85b5 ("platform/x86:thinkpad_acpi: Add a s2idle resume quirk for a number of laptops").
So move this quirk into running from the amd-pmc driver instead. No intended functional changes.
--- drivers/platform/x86/amd/Makefile | 2 +- drivers/platform/x86/amd/pmc-quirks.c | 164 ++++++++++++++++++++++++++ drivers/platform/x86/amd/pmc.c | 30 +---- drivers/platform/x86/amd/pmc.h | 43 +++++++ drivers/platform/x86/thinkpad_acpi.c | 143 ---------------------- 5 files changed, 214 insertions(+), 168 deletions(-) create mode 100644 drivers/platform/x86/amd/pmc-quirks.c create mode 100644 drivers/platform/x86/amd/pmc.h
drivers/platform/x86/amd/Makefile +1 -1
@@ -4,7 +4,7 @@ # AMD x86 Platform-Specific Drivers # -amd-pmc-y := pmc.o +amd-pmc-y := pmc.o pmc-quirks.o obj-$(CONFIG_AMD_PMC) += amd-pmc.o amd_hsmp-y := hsmp.o obj-$(CONFIG_AMD_HSMP) += amd_hsmp.o
drivers/platform/x86/amd/pmc-quirks.c new file +164 -0
164 lines not on this page · raw message
drivers/platform/x86/amd/pmc.c +6 -24
@@ -20,7 +20,6 @@#include <linux/iopoll.h> #include <linux/limits.h> #include <linux/module.h> -#include <linux/pci.h> #include <linux/platform_device.h> #include <linux/rtc.h> #include <linux/serio.h>
@@ -28,6 +27,8 @@#include <linux/seq_file.h> #include <linux/uaccess.h> +#include "pmc.h" +/* SMU communication registers */ #define AMD_PMC_REGISTER_MESSAGE 0x538#define AMD_PMC_REGISTER_RESPONSE 0x980
@@ -146,29 +147,6 @@ static const struct amd_pmc_bit_map soc15_ip_blk[] = { {} }; -struct amd_pmc_dev { -void __iomem *regbase; -void __iomem *smu_virt_addr; -void __iomem *stb_virt_addr; -void __iomem *fch_virt_addr; -bool msg_port; -u32 base_addr; -u32 cpu_id; -u32 active_ips; -u32 dram_size; -u32 num_ips; -u32 s2d_msg_id; -/* SMU version information */ -u8 smu_program; -u8 major; -u8 minor; -u8 rev; -struct device *dev; -struct pci_dev *rdev; -struct mutex lock;/* generic mutex lock */ -struct dentry *dbgfs_dir; -}; -static bool enable_stb;module_param (enable_stb, bool,0644 );MODULE_PARM_DESC (enable_stb,"Enable the STB debug mechanism" );
@@ -891,6 +869,8 @@ static void amd_pmc_s2idle_restore(void)/* Notify on failed entry */ amd_pmc_validate_deepest (pdev); + +amd_pmc_process_restore_quirks (pdev); }static struct acpi_s2idle_dev_ops amd_pmc_s2idle_dev_ops = {
@@ -1087,6 +1067,8 @@ static int amd_pmc_probe(struct platform_device *pdev) err =acpi_register_lps0_dev (&amd_pmc_s2idle_dev_ops);if (err)dev_warn (dev->dev,"failed to register LPS0 sleep handler, expect increased power consumption\n" ); +if (!disable_workarounds) +amd_pmc_quirks_init (dev); }amd_pmc_dbgfs_register (dev);
drivers/platform/x86/amd/pmc.h new file +43 -0
43 lines not on this page · raw message
drivers/platform/x86/thinkpad_acpi.c +0 -143
176 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 2/2 platform/x86/amd: pmc: Apply nvme quirk to HP 15s-eq2xxx
In reply to Mario LimoncielloHP 15s-eq2xxx is an older Lucienne laptop that has a problem resuming from s2idle when IOMMU is enabled. The symptoms very closely resemble that of the Lenovo issues with NVME resume. Lucienne was released in a similar timeframe as the Renoir / Cezanne Lenovo laptops and they may have similar BIOS code.
Applying the same quirk to this system allows the system to work with IOMMU enabled and s2idle resume to work.
--- drivers/platform/x86/amd/pmc-quirks.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/amd/pmc-quirks.c +9 -0
@@ -109,6 +109,15 @@ static const struct dmi_system_id fwbug_list[] = { DMI_MATCH(DMI_PRODUCT_NAME, "21A1"), } }, +/* https://gitlab.freedesktop.org/drm/amd/-/issues/2684 */ + { + .ident = "HP Laptop 15s-eq2xxx", + .driver_data = &quirk_s2idle_bug, + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "HP"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP Laptop 15s-eq2xxx"), + } + }, {} };
Signature · 1 line
2.34.1
Hi Mario,
Quoted 11 lines · Mario Limonciello
HP 15s-eq2xxx has problems resuming from s2idle when IOMMU is enabled. This is the same root cause as some Lenovo laptops had where IOMMU enabled caused issues with NVME during s2idle resume from a problematic SMI.
To series fixes the issue by re-using the same quirk developed from the older Lenovo laptops.
Mario Limonciello (2):
platform/x86: Move s2idle quirk from thinkpad-acpi to amd-pmc platform/x86/amd: pmc: Apply nvme quirk to HP 15s-eq2xxx
Quoted 8 lines
drivers/platform/x86/amd/Makefile | 2 +- drivers/platform/x86/amd/pmc-quirks.c | 172 ++++++++++++++++++++++++++ drivers/platform/x86/amd/pmc.c | 30 +---- drivers/platform/x86/amd/pmc.h | 43 +++++++ drivers/platform/x86/thinkpad_acpi.c | 143 --------------------- 5 files changed, 222 insertions(+), 168 deletions(-) create mode 100644 drivers/platform/x86/amd/pmc-quirks.c create mode 100644 drivers/platform/x86/amd/pmc.h
Thank you for your series, I've applied this series to my fixes branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=fixes
For patch 1/2 the inclusion of linux/pci.h in drivers/platform/x86/amd/pmc.h is not necessary, where as some actually needed headers (types and mutex) were missing.
So I've moved the pci.h include back to pmc.c and added a few missing includes. I have squashed the following diff into 1/2 while merging for this:
drivers/platform/x86/amd/pmc-quirks.c +3 -0
@@ -9,6 +9,9 @@*/ #include <linux/dmi.h> +#include <linux/io.h> +#include <linux/ioport.h> +#include <linux/slab.h> #include "pmc.h"
drivers/platform/x86/amd/pmc.c +1 -0
@@ -20,6 +20,7 @@#include <linux/iopoll.h> #include <linux/limits.h> #include <linux/module.h> +#include <linux/pci.h> #include <linux/platform_device.h> #include <linux/rtc.h> #include <linux/serio.h>
drivers/platform/x86/amd/pmc.h +2 -1
@@ -11,7 +11,8 @@ #ifndef PMC_H #define PMC_H -#include <linux/pci.h> +#include <linux/types.h> +#include <linux/mutex.h> struct amd_pmc_dev { void __iomem *regbase;
Since this is just changing #include-s this should not cause any functional changes.
I will include this series in my next fixes pull-req to Linus for the current kernel development cycle.
Regards,
Hans