From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: Linux PM <linux-pm@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Zhang Rui <rui.zhang@intel.com>,
Rajneesh Bhardwaj <rajneesh.bhardwaj@linux.intel.com>
Subject: [PATCH 4/4] ACPI: PM: s2idle: Add acpi_sleep=no_lps0 command line switch
Date: Fri, 26 Jul 2019 00:56:11 +0200 [thread overview]
Message-ID: <2019011.7K24B7Jytf@kreacher> (raw)
In-Reply-To: <3471485.I2vrcDHEeC@kreacher>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Add a kernel command line switch to prevent the LPS0 _DSM funtions
from being invoked (if need be) and rework the suspend-to-idle
blacklist entries in acpisleep_dmi_table[] to make them simply
prevent suspend-to-idle from being used by default on the systems
in question (which really is the original purpose of those entries).
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
Documentation/admin-guide/kernel-parameters.txt | 5 ++-
arch/x86/kernel/acpi/sleep.c | 2 +
drivers/acpi/sleep.c | 34 +++++++++++++++---------
include/linux/acpi.h | 1
4 files changed, 29 insertions(+), 13 deletions(-)
Index: linux-pm/drivers/acpi/sleep.c
===================================================================
--- linux-pm.orig/drivers/acpi/sleep.c
+++ linux-pm/drivers/acpi/sleep.c
@@ -158,11 +158,19 @@ static int __init init_nvs_nosave(const
return 0;
}
-static bool acpi_sleep_no_lps0;
+#define ACPI_SLEEP_AVOID_LPS0_DSM BIT(0)
+#define ACPI_SLEEP_DEFAULT_S3 BIT(1)
-static int __init init_no_lps0(const struct dmi_system_id *d)
+static u8 acpi_sleep_lps0_flags;
+
+void __init acpi_sleep_init_no_lps0(void)
+{
+ acpi_sleep_lps0_flags |= ACPI_SLEEP_AVOID_LPS0_DSM;
+}
+
+static int __init init_default_s3(const struct dmi_system_id *d)
{
- acpi_sleep_no_lps0 = true;
+ acpi_sleep_lps0_flags |= ACPI_SLEEP_DEFAULT_S3;
return 0;
}
@@ -363,7 +371,7 @@ static const struct dmi_system_id acpisl
* S0 Idle firmware interface.
*/
{
- .callback = init_no_lps0,
+ .callback = init_default_s3,
.ident = "Dell XPS13 9360",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
@@ -376,7 +384,7 @@ static const struct dmi_system_id acpisl
* https://bugzilla.kernel.org/show_bug.cgi?id=199057).
*/
{
- .callback = init_no_lps0,
+ .callback = init_default_s3,
.ident = "ThinkPad X1 Tablet(2016)",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
@@ -525,7 +533,7 @@ static void acpi_pm_end(void)
}
#else /* !CONFIG_ACPI_SLEEP */
#define acpi_target_sleep_state ACPI_STATE_S0
-#define acpi_sleep_no_lps0 (false)
+#define acpi_sleep_lps0_flags (0)
static inline void acpi_sleep_dmi_check(void) {}
#endif /* CONFIG_ACPI_SLEEP */
@@ -904,15 +912,15 @@ static int lps0_device_attach(struct acp
if (lps0_device_handle)
return 0;
- if (acpi_sleep_no_lps0) {
+ if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
+ return 0;
+
+ if (acpi_sleep_lps0_flags & ACPI_SLEEP_AVOID_LPS0_DSM) {
acpi_handle_info(adev->handle,
"Low Power S0 Idle interface disabled\n");
- return 0;
+ goto default_sleep;
}
- if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
- return 0;
-
guid_parse(ACPI_LPS0_DSM_UUID, &lps0_dsm_guid);
/* Check if the _DSM is present and as expected. */
out_obj = acpi_evaluate_dsm(adev->handle, &lps0_dsm_guid, 1, 0, NULL);
@@ -933,11 +941,13 @@ static int lps0_device_attach(struct acp
lpi_device_get_constraints();
+default_sleep:
/*
* Use suspend-to-idle by default if the default suspend mode was not
* set from the command line.
*/
- if (mem_sleep_default > PM_SUSPEND_MEM)
+ if (mem_sleep_default > PM_SUSPEND_MEM &&
+ !(acpi_sleep_lps0_flags & ACPI_SLEEP_DEFAULT_S3))
mem_sleep_current = PM_SUSPEND_TO_IDLE;
return 0;
Index: linux-pm/include/linux/acpi.h
===================================================================
--- linux-pm.orig/include/linux/acpi.h
+++ linux-pm/include/linux/acpi.h
@@ -471,6 +471,7 @@ void __init acpi_old_suspend_ordering(vo
void __init acpi_nvs_nosave(void);
void __init acpi_nvs_nosave_s3(void);
void __init acpi_sleep_no_blacklist(void);
+void __init acpi_sleep_init_no_lps0(void);
#endif /* CONFIG_PM_SLEEP */
struct acpi_osc_context {
Index: linux-pm/arch/x86/kernel/acpi/sleep.c
===================================================================
--- linux-pm.orig/arch/x86/kernel/acpi/sleep.c
+++ linux-pm/arch/x86/kernel/acpi/sleep.c
@@ -137,6 +137,8 @@ static int __init acpi_sleep_setup(char
acpi_nvs_nosave_s3();
if (strncmp(str, "old_ordering", 12) == 0)
acpi_old_suspend_ordering();
+ if (strncmp(str, "no_lps0", 7) == 0)
+ acpi_sleep_init_no_lps0();
if (strncmp(str, "nobl", 4) == 0)
acpi_sleep_no_blacklist();
str = strchr(str, ',');
Index: linux-pm/Documentation/admin-guide/kernel-parameters.txt
===================================================================
--- linux-pm.orig/Documentation/admin-guide/kernel-parameters.txt
+++ linux-pm/Documentation/admin-guide/kernel-parameters.txt
@@ -222,7 +222,8 @@
acpi_sleep= [HW,ACPI] Sleep options
Format: { s3_bios, s3_mode, s3_beep, s4_nohwsig,
- old_ordering, nonvs, sci_force_enable, nobl }
+ old_ordering, nonvs, sci_force_enable,
+ no_lps0, nobl }
See Documentation/power/video.rst for information on
s3_bios and s3_mode.
s3_beep is for debugging; it makes the PC's speaker beep
@@ -238,6 +239,8 @@
sci_force_enable causes the kernel to set SCI_EN directly
on resume from S1/S3 (which is against the ACPI spec,
but some broken systems don't work without it).
+ no_lps0 prevents the kernel from using the special
+ LPS0 device interface during suspend-to-idle.
nobl causes the internal blacklist of systems known to
behave incorrectly in some ways with respect to system
suspend and resume to be ignored (use wisely).
prev parent reply other threads:[~2019-07-25 22:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-25 22:51 [PATCH 0/4] PM / ACPI: sleep: Additional changes related to suspend-to-idle Rafael J. Wysocki
2019-07-25 22:53 ` [PATCH 1/4] ACPI: PM: Set up EC GPE for system wakeup from drivers that need it Rafael J. Wysocki
2019-07-26 10:40 ` Andy Shevchenko
2019-07-25 22:54 ` [PATCH 2/4] ACPI: PM: s2idle: Execute LPS0 _DSM functions with suspended devices Rafael J. Wysocki
2019-07-25 22:55 ` [PATCH 3/4] ACPI: PM: s2idle: Rearrange lps0_device_attach() Rafael J. Wysocki
2019-07-25 22:56 ` Rafael J. Wysocki [this message]
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=2019011.7K24B7Jytf@kreacher \
--to=rjw@rjwysocki.net \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rajneesh.bhardwaj@linux.intel.com \
--cc=rui.zhang@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).