Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1363482ybi; Fri, 2 Aug 2019 14:12:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRyEEBNRobG07foGnpEzl4oo6YA2pmBZzZ8rPZl0hlMBBYqORYWdBMFiYi9yAlBIsnWEdk X-Received: by 2002:a63:8a43:: with SMTP id y64mr125061735pgd.104.1564780340571; Fri, 02 Aug 2019 14:12:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564780340; cv=none; d=google.com; s=arc-20160816; b=ekJcIhg26dSAn04OdmWOxl5HoJ+pzLjXGNWKf/8Z4fIEIaxMn6nt3OU0CqLiiOiVs8 GnAtEkrAu4p6B8d50mFDRDvVOUNJF5Ef9oCMOrKpLzUEE1rWbZMD6WxylHcI2QCUVhe5 DjZqc8z25TAA8a1+UG0eXeCOX2Jqkhtrt34maVb7mwa5rvxncXkwj/s/r+fIJr0bEzPS hdvn4YPpRxlDimnSGfl9cV9yuswtwLhUIfvB/I+NOeE0TF188Cteyv0CfS9Xw/+ZkdSc xbC0E2HkMCGFBk+sgUwo5KfZacp621xJpP3e5xdI/lwVQr0SG6ZAO32bqKu5ZB9mrGF9 c6Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=7I4X7g1PeAlNI0XDwU5eUJjRWhXMqmQkwp5migBOk6Y=; b=rCzhFz4xLnPVz9FftYTJr51eEOJhol6/qzGxnQMo4RwS7NSjMXDZkti5nQVCubokDl kAdtqMgqcuzrJoOV+9zbmvarcEvwNe6vCRjHqo9d2Bd13M5Y/rN5ymxF3VgQzEMgDPoB dJJPIykU1nZ7R66V321eHde3pp2rcccbPI/KiA0UJbxc7Y7UIVt6rCnoJcEKRWDbZZb+ HSc16+qQ2bnV5RrLO5CUHYOs26swqBE0HcE9qhcHg5xAq1pHdwaMF0h0uLGndeBepxIh DqlYxHD8iY6N5VTypywM2FcX3Uq2D6HadLbgq/HWPrN02HD0pon+cZ0r1F1+KqTu7h9J D92w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a17si24741911pgm.136.2019.08.02.14.12.02; Fri, 02 Aug 2019 14:12:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405451AbfHBKqP (ORCPT + 99 others); Fri, 2 Aug 2019 06:46:15 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:51281 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730856AbfHBKpw (ORCPT ); Fri, 2 Aug 2019 06:45:52 -0400 Received: from 79.184.255.110.ipv4.supernova.orange.pl (79.184.255.110) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.275) id 4cf97550f7c11232; Fri, 2 Aug 2019 12:45:50 +0200 From: "Rafael J. Wysocki" To: Linux ACPI Cc: Linux PM , LKML , Zhang Rui , Rajneesh Bhardwaj , Andy Shevchenko , Mario Limonciello , Kai-Heng Feng Subject: [PATCH v3 3/8] ACPI: PM: s2idle: Add acpi.sleep_no_lps0 module parameter Date: Fri, 02 Aug 2019 12:38:40 +0200 Message-ID: <2163806.ECDdQTgCPu@kreacher> In-Reply-To: <5997740.FPbUVk04hV@kreacher> References: <5997740.FPbUVk04hV@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki Add a module parameter to prevent the ACPI LPS0 _DSM functions 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 --- In v2 this was patch 4. --- drivers/acpi/sleep.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) Index: linux-pm/drivers/acpi/sleep.c =================================================================== --- linux-pm.orig/drivers/acpi/sleep.c +++ linux-pm/drivers/acpi/sleep.c @@ -89,6 +89,10 @@ bool acpi_sleep_state_supported(u8 sleep } #ifdef CONFIG_ACPI_SLEEP +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 u32 acpi_target_sleep_state = ACPI_STATE_S0; u32 acpi_target_system_state(void) @@ -158,11 +162,11 @@ static int __init init_nvs_nosave(const return 0; } -static bool acpi_sleep_no_lps0; +static bool acpi_sleep_default_s3; -static int __init init_no_lps0(const struct dmi_system_id *d) +static int __init init_default_s3(const struct dmi_system_id *d) { - acpi_sleep_no_lps0 = true; + acpi_sleep_default_s3 = true; return 0; } @@ -363,7 +367,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 +380,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"), @@ -524,8 +528,9 @@ static void acpi_pm_end(void) acpi_sleep_tts_switch(acpi_target_sleep_state); } #else /* !CONFIG_ACPI_SLEEP */ +#define sleep_no_lps0 (1) #define acpi_target_sleep_state ACPI_STATE_S0 -#define acpi_sleep_no_lps0 (false) +#define acpi_sleep_default_s3 (1) static inline void acpi_sleep_dmi_check(void) {} #endif /* CONFIG_ACPI_SLEEP */ @@ -904,12 +909,6 @@ static int lps0_device_attach(struct acp if (lps0_device_handle) return 0; - if (acpi_sleep_no_lps0) { - acpi_handle_info(adev->handle, - "Low Power S0 Idle interface disabled\n"); - return 0; - } - if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) return 0; @@ -937,7 +936,7 @@ static int lps0_device_attach(struct acp * 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_default_s3) mem_sleep_current = PM_SUSPEND_TO_IDLE; return 0; @@ -957,7 +956,7 @@ static int acpi_s2idle_begin(void) static int acpi_s2idle_prepare(void) { - if (lps0_device_handle) { + if (lps0_device_handle && !sleep_no_lps0) { acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_OFF); acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY); } @@ -977,7 +976,7 @@ static int acpi_s2idle_prepare(void) static void acpi_s2idle_wake(void) { - if (lps0_device_handle && pm_debug_messages_on) + if (lps0_device_handle && !sleep_no_lps0 && pm_debug_messages_on) lpi_check_constraints(); /* @@ -1025,7 +1024,7 @@ static void acpi_s2idle_restore(void) if (acpi_sci_irq_valid()) disable_irq_wake(acpi_sci_irq); - if (lps0_device_handle) { + if (lps0_device_handle && !sleep_no_lps0) { acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT); acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON); }