ACPI: CPPC: Add a symbol to check if the preferred profile is a server
Subsystems (3)
PATCH v2 1/4 ACPI: CPPC: Add a symbol to check if the preferred profile is a server
From: Mario Limonciello <[email protected]>
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.
--- drivers/acpi/cppc_acpi.c | 34 ++++++++++++++++++++++++++++++++++ include/acpi/actbl.h | 3 ++- include/acpi/processor.h | 10 ++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-)
drivers/acpi/cppc_acpi.c +34 -0
@@ -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
include/acpi/actbl.h +2 -1
@@ -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) */
include/acpi/processor.h +10 -0
@@ -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 */
Signature · 1 line
2.34.1
Quoted 41 lines · Perry
From: Mario Limonciello <[email protected]>
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 <[email protected]>Signed-off-by Mario Limonciello <[email protected]>--- drivers/acpi/cppc_acpi.c | 34 ++++++++++++++++++++++++++++++++++ include/acpi/actbl.h | 3 ++- include/acpi/processor.h | 10 ++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-)drivers/acpi/cppc_acpi.c +19
-0@@ -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); + +/**
drivers/acpi/cppc_acpi.c void acpi_cppc_processor_exit(struct acpi_processor *pr) · line 972
Quoted 10 lines
drivers/acpi/cppc_acpi.c +10
-0+* 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;
May I know the acpi_gbl_FADT.preferred_profile value of powerful desktop such as threadripper or AM4/AM5 socket types of processors?
I am thinking whether we can use this way to differentiate powerful desktop and mobile platforms.
Thanks,
Ray
Quoted 53 lines
drivers/acpi/cppc_acpi.c +5
-0+return false; +} +EXPORT_SYMBOL_GPL (acpi_pm_profile_undefined); + +/** * cpc_read_ffh() - Read FFH register * @cpunum: CPU number to read include/acpi/actbl.h +2
-1@@ -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) */ include/acpi/processor.h +10
-0@@ -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 */ Signature · 1 line
2.34.1
Quoted 46 lines · Huang Rui
Quoted 45 lines · Perry
From: Mario Limonciello <[email protected]>
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 <[email protected]>Signed-off-by Mario Limonciello <[email protected]>--- drivers/acpi/cppc_acpi.c | 34 ++++++++++++++++++++++++++++++++++ include/acpi/actbl.h | 3 ++- include/acpi/processor.h | 10 ++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-)drivers/acpi/cppc_acpi.c +23
-0@@ -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 +*/
Quoted 8 lines
drivers/acpi/cppc_acpi.c void acpi_cppc_processor_exit(struct acpi_processor *pr) · line 972
Quoted 6 lines
drivers/acpi/cppc_acpi.c +6
-0+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;May I know the acpi_gbl_FADT.preferred_profile value of powerful desktop such as threadripper or AM4/AM5 socket types of processors?
I have a Threadripper for my workstation, and it's:
[02Dh 0045 1] PM Profile : 01 [Desktop]
Quoted 2 lines
I am thinking whether we can use this way to differentiate powerful desktop and mobile platforms.
On a Rembrandt laptop it's:
[02Dh 0045 1] PM Profile : 02 [Mobile]
Given Raphael's comments about intel-pstate preferring not to match "SOHO server" as a server, I am planning to move these functions into amd-pstate directly and drop patch 4.
Quoted 56 lines
Thanks,
RayQuoted 53 lines
drivers/acpi/cppc_acpi.c +5
-0+return false; +} +EXPORT_SYMBOL_GPL (acpi_pm_profile_undefined); + +/** * cpc_read_ffh() - Read FFH register * @cpunum: CPU number to read include/acpi/actbl.h +2
-1@@ -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) */ include/acpi/processor.h +10
-0@@ -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 */ Signature · 1 line
2.34.1