ACPI defines performance states for processors and devices but only provides standard bindings for processor performance states via P-States and CPPC bindings. For devices, performance states are defined by the buses like PCIe, USB, etc., and no standard bindings are defined by ACPI.
In this section, we are exploring generic ACPI-related bindings to define performance states for platform devices.
ACPI Definition for Device Performance States
From section 2.3.1 Device Performance States:
Device performance states (Px states) are power consumption and capability states within the active (D0) device power state. Performance states allow OSPM to make tradeoffs between performance and energy conservation. Device performance states have the greatest impact when the implementation is such that the states invoke different device efficiency levels as opposed to a linear scaling of performance and energy consumption. Since performance state transitions occur in the active device states, care must be taken to ensure that performance state transitions do not adversely impact the system. Device performance states, when necessary, are defined on a per device class basis (See Appendix A: Device Class Specifications for more information).
ACPI Device Performance States Proposal
_DPT
ACPI object to describe polling time in milliseconds.
This will be the frequency at which the OSPM will poll the device and change the performance states.
_DPS
ACPI object to get supported device performance states (Px)
The format of each Px state is defined as follows
Device Frequency | Device core frequency in MHz |
Power | Power dissipation in Milliwatts |
Latency | Performance state transition latency in nanoseconds |
Name (_DPS, Package() { P0, P1, ... Pn })
Device Frequency and Power are only indica’s current utilization in percentage.
Method(_DUT, 0, Serialized) { .... }
_DPA
OSPM can use this method to check the available device performance levels.
Method(_DPA, 0, Serialized) { Return <available starting Px index> }
_DPA will return the first available Px index that OSPM can use for dynamic performance level setting.
_DPD
OSPM can use this method to get the delivered performance level.
Method(_DPD) { Return <Px index> }
This method is optional if there are other ways for OSPM to derive delivered performance. For example, if ClockInput resources are provided for the device in _CRS method then OSPM can utilize that to know the delivered performance.
Example with I.MX8MP DDR Controller
Device utilization is derived from PMU counters.
TF-A implements functions that can be invoked from AML via FFH/SMCC to collect the device utilization and configure the DDR frequency.
ASL Code
Device(DDR1) { Name (_HID, "NXP099") // _HID: Hardware ID Name (_UID, One) // _UID: Unique ID Method (_STA) { Return(0xF) } Method (_CRS, 0x0, NotSerialized) { Name ( RBUF, ResourceTemplate () { ClockInput(100000, 1, Hz, Variable, “\\_SB.CLK”,) }) Return(RBUF) } // Polling time in miliseconds Name(_DPT, 12) // Get Device Performance States Name (_DPS, Package() { Package(){200, 1800, 100}, // Performance State zero (P0) Package(){400, 1800, 100}, // Performance State zero (P1) Package(){800, 1800, 100}, // Performance State zero (P2) }) // Configure Device Performance States // does it have to be asynchronous ??? Method(_DPC, 1, Serialized) { If (Arg0 == 0) { local0 = 200 } Elseif (Arg0 == 1){ local0 = 400 } Else { local0 = 800 } // SMC call OperationRegion(AFFH, FFixedHW, 1, 24) Field (AFFH, BufferAcc, NoLock, Preserve) { SMCC, 192 } Name(BUFF, Buffer(24){}) CreateQWordField(BUFF, 0x00, BFX0) CreateQWordField(BUFF, 0x08, BFX1) // X1 CreateQWordField(BUFF, 0x10, BFX2) // X2 BFX0 = 0xc2000004 // IMX_SIP_DDR_DVFS FID BFX1 = local0 // target frequency BFX2 = 0x1010101 // online CPUs - assumes all of them are online BUFF = (SMCC = BUFF) Return (BFX0) } // Device utilization in percentage Method(_DPU, 0, Serialized) { // SMC call OperationRegion(AFFH, FFixedHW, 1, 8) Field (AFFH, BufferAcc, NoLock, Preserve) { SMCC, 64 } Name(BUFF, Buffer(8){}) CreateQWordField(BUFF, 0x00, BFX0) BFX0 = 0xc200000D // FID BUFF = (SMCC = BUFF) Return (BFX0) } // Device Performance States Availability Method(_DPA, 0, Serialized) { Return (0) // all Pn states available } }