ACPI 6.0 introduced an optional object _LPI that provides an alternate
method to describe Low Power Idle states. It defines the local power
states for each node in a hierarchical processor topology. The OSPM can
use _LPI object to select a local power state for each level of processor
hierarchy in the system. They used to produce a composite power state
request that is presented to the platform by the OSPM.

Since multiple processors affect the idle state for any non-leaf hierarchy
node, coordination of idle state requests between the processors is
required. ACPI supports two different coordination schemes: Platform
coordinated and OS initiated.

This patch adds initial support for Platform coordination scheme of LPI.

The above code doesn't look particularly straightforward and it seems to be
using more memory than necessary.

For instance, you don't need to store the acpi_processor_evaluate_lpi() data
for all levels at the same time. It only needs to be stored for the current
level and you need a list of states enabling the ones at the current from
the previous one. Plus the current list of effective states available to the
CPU.

Agreed with all the comments and fixed locally except this one. This
approach considered one leaf node and searched till the root each time.
To save memory we need to complete one level at a time. I am making
changes for this now but make require more testing with all combinations.

It also should check the upper bound of pr->power.lpi_states[] somewhere which
it doesn't do AFAICS.