Skip to content

Commit eb087f3

Browse files
superm1rafaeljw
authored andcommitted
ACPI: processor idle: Check for architectural support for LPI
When `osc_pc_lpi_support_confirmed` is set through `_OSC` and `_LPI` is populated then the cpuidle driver assumes that LPI is fully functional. However currently the kernel only provides architectural support for LPI on ARM. This leads to high power consumption on X86 platforms that otherwise try to enable LPI. So probe whether or not LPI support is implemented before enabling LPI in the kernel. This is done by overloading `acpi_processor_ffh_lpi_probe` to check whether it returns `-EOPNOTSUPP`. It also means that all future implementations of `acpi_processor_ffh_lpi_probe` will need to follow these semantics as well. Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 01f6c73 commit eb087f3

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

drivers/acpi/processor_idle.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,11 @@ static int flatten_lpi_states(struct acpi_processor *pr,
10801080
return 0;
10811081
}
10821082

1083+
int __weak acpi_processor_ffh_lpi_probe(unsigned int cpu)
1084+
{
1085+
return -EOPNOTSUPP;
1086+
}
1087+
10831088
static int acpi_processor_get_lpi_info(struct acpi_processor *pr)
10841089
{
10851090
int ret, i;
@@ -1088,6 +1093,11 @@ static int acpi_processor_get_lpi_info(struct acpi_processor *pr)
10881093
struct acpi_device *d = NULL;
10891094
struct acpi_lpi_states_array info[2], *tmp, *prev, *curr;
10901095

1096+
/* make sure our architecture has support */
1097+
ret = acpi_processor_ffh_lpi_probe(pr->id);
1098+
if (ret == -EOPNOTSUPP)
1099+
return ret;
1100+
10911101
if (!osc_pc_lpi_support_confirmed)
10921102
return -EOPNOTSUPP;
10931103

@@ -1139,11 +1149,6 @@ static int acpi_processor_get_lpi_info(struct acpi_processor *pr)
11391149
return 0;
11401150
}
11411151

1142-
int __weak acpi_processor_ffh_lpi_probe(unsigned int cpu)
1143-
{
1144-
return -ENODEV;
1145-
}
1146-
11471152
int __weak acpi_processor_ffh_lpi_enter(struct acpi_lpi_state *lpi)
11481153
{
11491154
return -ENODEV;

0 commit comments

Comments
 (0)