lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251226102656.6296-5-lkml@antheas.dev>
Date: Fri, 26 Dec 2025 12:26:42 +0200
From: Antheas Kapenekakis <lkml@...heas.dev>
To: dmitry.osipenko@...labora.com
Cc: bob.beckett@...labora.com,
	bookeldor@...il.com,
	hadess@...ess.net,
	jaap@...tsma.org,
	kernel@...labora.com,
	lennart@...ttering.net,
	linux-acpi@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	lkml@...heas.dev,
	mccann@....edu,
	rafael@...nel.org,
	richard@...hsie.com,
	sebastian.reichel@...labora.com,
	superm1@...nel.org,
	systemd-devel@...ts.freedesktop.org,
	xaver.hugl@...il.com
Subject: [RFC v1 4/8] acpi/x86: s2idle: add support for querying runtime
 standby state support

Implement the platform_s2idle_ops->get_standby_states() callback to
query which modern standby states are supported by the platform based
on the dsm func masks and expose those to the kernel as runtime standby
states. Union the vendor specific AMD/Intel masks with the ones from
Microsoft as some laptops implement both of them.

Signed-off-by: Antheas Kapenekakis <lkml@...heas.dev>
---
 drivers/acpi/x86/s2idle.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
index 1f13c8b0ef83..08fa7841a484 100644
--- a/drivers/acpi/x86/s2idle.c
+++ b/drivers/acpi/x86/s2idle.c
@@ -513,6 +513,40 @@ static struct acpi_scan_handler lps0_handler = {
 	.attach = lps0_device_attach,
 };
 
+static u8 acpi_s2idle_get_standby_states(void)
+{
+	u8 states = 0;
+
+	if (!lps0_device_handle || sleep_no_lps0)
+		return 0;
+
+	if (lps0_dsm_func_mask_microsoft > 0) {
+		states |= BIT(PM_STANDBY_ACTIVE);
+		if (lps0_dsm_func_mask_microsoft &
+		    (1 << ACPI_LPS0_DISPLAY_OFF | 1 << ACPI_LPS0_DISPLAY_ON))
+			states |= BIT(PM_STANDBY_INACTIVE);
+		if (lps0_dsm_func_mask_microsoft &
+		    (1 << ACPI_LPS0_SLEEP_ENTRY | 1 << ACPI_LPS0_SLEEP_EXIT))
+			states |= BIT(PM_STANDBY_SLEEP);
+	}
+
+	if (lps0_dsm_func_mask > 0) {
+		states |= BIT(PM_STANDBY_ACTIVE);
+		if (acpi_s2idle_vendor_amd()) {
+			if (lps0_dsm_func_mask &
+			    (1 << ACPI_LPS0_DISPLAY_OFF_AMD |
+			     1 << ACPI_LPS0_DISPLAY_ON_AMD))
+				states |= BIT(PM_STANDBY_INACTIVE);
+		} else {
+			if (lps0_dsm_func_mask & (1 << ACPI_LPS0_DISPLAY_OFF |
+						  1 << ACPI_LPS0_DISPLAY_ON))
+				states |= BIT(PM_STANDBY_INACTIVE);
+		}
+	}
+
+	return states;
+}
+
 static int acpi_s2idle_begin_lps0(void)
 {
 	if (pm_debug_messages_on && !lpi_constraints_table) {
@@ -629,6 +663,7 @@ static void acpi_s2idle_restore_early_lps0(void)
 }
 
 static const struct platform_s2idle_ops acpi_s2idle_ops_lps0 = {
+	.get_standby_states = acpi_s2idle_get_standby_states,
 	.begin = acpi_s2idle_begin_lps0,
 	.prepare = acpi_s2idle_prepare,
 	.prepare_late = acpi_s2idle_prepare_late_lps0,
-- 
2.52.0



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ