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]
Date:   Mon, 5 Jun 2023 10:11:30 -0500
From:   Mario Limonciello <mario.limonciello@....com>
To:     Huang Rui <ray.huang@....com>,
        Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
CC:     "Rafael J . Wysocki" <rafael@...nel.org>,
        Len Brown <lenb@...nel.org>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        Robert Moore <robert.moore@...el.com>,
        <linux-acpi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linux-pm@...r.kernel.org>, <devel@...ica.org>,
        Gautham Ranjal Shenoy <gautham.shenoy@....com>,
        "Wyes Karny" <Wyes.Karny@....com>, Perry Yuan <perry.yuan@....com>,
        "Mario Limonciello" <mario.limonciello@....com>
Subject: [PATCH 1/4] ACPI: CPPC: Add a symbol to check if the preferred profile is a server

This symbol will be used by intel-pstate and amd-pstate for making
decisions based on what the FADT indicates the system pm profile is.

Suggested-by: Gautham Ranjal Shenoy <gautham.shenoy@....com>
Link: https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/05_ACPI_Software_Programming_Model/ACPI_Software_Programming_Model.html#fixed-acpi-description-table-fadt
Signed-off-by: Mario Limonciello <mario.limonciello@....com>
---
 drivers/acpi/cppc_acpi.c | 34 ++++++++++++++++++++++++++++++++++
 include/acpi/actbl.h     |  3 ++-
 include/acpi/processor.h | 10 ++++++++++
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index 7ff269a78c20..d8827eae3ba4 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -941,6 +941,40 @@ void acpi_cppc_processor_exit(struct acpi_processor *pr)
 }
 EXPORT_SYMBOL_GPL(acpi_cppc_processor_exit);
 
+
+/**
+ * acpi_pm_profile_server() - Check if the system is a server.
+ *
+ * Return: true for server profiles, false for anything else
+ */
+bool acpi_pm_profile_server(void)
+{
+	switch (acpi_gbl_FADT.preferred_profile) {
+	case PM_ENTERPRISE_SERVER:
+	case PM_SOHO_SERVER:
+	case PM_PERFORMANCE_SERVER:
+		return true;
+	}
+	return false;
+}
+EXPORT_SYMBOL_GPL(acpi_pm_profile_server);
+
+/**
+ * acpi_pm_profile_undefined() - Check if the system is an undefined pm profile.
+ *
+ * Return: true for undefined profiles, false for anything else
+ */
+bool acpi_pm_profile_undefined(void)
+{
+	if (acpi_gbl_FADT.preferred_profile == PM_UNSPECIFIED)
+		return true;
+	if (acpi_gbl_FADT.preferred_profile >= NR_PM_PROFILES)
+		return true;
+	return false;
+}
+EXPORT_SYMBOL_GPL(acpi_pm_profile_undefined);
+
+
 /**
  * cpc_read_ffh() - Read FFH register
  * @cpunum:	CPU number to read
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index e5dfb6f4de52..451f6276da49 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -307,7 +307,8 @@ enum acpi_preferred_pm_profiles {
 	PM_SOHO_SERVER = 5,
 	PM_APPLIANCE_PC = 6,
 	PM_PERFORMANCE_SERVER = 7,
-	PM_TABLET = 8
+	PM_TABLET = 8,
+	NR_PM_PROFILES = 9
 };
 
 /* Values for sleep_status and sleep_control registers (V5+ FADT) */
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 94181fe9780a..05a45ebddaea 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -360,6 +360,8 @@ int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id);
 #ifdef CONFIG_ACPI_CPPC_LIB
 extern int acpi_cppc_processor_probe(struct acpi_processor *pr);
 extern void acpi_cppc_processor_exit(struct acpi_processor *pr);
+extern bool acpi_pm_profile_server(void);
+extern bool acpi_pm_profile_undefined(void);
 #else
 static inline int acpi_cppc_processor_probe(struct acpi_processor *pr)
 {
@@ -369,6 +371,14 @@ static inline void acpi_cppc_processor_exit(struct acpi_processor *pr)
 {
 	return;
 }
+static inline bool acpi_pm_profile_server(void)
+{
+	return false;
+}
+static inline bool acpi_pm_profile_undefined(void)
+{
+	return true;
+}
 #endif	/* CONFIG_ACPI_CPPC_LIB */
 
 /* in processor_pdc.c */
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ