162306a36Sopenharmony_ciIBM Power-Management Bindings 262306a36Sopenharmony_ci============================= 362306a36Sopenharmony_ci 462306a36Sopenharmony_ciLinux running on baremetal POWER machines has access to the processor 562306a36Sopenharmony_ciidle states. The description of these idle states is exposed via the 662306a36Sopenharmony_cinode @power-mgt in the device-tree by the firmware. 762306a36Sopenharmony_ci 862306a36Sopenharmony_ciDefinitions: 962306a36Sopenharmony_ci---------------- 1062306a36Sopenharmony_ciTypically each idle state has the following associated properties: 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci- name: The name of the idle state as defined by the firmware. 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci- flags: indicating some aspects of this idle states such as the 1562306a36Sopenharmony_ci extent of state-loss, whether timebase is stopped on this 1662306a36Sopenharmony_ci idle states and so on. The flag bits are as follows: 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci- exit-latency: The latency involved in transitioning the state of the 1962306a36Sopenharmony_ci CPU from idle to running. 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci- target-residency: The minimum time that the CPU needs to reside in 2262306a36Sopenharmony_ci this idle state in order to accrue power-savings 2362306a36Sopenharmony_ci benefit. 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ciProperties 2662306a36Sopenharmony_ci---------------- 2762306a36Sopenharmony_ciThe following properties provide details about the idle states. These 2862306a36Sopenharmony_ciproperties are exposed as arrays. Each entry in the property array 2962306a36Sopenharmony_ciprovides the value of that property for the idle state associated with 3062306a36Sopenharmony_cithe array index of that entry. 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ciIf idle-states are defined, then the properties 3362306a36Sopenharmony_ci"ibm,cpu-idle-state-names" and "ibm,cpu-idle-state-flags" are 3462306a36Sopenharmony_cirequired. The other properties are required unless mentioned 3562306a36Sopenharmony_ciotherwise. The length of all the property arrays must be the same. 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci- ibm,cpu-idle-state-names: 3862306a36Sopenharmony_ci Array of strings containing the names of the idle states. 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci- ibm,cpu-idle-state-flags: 4162306a36Sopenharmony_ci Array of unsigned 32-bit values containing the values of the 4262306a36Sopenharmony_ci flags associated with the aforementioned idle-states. The 4362306a36Sopenharmony_ci flag bits are as follows: 4462306a36Sopenharmony_ci 0x00000001 /* Decrementer would stop */ 4562306a36Sopenharmony_ci 0x00000002 /* Needs timebase restore */ 4662306a36Sopenharmony_ci 0x00001000 /* Restore GPRs like nap */ 4762306a36Sopenharmony_ci 0x00002000 /* Restore hypervisor resource from PACA pointer */ 4862306a36Sopenharmony_ci 0x00004000 /* Program PORE to restore PACA pointer */ 4962306a36Sopenharmony_ci 0x00010000 /* This is a nap state (POWER7,POWER8) */ 5062306a36Sopenharmony_ci 0x00020000 /* This is a fast-sleep state (POWER8)*/ 5162306a36Sopenharmony_ci 0x00040000 /* This is a winkle state (POWER8) */ 5262306a36Sopenharmony_ci 0x00080000 /* This is a fast-sleep state which requires a */ 5362306a36Sopenharmony_ci /* software workaround for restoring the */ 5462306a36Sopenharmony_ci /* timebase (POWER8) */ 5562306a36Sopenharmony_ci 0x00800000 /* This state uses SPR PMICR instruction */ 5662306a36Sopenharmony_ci /* (POWER8)*/ 5762306a36Sopenharmony_ci 0x00100000 /* This is a fast stop state (POWER9) */ 5862306a36Sopenharmony_ci 0x00200000 /* This is a deep-stop state (POWER9) */ 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci- ibm,cpu-idle-state-latencies-ns: 6162306a36Sopenharmony_ci Array of unsigned 32-bit values containing the values of the 6262306a36Sopenharmony_ci exit-latencies (in ns) for the idle states in 6362306a36Sopenharmony_ci ibm,cpu-idle-state-names. 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ci- ibm,cpu-idle-state-residency-ns: 6662306a36Sopenharmony_ci Array of unsigned 32-bit values containing the values of the 6762306a36Sopenharmony_ci target-residency (in ns) for the idle states in 6862306a36Sopenharmony_ci ibm,cpu-idle-state-names. On POWER8 this is an optional 6962306a36Sopenharmony_ci property. If the property is absent, the target residency for 7062306a36Sopenharmony_ci the "Nap", "FastSleep" are defined to 10000 and 300000000 7162306a36Sopenharmony_ci respectively by the kernel. On POWER9 this property is required. 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci- ibm,cpu-idle-state-psscr: 7462306a36Sopenharmony_ci Array of unsigned 64-bit values containing the values for the 7562306a36Sopenharmony_ci PSSCR for each of the idle states in ibm,cpu-idle-state-names. 7662306a36Sopenharmony_ci This property is required on POWER9 and absent on POWER8. 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci- ibm,cpu-idle-state-psscr-mask: 7962306a36Sopenharmony_ci Array of unsigned 64-bit values containing the masks 8062306a36Sopenharmony_ci indicating which psscr fields are set in the corresponding 8162306a36Sopenharmony_ci entries of ibm,cpu-idle-state-psscr. This property is 8262306a36Sopenharmony_ci required on POWER9 and absent on POWER8. 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci Whenever the firmware sets an entry in 8562306a36Sopenharmony_ci ibm,cpu-idle-state-psscr-mask value to 0xf, it implies that 8662306a36Sopenharmony_ci only the Requested Level (RL) field of the corresponding entry 8762306a36Sopenharmony_ci in ibm,cpu-idle-state-psscr should be considered by the 8862306a36Sopenharmony_ci kernel. For such idle states, the kernel would set the 8962306a36Sopenharmony_ci remaining fields of the psscr to the following sane-default 9062306a36Sopenharmony_ci values. 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci - ESL and EC bits are to 1. So wakeup from any stop 9362306a36Sopenharmony_ci state will be at vector 0x100. 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_ci - MTL and PSLL are set to the maximum allowed value as 9662306a36Sopenharmony_ci per the ISA, i.e. 15. 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci - The Transition Rate, TR is set to the Maximum value 9962306a36Sopenharmony_ci 3. 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci For all the other values of the entry in 10262306a36Sopenharmony_ci ibm,cpu-idle-state-psscr-mask, the kernel expects all the 10362306a36Sopenharmony_ci psscr fields of the corresponding entry in 10462306a36Sopenharmony_ci ibm,cpu-idle-state-psscr to be correctly set by the firmware. 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ci- ibm,cpu-idle-state-pmicr: 10762306a36Sopenharmony_ci Array of unsigned 64-bit values containing the pmicr values 10862306a36Sopenharmony_ci for the idle states in ibm,cpu-idle-state-names. This 64-bit 10962306a36Sopenharmony_ci register value is to be set in pmicr for the corresponding 11062306a36Sopenharmony_ci state if the flag indicates that pmicr SPR should be set. This 11162306a36Sopenharmony_ci is an optional property on POWER8 and is absent on 11262306a36Sopenharmony_ci POWER9. 11362306a36Sopenharmony_ci 11462306a36Sopenharmony_ci- ibm,cpu-idle-state-pmicr-mask: 11562306a36Sopenharmony_ci Array of unsigned 64-bit values containing the mask indicating 11662306a36Sopenharmony_ci which of the fields of the PMICR are set in the corresponding 11762306a36Sopenharmony_ci entries in ibm,cpu-idle-state-pmicr. This is an optional 11862306a36Sopenharmony_ci property on POWER8 and is absent on POWER9. 119